Skip to main content

chain_getHeader RPC method

The chain_getHeader RPC method is designed to extract the header details of a given block in the blockchain. By providing the hash of a specific block, users can access critical header information, including its parent hash, block number, state root, extrinsics root, and additional digest data. If no block hash is specified, the method defaults to returning the header of the latest block in the chain.

Parameters

BlockHash string

The hash of the block for which you want to retrieve the header information. If not provided, the request will return the header of the latest block on the chain.

Returns

result object

An object representing the header information of the requested block:

parentHash string

The hash of the parent block, which is the previous block in the chain.

number string

The block number or height in the blockchain sequence.

stateRoot string

The root hash of the state trie after applying the block's transactions.

extrinsicsRoot string

The root hash of the trie containing the extrinsics (transactions) in the block.

digest array

An array containing additional data attached to the block, such as logs.

logs string

The logs associated with the block's digest.

Code Examples

curl https://api-polkadot.dwellir.com/<API-KEY> \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"chain_getHeader","params":[],"id":1,"jsonrpc":"2.0"}'