For the complete documentation index, see llms.txt. This page is also available as Markdown.

chain_subscribeFinalizedHeads - Bittensor

Example code for the chain_subscribeFinalizedHeads JSON-RPC method. Complete guide on how to use chain_subscribeFinalizedHeads JSON-RPC in GetBlock Web3 documentation.

Subscribes to new finalized block headers. Slower than chain_subscribeNewHeads (finalized blocks lag the chain tip), but reorg-safe — these blocks will never be reverted.

Substrate native JSON-RPC method. Call against a GetBlock endpoint configured for the Substrate interface. For typed SDK access, use Polkadot.js (TypeScript) or substrateinterface (Python).

Parameters

  • None

Request Example

# WebSocket-only method. Use wscat (or similar) to connect first:
wscat -c 'wss://go.getblock.io/<ACCESS-TOKEN>/'

# Then send:
{"jsonrpc": "2.0", "method": "chain_subscribeFinalizedHeads", "params": [], "id": "getblock.io"}
import WebSocket from 'ws';

const ws = new WebSocket('wss://go.getblock.io/<ACCESS-TOKEN>/');

ws.on('open', () => {
    ws.send(JSON.stringify({
    "jsonrpc": "2.0",
    "method": "chain_subscribeFinalizedHeads",
    "params": [],
    "id": "getblock.io"
}));
});

ws.on('message', (data) => {
    console.log(JSON.parse(data.toString()));
});

Response Example

{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": "A1cB2dE3fG4hI5jK6lM7nO8pQ"
}

Response Parameters

Field
Type
Description

result

string

Subscription ID for finalized head notifications

Use Cases

  • Building safe state machines that progress on finality, not chain-tip

  • Bridge relayers that need finality guarantees before forwarding messages

  • Withdrawal/payout pipelines that should never process a reorged block

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid <ACCESS-TOKEN>

-32602

Invalid params

Request parameters are missing or malformed

-32601

Method not found

Method does not exist on this interface — check whether you're calling a Substrate method on an EVM endpoint or vice versa

-32603

Internal error

Server-side error while processing the request

429

Too Many Requests

Rate limit exceeded for your plan

SDK Integration

Last updated

Was this helpful?