⚠️Blast API (blastapi.io) ends Oct 31. Migrate to Dwellir and skip Alchemy's expensive compute units.
Switch Today →
Skip to main content

chain_getFinalizedHead

Description

Returns the hash of the most recently finalized block. Use this to anchor queries that require GRANDPA finality guarantees.

Parameters

This method does not require any parameters.

Request Example

{
"jsonrpc": "2.0",
"method": "chain_getFinalizedHead",
"params": [],
"id": 1
}

Response Example

{
"jsonrpc": "2.0",
"id": 1,
"result": "0xc0e39f31d240a9c60267cb008c9c095061eeab953f345fa2bcd25b6d94bba78b"
}

Code Examples

cURL

curl https://api-astar.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "chain_getFinalizedHead",
"params": [],
"id": 1
}'

JavaScript

const head = await api.rpc.chain.getFinalizedHead();
const header = await api.rpc.chain.getHeader(head);
console.log(`Finalized #${header.number}`);

Python

payload = {"jsonrpc": "2.0", "method": "chain_getFinalizedHead", "params": [], "id": 1}
resp = requests.post(
"https://api-astar.n.dwellir.com/YOUR_API_KEY",
headers={"Content-Type": "application/json"},
data=json.dumps(payload)
)
print(resp.json()["result"])