Skip to main content

chain_getBlock RPC method

The chain_getBlock method is an essential RPC call for obtaining detailed information about a specific block in the relay chain. This method requires a block hash as input and returns a comprehensive set of details about the specified block, encompassing both its header and body components.

Parameters

BlockHash string REQUIRED

Returns

result object

A detailed structure of the specified block, comprising:

block
object
A composite object illustrating the block's structure

header object

Contains metadata about the block, like hashes and block number

parentHash string

Hash of the preceding block in the blockchain

number string

Sequential identifier of the block in the blockchain

stateRoot string

Root hash representing the state after processing the block's transactions

extrinsicsRoot string

Root hash for the trie of extrinsics in the block

digest array

Additional data and logs attached to the block

logs string

Array of logs included in the block's digest

extrinsics array

Collection of transactions (extrinsics) in the block

justifications array

Array of justifications verifying the block's validity, if present

Code Examples

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

FAQs

Is there anything similar to eth_getBlockByNumber in polkadot?

chain_getBlock is similar - you can also see chain_getBlockHash