chain_getFinalizedHead - JSON-RPC Method
Description
Returns the hash of the most recently finalized block on Enjin Matrix. Use this hash when reading historical state or verifying finality-sensitive workflows such as NFT mint settlements and fuel tank crediting.
Parameters
No parameters are required.
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": "0x1873093eade39aa409f64537dd972c27156e4691fc0fda227a06d50c52ad5fef",
"id": 1
}
Code Examples
cURL
curl https://api-enjin-matrixchain.n.dwellir.com/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "chain_getFinalizedHead",
"params": [],
"id": 1
}'
JavaScript
const finalizedHead = 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_getFinalizedHead',
params: [],
id: 1
})
}).then((res) => res.json());
console.log(`Finalized head: ${finalizedHead.result}`);
Python
import json
import requests
payload = {
"jsonrpc": "2.0",
"method": "chain_getFinalizedHead",
"params": [],
"id": 1,
}
head_hash = 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"]
print(head_hash)
Best Practices
- Combine this hash with
chain_getHeader
to extract the finalized block number for monitoring dashboards. - Supply the finalized hash to
state_getStorage
when reading historical state snapshots. - For canary environments, expect different hashes and block cadence; always derive the value at runtime.