chain_getBlock - JSON-RPC Method
Description#
Returns the complete block contents for a given hash or, when no parameter is supplied, the most recent block on Enjin Matrix. The response includes the header, all extrinsics encoded in SCALE, and optional justifications. This method underpins block explorers, indexers, and archival tooling.
Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
blockHash | string | No | Hex-encoded block hash. If omitted, the best block is returned |
Returns#
| Field | Type | Description |
|---|---|---|
block | object | Block data, including header and extrinsics |
block.header | object | Header metadata (parent hash, state root, extrinsics root, digest) |
block.extrinsics | array | Extrinsic payloads encoded in SCALE hex |
justifications | array | null | Consensus justifications when available |
Request Example#
{
"jsonrpc": "2.0",
"method": "chain_getBlock",
"params": [
"0x776f58000fb76b98f36ed750dba242f4f03ab040152c35a7b4c34f3c32e96dc3"
],
"id": 1
}
Response Example#
{
"jsonrpc": "2.0",
"result": {
"block": {
"header": {
"parentHash": "0xf8557e8e44cdb4d9cb6632549d5cd641180603cb083cf772278fd8f06934ebb5",
"number": "0x677848",
"stateRoot": "0x4322a28dc510ee0d58c4f0fcb2df32bf24a44b490ba177efe807be47e6eaa469",
"extrinsicsRoot": "0xacebd0cee16a6670db6970f2754f75a60a746c100b3033dc2f3affb7029a0fbb",
"digest": {
"logs": [
"0x066175726120d4917a1100000000",
"0x045250535290129381a536fb2010aacff87fb5558c5d7dfde2ace0c7c5cc982cf8c076d4a870e218ed02"
]
}
},
"extrinsics": [
"0x71410401009103d08aae3f0e531e0f9df83f8ddba716bc079d777d48e3eafcc2d3b92572a528401ee19d0143acae35e2e5d4dda94b91e39d87529ff5e2f450967daedda276efb0bc03dcdacbbb9ba9...",
"0x280403000bc0d8b9a89901"
]
},
"justifications": null
},
"id": 1
}
💡 Extrinsics are abbreviated for readability. Use the actual response to replay or decode transactions in your tooling.
Code Examples#
- cURL
- Python
- JavaScript
curl https://api-enjin-matrixchain.n.dwellir.com/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "chain_getBlock",
"params": ["0x776f58000fb76b98f36ed750dba242f4f03ab040152c35a7b4c34f3c32e96dc3"],
"id": 1
}'
import json
import requests
payload = {
"jsonrpc": "2.0",
"method": "chain_getBlock",
"params": ["0x776f58000fb76b98f36ed750dba242f4f03ab040152c35a7b4c34f3c32e96dc3"], # set to [hash] for a specific block
"id": 1,
}
block = requests.post(
"https://api-enjin-matrixchain.n.dwellir.com/YOUR_API_KEY",
headers={"Content-Type": "application/json"},
data=json.dumps(payload),
timeout=10,
).json()["result"]["block"]
print(block["header"]["number"])
async function getBlock(blockHash) {
const response = await fetch('https://api-enjin-matrixchain.n.dwellir.com/YOUR_API_KEY', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
method: 'chain_getBlock',
params: blockHash ? [blockHash] : [],
id: 1
})
});
const { result } = await response.json();
return result.block;
}
Usage Notes#
- Decode extrinsics with
@polkadot/api,subxt, orscale-codectooling to inspect calls such as NFT minting or fuel tank operations. - Pair with
chain_getBlockHash/chain_getHeaderwhen iterating through block heights. - Archive services should store both the header and extrinsics array to reconstruct historical state transitions.