getblockheader - TON

Example code for the getblockheader JSON-RPC method. Сomplete guide on how to use getblockheader JSON-RPC in GetBlock.io Web3 documentation.

This method returns the header of a specific block (workchain, shard, seqno). Optionally, root_hash and file_hash can be provided to verify the block identity.

Parameters

Parameter
Type
Required
Description

workchain

integer

Yes

Workchain ID

shard

string

Yes

Shard ID as a string-encoded int64

seqno

integer

Yes

Block sequence number

root_hash

string

No

Expected root hash of the block (for verification)

file_hash

string

No

Expected file hash of the block (for verification)

Request Example

REST (GET):

curl --location --request GET 'https://go.getblock.io/<ACCESS-TOKEN>/getBlockHeader?workchain=-1&shard=-9223372036854775808&seqno=45792554' \
--header 'Content-Type: application/json'

JSON-RPC (POST):

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "getBlockHeader",
    "params": {
        "workchain": -1,
        "shard": "-9223372036854775808",
        "seqno": 45792554
    },
    "id": "getblock.io"
}'

Response Example

Response Parameters

Field
Type
Description

result.id

object

Block ID this header describes

result.global_id

integer

Network global ID (-239 for TON mainnet, -3 for testnet)

result.gen_utime

integer

Block generation Unix timestamp

result.start_lt

string

Starting logical time within the block

result.end_lt

string

Ending logical time within the block

result.is_key_block

boolean

Whether the block is a key block (carries config updates)

result.prev_blocks

array

Block IDs immediately preceding this block

Use Cases

  • Verifying a block's identity and parent chain

  • Detecting key blocks (config changes)

  • Building light clients and SPV proofs

  • Indexing block-level metadata

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid <ACCESS-TOKEN>

422

Validation Error

Request parameters are missing or malformed

429

Too Many Requests

Rate limit exceeded for your plan

504

Lite Server Timeout

Upstream TON liteserver timed out

SDK Integration

Last updated

Was this helpful?