Skip to main content

chain_getHeader

Retrieves the header for a specific block

The purpose of the chain_getHeader RPC function is to retrieve the header information from a certain blockchain block. Users can obtain vital header information, such as the parent hash, block number, state root, extrinsics root, and extra digest data, by supplying the hash of a particular block. The method returns the header of the most recent block in the chain by default if no block hash is given.

Example Request and Result for chain_getHeader method

In this section, we provide an illustrative example of a request made to retrieve details contents using the chain_getHeader method. Additionally, we present the resulting response containing information about getting the header for a specific block.

Parameters

FieldsTypeDescription

blockhash*

string

The block hash that you are trying to get the header information for. The request will return the header of the most recent block in the chain if it is not provided.

info

The example in this section uses a non-existing project id.

Make sure you replace it with your Vara Mainnet endpoint when issuing the API calls.

Don't have a project id? Here's a straightforward guide on how to obtain one!

Retrieves the header for a specific block

POST https://vara-mainnet.blastapi.io/<project-id>

Request Body

NameTypeDescription
blockhash*string0xc60ed6e41e2fc08321e85d0efb7177ade2f7a471e62577611e19d74318e2fdd5
{
"jsonrpc": "2.0",
"result": {
"parentHash": "0xe0ee3872c50b4d0d8ca568679beb7e9e29e6d2caa30a52085c0a34b3a137e734",
"number": "0x98d1e0",
"stateRoot": "0xb36db4c730268e4db0641e3fbb515d1090fc1b00408f8847d8843ed734843e4d",
"extrinsicsRoot": "0x9e307c20a2bbd447607d728724fe6da53742bb604251ebc93c40ea0573503745",
"digest": {
"logs": [
"0x0642414245b501012500000035adf7210000000010401e260b7c45abbd6b823373425b28bd331a94afbe1701f521e6ed9e87d177f749b0e9d7ef2aaf3af88ca14d1378e943f477f0a920db9404344fdb0563940ca33ea68be58ab189607ff901ba284a68ab2ef8a03d73297d14702980663f9c00",
"0x0542414245010122b4223cb7b54e84be365e762a95b137104e8115c36fbd295c8db3d6439283218746dd9347d202cc0cdbdc0875cab7ab4fc8f90f115d5c4855dfad8a74988a80"
]
}
},
"id": 1
}

Curl Request example

curl --location 'https://vara-mainnet.blastapi.io/<project-id>' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "chain_getHeader",
"params": ["0xc60ed6e41e2fc08321e85d0efb7177ade2f7a471e62577611e19d74318e2fdd5"],
"id": 1
}'