Skip to main content

chain_getBlock - JSON-RPC Method

Description#

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

Response Example#

{
"jsonrpc": "2.0",
"result": {
"block": {
"header": {
"parentHash": "0x95e3ecca8a0f9965d844bec3f7c9285350e0e0f810032c7ce0960cef4a1a2292",
"number": "0x1d0194c",
"stateRoot": "0xa02baaa678a09fcbe8d01c921786179c24c02329530e969dcc358c1598ca5153",
"extrinsicsRoot": "0x54e4a7a4f55fbc5bc847571a91c8a2bda39efe3596659f2b3ed189faabe4268a",
"digest": {
"logs": [

"0x0642414245b50103db02000019627b1100000000b815618dcf43740cdb1eb2ba1f8174353107052440f3018d0e61f7b5872b407e8b9b0547b2ae962d554e8f96b5c88d3b66044dfae4a66319554a6c9c2bc5810ef79b07077efcc2dd3a8a5831e3abd3501d5a53f5e4a3bf62cf0045ee4de4120d",
"0x0442454546840314580ee172a46e4c11a69a211541a8bfc396fc036b62d8a6fe8395b96685e6fe",
"0x05424142450101ee308036d601bc6f42e62794e79c56ca1306ae17c1562f950c54c06066372874454b22b9b9f299656384e5b767f247fa036ae91c7d9e3683106f8fd9f921a880"
]
}
},
"extrinsics": [
"0x28040200035a9c80b80801",
"0x22028400..."
]
},
"justifications": null
},
"id": 1
}

Tip: The example references finalized Kusama block 0x1d0194c (decimal 30415180). Use chain_getFinalizedHead to fetch the latest hash before querying specific blocks.

Code Examples#

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