Skip to main content

chain_getBlock - JSON-RPC Method

Description#

Retrieves complete block information from the Hydration 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": [
"0x7fc8fd64a450661fd8c4a60577fe189f169d8aa97697f227a12496dba14db225"
],
"id": 1
}

Response Example#

Sample response for block #9457756 captured 2025-10-01.

{
"jsonrpc": "2.0",
"result": {
"block": {
"header": {
"parentHash": "0x941ef64d8daa8fddcba9a7b698c912611e08601cf7d4be12ea3d5412a5df9a2d",
"number": "0x90505c",
"stateRoot": "0x04ddc6c3c1633a3d8a33afa961674371228050279b4507ebcd23e5b1bd5cfea1",
"extrinsicsRoot": "0xbdfd357bb38a602d496793bfd8250a9f1d866ef6143fbf4e27076a124cf4dbf0",
"digest": {
"logs": [
"0x0661757261208a2c7a1100000000",
"0x0452505352903006d1651014effe612aeb9e2bed207fca849e69a1d4594bdab580afc68677458a62ad06"
]
}
},
"extrinsics": [
"0x280403000b60e2739f9901",
"0x8e54010004670031045bd0b8b40a0a9951e16249c55b84c3011eaf9995191954..."
]
},
"justifications": null
},
"id": 1
}

Code Examples#

# Get latest block
curl https://api-hydration.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-hydration.n.dwellir.com/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "chain_getBlock",
"params": ["0x7fc8fd64a450661fd8c4a60577fe189f169d8aa97697f227a12496dba14db225"],
"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