⚠️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 Moonriver 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": [
"0xa39d25f8cf7ad27e6a739dc15d4d013bdc48b6e2819bb74c72822a930adb5649"
],
"id": 1
}

Response Example

{
"jsonrpc": "2.0",
"result": {
"block": {
"header": {
"parentHash": "0xa9b9ad0e896561095b8f1c177acdf7318d21469529e3352438b9edc52839eb1b",
"number": "0x1ac8b61",
"stateRoot": "0x577d42d825f054a4b33922e1a74d6593301fd3dbad05c402e151868ce664b006",
"extrinsicsRoot": "0x0f967ba2249baee6fc2a72f7479b59d5a0a4f2e179af4fd8137d039a8b2a832b",
"digest": {
"logs": [

"0x0642414245b501038501000027627b110000000094ec3341e8d27c6e199ad31f2b12ba5af2bfa586ab78e5ef874930ed4fdbcf011cb158a098ed44247b2a69960f35414cb366d57672e482668202ff1f4779300195758e67b0254ec9952eed605cfa54d8beba48889255b1f959ef5e8aab978a04",
"0x0442454546840301ee9589ed3271866acf57c01ae10d2f238f08bd1a88f96b1121a12fe5b088eb",
"0x05424142450101dae544aa5a59545f1162072633c7548ccb621a59211d2a80f5cca68e37dbf97ffaadab6343a933292307b0cbf73009836528b9579b8ebf66ebb6354ff9b57682"
]
}
},
"extrinsics": [
"0x280503000b1172ccbb9901",
"0x12c704000536005509e101464d10c6..."
]
},
"justifications": null
},
"id": 1
}

Tip: Replace the sample block reference with a recent Moonriver block hash from chain_getFinalizedHead.

Code Examples

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