⚠️Blast API (blastapi.io) ends Oct 31. Migrate to Dwellir and skip Alchemy's expensive compute units.
Switch Today →
Skip to main content

chain_getBlock - JSON-RPC Method

Description#

Retrieves complete block information from the Polkadot blockchain, including the block header, extrinsics, and justifications. When called without parameters, returns the latest block.

Parameters#

ParameterTypeRequiredDescription
blockHashstringNoHex-encoded block hash. If omitted, returns the latest block

Returns#

FieldTypeDescription
blockobjectComplete block data
block.headerobjectBlock header information
block.header.parentHashstringHash of the parent block
block.header.numberstringBlock number (hex-encoded)
block.header.stateRootstringRoot of the state trie
block.header.extrinsicsRootstringRoot of the extrinsics trie
block.header.digestobjectBlock digest items
block.extrinsicsarrayArray of extrinsics in the block
justificationsarrayBlock justifications (if available)

Request Example#

{
"jsonrpc": "2.0",
"method": "chain_getBlock",
"params": [
"0xe56606c30688c0f08d2eca5eb28e02e9878ce9c28998ecc7541c68277e2bc94b"
],
"id": 1
}

Response Example#

{
"jsonrpc": "2.0",
"result": {
"block": {
"header": {
"parentHash": "0xcc0a7a965f9b98d3c5eb46b99c1fad579b17c5e94b1254ab53dbf395ad193821",
"number": "0x968a6e",
"stateRoot": "0xa0c05728445046b290704283e4fc80ff8a14719e6619dbec3e80adb6cef5ea4a",
"extrinsicsRoot": "0xf6950859a3e2700f3c476af69d99bfe5a785cf88dcb654935cffc40ad4edd916",
"digest": {
"logs": [
"0x066175726120aaafbd0800000000",
"0x0452505352905c983a7a7e537ca58173cb3ff825519600bd99ef93cf49a62db9e68a62767aa44a22b206"
]
}
},
"extrinsics": [
"0x1296010005010091037f8ce5060944c1a94713758c661330f1d2a34f33019a23fb6032f57b66ec93beb6295a02298329d63687e1d2ab801fd67a19189d1b795629a55c23a46d4817b6e2f3c37a48d2f22ee1770bc599c9276d8a945cf9f4ebe38fca8090e8b80e80c2bd383d960c066175726120aaafbd0800000000",
"..."
]
},
"justifications": null
},
"id": 1
}

Tip: The example above references finalized block 0x968a6e (decimal 9,865,838). Update the hash if you need metadata from a more recent block.

Code Examples#

# Get latest block
curl https://api-asset-hub-polkadot.n.dwellir.com/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "chain_getBlock",
"params": [],
"id": 1
}'

# Get specific block
curl https://api-asset-hub-polkadot.n.dwellir.com/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "chain_getBlock",
"params": ["0xe56606c30688c0f08d2eca5eb28e02e9878ce9c28998ecc7541c68277e2bc94b"],
"id": 1
}'

Use Cases#

  1. Block Explorers: Display block details and transaction history
  2. Chain Analysis: Analyze block production patterns and extrinsic distribution
  3. Transaction Verification: Confirm transaction inclusion in specific blocks
  4. Network Monitoring: Track block production and finalization
  5. Data Indexing: Build databases of historical blockchain data

Block Structure Details#

Header Fields#

  • parentHash: Links blocks in the chain
  • number: Sequential block identifier
  • stateRoot: Merkle root of all account states
  • extrinsicsRoot: Merkle root of all extrinsics
  • digest: Contains consensus-related data (BABE, GRANDPA)

Extrinsics#

Each extrinsic in the array is hex-encoded and contains:

  • Signature (for signed extrinsics)
  • Method call data
  • Additional parameters (nonce, tip, mortality)

Notes#

  • Block numbers are hex-encoded in responses
  • Extrinsics are returned as hex-encoded SCALE data
  • Justifications are only present for finalized blocks with GRANDPA proofs
  • Latest block may not be finalized - use chain_getFinalizedHead for finalized blocks
  • Block data can be large - consider using chain_getHeader if only header is needed