Retrieves a list of blocks from the TON blockchain
blocks
The blocks
endpoint retrieves a list of blocks from the TON blockchain. This endpoint allows you to fetch multiple blocks at once, with options for pagination and sorting.
Get you own node endpoint today
Start for free and get your app to production levels immediately. No credit card required.
You can sign up with your GitHub, X, Google, or Microsoft account.
Parameters
limit
(integer, optional) — The maximum number of blocks to return. Default: 128.offset
(integer, optional) — The number of blocks to skip before starting to return results. Default: 0.sort
(string, optional) — The sorting order of the blocks. Possible values: "asc" (ascending) or "desc" (descending). Default: "desc".
Response
The response is an object containing an array of blocks
. Each block in the array has the following properties:
seqno
(integer) — The sequence number of the block.shard
(string) — The shard identifier of the block.workchain
(integer) — The workchain ID of the block.fileHash
(string) — The file hash of the block.rootHash
(string) — The root hash of the block.timestamp
(integer) — The timestamp of the block.
Use case
The blocks
endpoint is essential for applications that need to analyze or display information about multiple blocks in the TON blockchain. Some common use cases include:
- Block explorers: To show a list of recent blocks and their basic information.
- Analytics tools: To gather data about block production rates, sizes, and other metrics.
- Monitoring services: To track the progress of the blockchain and detect any anomalies in block production.
- Synchronization services: To help light clients or other services catch up with the latest state of the blockchain.
- Historical analysis: To study patterns in block production over time.
By using this endpoint, developers can efficiently retrieve information about multiple blocks at once, enabling them to build comprehensive and performant applications that interact with or analyze the TON blockchain.
Pagination and sorting
The blocks
endpoint supports pagination through the limit
and offset
parameters. This allows you to retrieve blocks in manageable chunks and implement features like "load more" or paginated views in your application.
The sort
parameter allows you to control the order in which blocks are returned. Setting it to "desc" (the default) will return the most recent blocks first, which is useful for displaying the latest blockchain activity. Setting it to "asc" will return older blocks first, which can be helpful for historical analysis or synchronization purposes.