Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start TON-HTTP-API #23

Open
artmon opened this issue Dec 11, 2023 · 20 comments
Open

Start TON-HTTP-API #23

artmon opened this issue Dec 11, 2023 · 20 comments

Comments

@artmon
Copy link

artmon commented Dec 11, 2023

Please, help. Can't start TON-HTTP-API.

I got empty wondow:
image

My settings:
image

I tried Manual TON-HTTP-API installation
but got this:
start pip3 install -U ton-http-api
image
What path I have to do it in?

I have jdk-17 (tried jdk-21 too)

I tried to connect to MyLocalTon from local TON-HTTP-API.
I used configs (all of them) in path:
myLocalTon\genesis\db

and got this:
image

Logs (myLocalTon\genesis\db\log):

2023.12.11_15-55-21.thread1.log
2023.12.11_15-55-21.thread2.log
2023.12.11_15-55-25.thread2.log
2023.12.11_15-55-25.thread3.log

@neodix42
Copy link
Owner

Could you please try to execute (without start) and post the result here?
pip3 install -U ton-http-api

@artmon
Copy link
Author

artmon commented Dec 12, 2023

Could you please try to execute (without start) and post the result here? pip3 install -U ton-http-api

PS C:\Users\garkavyy.a\Downloads\myLocalTon> pip3 install -U ton-http-api
Requirement already satisfied: ton-http-api in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (2.0.37)
Requirement already satisfied: redis==5.0.1 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ton-http-api) (5.0.1)
Requirement already satisfied: loguru>=0.6.0 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ton-http-api) (0.7.2)
Requirement already satisfied: fastapi>=0.78.0 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ton-http-api) (0.104.1)
Requirement already satisfied: pydantic>=1.9.1 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ton-http-api) (2.5.2)
Requirement already satisfied: requests>=2.28.0 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ton-http-api) (2.31.0)
Requirement already satisfied: ring==0.10.1 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ton-http-api) (0.10.1)
Requirement already satisfied: uvicorn>=0.17.6 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ton-http-api) (0.24.0.post1)
Requirement already satisfied: gunicorn>=20.1.0 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ton-http-api) (21.2.0)
Requirement already satisfied: pytonlib==0.0.43 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ton-http-api) (0.0.43)
Requirement already satisfied: inject>=4.3.1 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ton-http-api) (5.2.0)
Requirement already satisfied: crc16>=0.1.1 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from pytonlib==0.0.43->ton-http-api) (0.1.1)
Requirement already satisfied: tvm-valuetypes>=0.0.9 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from pytonlib==0.0.43->ton-http-api) (0.0.12)
Requirement already satisfied: six>=1.11.0 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ring==0.10.1->ton-http-api) (1.16.0)
Requirement already satisfied: wirerope>=0.4.7 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ring==0.10.1->ton-http-api) (0.4.7)
Requirement already satisfied: attrs>=19.3.0 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from ring==0.10.1->ton-http-api) (23.1.0)
Requirement already satisfied: anyio<4.0.0,>=3.7.1 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from fastapi>=0.78.0->ton-http-api) (3.7.1)
Requirement already satisfied: starlette<0.28.0,>=0.27.0 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from fastapi>=0.78.0->ton-http-api) (0.27.0)
Requirement already satisfied: typing-extensions>=4.8.0 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from fastapi>=0.78.0->ton-http-api) (4.9.0)
Requirement already satisfied: packaging in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from gunicorn>=20.1.0->ton-http-api) (23.2)
Requirement already satisfied: colorama>=0.3.4 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from loguru>=0.6.0->ton-http-api) (0.4.6)
Requirement already satisfied: win32-setctime>=1.0.0 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from loguru>=0.6.0->ton-http-api) (1.1.0)
Requirement already satisfied: annotated-types>=0.4.0 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from pydantic>=1.9.1->ton-http-api) (0.6.0)
Requirement already satisfied: pydantic-core==2.14.5 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from pydantic>=1.9.1->ton-http-api) (2.14.5)
Requirement already satisfied: charset-normalizer<4,>=2 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from requests>=2.28.0->ton-http-api) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from requests>=2.28.0->ton-http-api) (3.6)
Requirement already satisfied: urllib3<3,>=1.21.1 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from requests>=2.28.0->ton-http-api) (2.1.0)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from requests>=2.28.0->ton-http-api) (2023.11.17)
Requirement already satisfied: click>=7.0 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from uvicorn>=0.17.6->ton-http-api) (8.1.7)
Requirement already satisfied: h11>=0.8 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from uvicorn>=0.17.6->ton-http-api) (0.14.0)
Requirement already satisfied: sniffio>=1.1 in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from anyio<4.0.0,>=3.7.1->fastapi>=0.78.0->ton-http-api) (1.3.0)
Requirement already satisfied: crc32c in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from tvm-valuetypes>=0.0.9->pytonlib==0.0.43->ton-http-api) (2.3.post0)
Requirement already satisfied: bitarray in c:\users\garkavyy.a\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from tvm-valuetypes>=0.0.9->pytonlib==0.0.43->ton-http-api) (2.8.5)

[notice] A new release of pip is available: 23.2.1 -> 23.3.1
[notice] To update, run: C:\Users\garkavyy.a\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\python.exe -m pip install --upgrade pip
PS C:\Users\garkavyy.a\Downloads\myLocalTon>

@neodix42
Copy link
Owner

It seems that ton-http-api is installed correctly. Also make sure that you don't have ton-http-process running somewhere.

If you have previously marked the checkbox "Enable ton-http-api service", please execute start the app again:
java -jar MyLocalTon.jar debug
and attach here the log file located under myLocalTon/myLocalTon.log.

