chain_getBlock
Fetches a full Manta Atlantic block, including header, extrinsics, and justification data. When params
is empty, the latest block is returned.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
blockHash | string | No | Hex-encoded block hash. When omitted, returns the most recent block. |
Returns
The method returns a JSON object with the following fields:
Field | Type | Description |
---|---|---|
block | object | Full block data, including header and extrinsics. |
block.header | object | Contains parent hash, number, state root, extrinsics root, and digest. |
block.extrinsics | array | List of SCALE-encoded extrinsics in the block. |
justifications | array or null | Finality proofs (GRANDPA) when available. |
Reference: Substrate JSON-RPC Specification.
Request Example
{
"jsonrpc": "2.0",
"method": "chain_getBlock",
"params": [
"0x3b5dcb0d26f0a21cb88d5df4fe7e88f7a8e50a6b9c6e3a57306d98e010ce4081"
],
"id": 1
}
Response Example
{
"jsonrpc": "2.0",
"result": {
"block": {
"header": {
"number": "0x1c22e0",
"parentHash": "0xaf1dfe5de408f13ec3b54d2797dd934c7b3f54a1b53a6a2d4538af5c4c4c9b47",
"stateRoot": "0x9c58d8b2eaf5a19eb712f27a7ed8a24c0b345f0f8524ff4e0c28c908276d1f7c",
"extrinsicsRoot": "0x682cdf1cd83fba629a506d9fe7839f5a9f87d86161b9e27e4d75fab9c966cf39"
},
"extrinsics": [
"0x280402000b50cd548d8501",
"0x450284008eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48"
]
},
"justifications": null
},
"id": 1
}
Usage Scenarios
- Index zkSBT issuance extrinsics for compliance dashboards and revocation tracking.
- Monitor zkAddress note commitments to keep off-chain wallets synchronized.
Code Examples
cURL
curl https://api-manta-atlantic-mainnet.n.dwellir.com/YOUR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "chain_getBlock",
"params": [],
"id": 1
}'
JavaScript (fetch)
export async function getBlock(blockHash) {
const body = {
jsonrpc: '2.0',
method: 'chain_getBlock',
params: blockHash ? [blockHash] : [],
id: 1,
};
const res = await fetch('https://api-manta-atlantic-mainnet.n.dwellir.com/YOUR_API_KEY', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body),
});
if (!res.ok) throw new Error('Failed to fetch block');
return res.json();
}
Python (requests)
import json
import requests
def chain_get_block(block_hash=None):
payload = {
"jsonrpc": "2.0",
"method": "chain_getBlock",
"params": [block_hash] if block_hash else [],
"id": 1
}
response = requests.post(
"https://api-manta-atlantic-mainnet.n.dwellir.com/YOUR_API_KEY",
headers={"Content-Type": "application/json"},
data=json.dumps(payload),
timeout=10
)
response.raise_for_status()
return response.json()
Error Codes
Code | Meaning |
---|---|
-32602 | Invalid params (e.g., malformed hash) |
-32002 | Resource temporarily unavailable (node restarting) |
Handle errors by retrying with exponential backoff and verifying the block hash exists.