Liteservers
The service provides access to a Lite API for interaction with a liteserver node (opens in a new tab).
This API is used in applications that require access to low-level blockchain data (transactions, account states, etc.) and guarantees the reliability of this data (proof verification (opens in a new tab)). For example: blockchain indexers, payment processors, SDK (opens in a new tab), etc.
A more detailed description of this protocol can be found here (opens in a new tab). The set of methods provided by the API is described here (opens in a new tab).
Advantages of this service over deploying your own node
- It eliminates the need for complex maintenance and updates of the node (especially demanding and costly in the case of an archival node)
- It reduces the risk of out of sync error
- It provides access to historical data
- It offers high availability
Connecting to the Liteserver
To connect to the Liteserver, you need to use an application or libraries with a Liteclient function.
You need to specify the Server and Public key or download the global.config.json file with the ready-made configuration for connection.
You can obtain this data in Tonconsole (opens in a new tab) after selecting a plan.
Access to two instances of Liteservers (Server #1 and Server #2) is provided,
and it is better to specify both for higher fault tolerance (if your software supports it).
Rate limits
Each plan has its rate limits, which operate on a sliding window algorithm. The window size is 10 seconds. Therefore, with a rate limit of 1 RPS, the maximum number of requests is 10 requests per 10-second period.
The maximum RPS for current plans is 50. Check with the t.me/tonrostislav (opens in a new tab)(rostislav.r@tonkeeper.com) for the custom plan.
To obtain rate limit data, the service provides an API method:
TL scheme for liteapi method:
liteProxy.requestRateLimit#14cb3f0c limit:int per_time:int = liteProxy.RequestRateLimit;
---functions---
liteProxy.getRequestRateLimit#f0f83e86 = liteProxy.RequestRateLimit;Where: rate limit = limit / per_time[s]
Error codes
In addition to the standard liteserver error codes (such as 651, -400, etc.), there are two additional error codes:
- 228 - rate limit exceeded (there used to be code 5556, but it was replaced with 228 for unification)
- 5555 - internal server error
It is important to correctly handle these error codes to ensure stable operation of the client application. To avoid the rate limit error, a rate limiter can be used on the client side and set to a value slightly below the maximum value of the plan. For error 5555, it is usually enough to retry the request.
Archive node access
By default, the service provides access to an archival node for obtaining historical data (i.e., data from the first blocks of the blockchain).