blocks | TON v3

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:

  1. Block explorers: To show a list of recent blocks and their basic information.
  2. Analytics tools: To gather data about block production rates, sizes, and other metrics.
  3. Monitoring services: To track the progress of the blockchain and detect any anomalies in block production.
  4. Synchronization services: To help light clients or other services catch up with the latest state of the blockchain.
  5. 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.

Language
Click Try It! to start a request and see the response here!