> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
> Use this file to discover all available pages before exploring further.

# blocks | TON v3

> The blocks endpoint retrieves a list of blocks from the TON blockchain. This endpoint allows you to fetch multiple blocks at once.

# 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.

## 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.


## OpenAPI

````yaml openapi/ton_node_api/v3/getBlocks.json GET /blocks
openapi: 3.0.0
info:
  title: TON API
  version: 3.0.0
  description: API for interacting with The Open Network (TON) blockchain
servers:
  - url: >-
      https://ton-mainnet.core.chainstack.com/f2a2411bce1e54a2658f2710cd7969c3/api/v3
security: []
paths:
  /blocks:
    get:
      tags:
        - Blockchain
      summary: Get Blocks
      description: Retrieves a list of blocks from the TON blockchain
      operationId: getBlocks
      parameters:
        - name: limit
          in: query
          description: The maximum number of blocks to return
          required: false
          schema:
            type: integer
            default: 128
        - name: offset
          in: query
          description: The number of blocks to skip before starting to return results
          required: false
          schema:
            type: integer
            default: 0
        - name: sort
          in: query
          description: The sorting order of the blocks
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  blocks:
                    type: array
                    items:
                      type: object
                      properties:
                        seqno:
                          type: integer
                          description: The sequence number of the block
                        shard:
                          type: string
                          description: The shard identifier of the block
                        workchain:
                          type: integer
                          description: The workchain ID of the block
                        fileHash:
                          type: string
                          description: The file hash of the block
                        rootHash:
                          type: string
                          description: The root hash of the block
                        timestamp:
                          type: integer
                          description: The timestamp of the block

````