chain_getFinalizedHead
Description
Returns the hash of the latest finalized block. Finalized blocks are guaranteed not to be reverted, making this method essential before acknowledging cross-chain transfers or decoding historical storage.
Parameters
This method does not accept parameters.
Returns
Field | Type | Description |
---|---|---|
result | string | Hex-encoded hash of the latest finalized block |
Request Example
{
"jsonrpc": "2.0",
"method": "chain_getFinalizedHead",
"params": [],
"id": 1
}
Response Example
{
"jsonrpc": "2.0",
"result": "0x0783f5b163e338d4d74a1ee39a0f631bc2dffbd8862460407f6cc97c903194e1",
"id": 1
}
The example corresponds to block #9,453,706 finalized on 2025-10-03 07:42:59 UTC.
Code Examples
JavaScript
const finalizedHash = await api.rpc.chain.getFinalizedHead();
console.log('Finalized hash:', finalizedHash.toHex());
Python
payload = {
"jsonrpc": "2.0",
"method": "chain_getFinalizedHead",
"params": [],
"id": 1
}
resp = requests.post(
"https://api-bifrost-polkadot.n.dwellir.com/YOUR_API_KEY",
headers={"Content-Type": "application/json"},
data=json.dumps(payload)
)
finalized_hash = resp.json()["result"]
print(finalized_hash)
Rust
let finalized = api.rpc().finalized_head().await?;
println!("Latest finalized head: {}", finalized);
Best Practices
- Use
chain_getFinalizedHead
before reading storage for accounting-sensitive processes (staking, collateral balances, bridge proofs). - Compare the finalized hash returned here with
chain_getHeader
to retrieve header metadata for the same block, then inspect parent hashes to ensure continuity.