@artmon
Copy link
Author

artmon commented Dec 12, 2023

attach here the log file located under myLocalTon/myLocalTon.log.

myLocalTon.log

@neodix42
Copy link
Owner

I see that this is not the whole file, the starting messages are missing.
Could you please try to delete it and restart the app?

@artmon
Copy link
Author

artmon commented Dec 12, 2023

myLocalTon.log

@neodix42
Copy link
Owner

From this log file I can see that ton-http-api is never get started.
Either after the start mark the checkbox again or close the app and modify inside myLocalTon/settings.json:

  "uiSettings": {
    "showTickTockTransactions": false,
    "showMainConfigTransactions": true,
    "showInOutMessages": true,
    "showBodyInMessage": true,
    "showShardStateInBlockDump": false,
    "enableBlockchainExplorer": false,
    "enableTonHttpApi": true, <------------------- here
    "blockchainExplorerPort": 8000,
    "tonHttpApiPort": 8081
  },

and send the log file again.
Normally you should see in the log file msg like "Starting ton-http-api on port.."

@artmon
Copy link
Author

artmon commented Dec 12, 2023

Normally you should see in the log file msg like "Starting ton-http-api on port.."

myLocalTon.log

@neodix42
Copy link
Owner

Interesting. One more test, please.
It seems that ton-http-api cannot be found without a path.
Could you please open a terminal (cmd) and execute ton-http-api? What does it say?

@artmon
Copy link
Author

artmon commented Dec 12, 2023

Could you please open a terminal (cmd) and execute ton-http-api? What does it say?

Looks like I had bad installed python version (
I have deleted it and installed from MyLocalTon suggested me 3.12.0

Currently, it's:


C:\Users\garkavyy.a>ton-http-api
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\garkavyy.a\AppData\Local\Programs\Python\Python312\Scripts\ton-http-api.exe\__main__.py", line 7, in <module>
  File "C:\Users\garkavyy.a\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyTON\__main__.py", line 63, in main
    from pyTON.main import app
  File "C:\Users\garkavyy.a\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyTON\main.py", line 24, in <module>
    from pyTON.manager import TonlibManager
  File "C:\Users\garkavyy.a\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyTON\manager.py", line 12, in <module>
    from pyTON.worker import TonlibWorker
  File "C:\Users\garkavyy.a\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyTON\worker.py", line 10, in <module>
    from pytonlib import TonlibClient, TonlibException, BlockNotFound
  File "C:\Users\garkavyy.a\AppData\Local\Programs\Python\Python312\Lib\site-packages\pytonlib\__init__.py", line 1, in <module>
    from pytonlib.client import TonlibClient
  File "C:\Users\garkavyy.a\AppData\Local\Programs\Python\Python312\Lib\site-packages\pytonlib\client.py", line 8, in <module>
    from pytonlib.tonlibjson import TonLib
  File "C:\Users\garkavyy.a\AppData\Local\Programs\Python\Python312\Lib\site-packages\pytonlib\tonlibjson.py", line 5, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

C:\Users\garkavyy.a>

myLocalTon.log

@neodix42
Copy link
Owner

neodix42 commented Dec 12, 2023 via email

@artmon
Copy link
Author

artmon commented Dec 12, 2023

pip install setuptools

It works!

But currently I can't get masterchain Info. It's loading forever

image

myLocalTon.log

@neodix42
Copy link
Owner

From the log file, I see that there are no errors.
Try to reboot your PC, start MyLocalTon as usual, navigate to the HTTP API section (you should be able to see it now) and execute any HTTP called from there.

@artmon
Copy link
Author

artmon commented Dec 13, 2023

Try to reboot your PC

Doesn't help for me.

When I run ton-http-api in the console. I get: (Maybe problem in this?)

2023-12-13 08:46:09.846 | ERROR    | pyTON.worker:run:68 - TonlibWorker #017 failed to init and sync tonlib: Could not find module 'C:\Python311\Lib\site-packages\pytonlib\distlib\windows\tonlibjson.amd64.dll' (or one of its dependencies). Try using the full path with constructor syntax.
Exception in tonlibjson.__del__: Traceback (most recent call last):
  File "C:\Python311\Lib\site-packages\pytonlib\tonlibjson.py", line 133, in __del__
    self._tonlib_json_client_destroy(self._client)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TonLib' object has no attribute '_tonlib_json_client_destroy'

Exception ignored in: <function TonLib.__del__ at 0x000001BE9FCD36A0>
Traceback (most recent call last):
  File "C:\Python311\Lib\site-packages\pytonlib\tonlibjson.py", line 136, in __del__
    raise RuntimeError(f'Error in tonlibjson.__del__: {ee}')
RuntimeError: Error in tonlibjson.__del__: 'TonLib' object has no attribute '_tonlib_json_client_destroy'

@neodix42
Copy link
Owner

ok, it seems that you are missing OpenSSL in your system.
Please install from here and let me know if works.

@artmon
Copy link
Author

artmon commented Dec 14, 2023

Everything is the same.
image

@neodix42
Copy link
Owner

neodix42 commented Dec 17, 2023 via email

@artmon
Copy link
Author

artmon commented Dec 18, 2023

Could you please try with OpenSSL 1.1 version?

It works! Just perfect! Thank you very much! 🤝

@artmon
Copy link
Author

artmon commented Dec 18, 2023

It's a strange, but it works only 10-20 first requests (getMasterchainInfo) and then always "error": "Liteserver timeout".

@neodix42
Copy link
Owner

Please try the latest version and reply if you are still having this issue. Thanks for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants