toncenter / ton-http-api

HTTP API for TON (The Open Network)
https://toncenter.com
GNU General Public License v3.0
226 stars 44 forks source link

splash_http_api

HTTP API for The Open Network

PyPI PyPI - Python Version Docker - Image Version Docker - Image Size Github last commit

Since TON nodes uses its own ADNL binary transport protocol, a intermediate service is needed for an HTTP connection.

TON HTTP API is such a intermediate service, receiving requests via HTTP, it accesses the lite servers of the TON network using tonlibjson.

You can use the ready-made toncenter.com service or start your own instance.

Building and running

Recommended hardware:

There are two main ways to run TON HTTP API:

Local run (experimental)

Note: It is simple but not stable way to run the service. We do not recommend to use it in production.

Docker Compose

Configuration

You should specify environment parameters and run ./configure.py to create .env file.

    export TON_API_LITESERVER_CONFIG=private/testnet.json
    ./configure.py

The service supports the following environment variables:

Webserver settings

Tonlib settings

Cache configuration

FAQ

How to point the service to my own lite server?

To point the HTTP API to your own lite server you should set TON_API_TONLIB_LITESERVER_CONFIG to config file with your only lite server.

How to run multiple API instances on single machine?

How to update tonlibjson library?

Binary file libtonlibjson now moved to pytonlib.

No working liteservers error.

Usually, liteservers from the config has already deleted the block, which specified in init_block section. To update init block, please backup your config file and run script ./scripts/update_init_block.sh private/mainnet.json. For testnet add flag --testnet.