chain_subscribeFinalizedHeads - Mythos RPC Method
Subscribe to finalized block headers on Mythos. Real-time notifications for blocks that have achieved finality.
Subscribe to receive notifications when blocks are finalized on Mythos. Finalized blocks are guaranteed to never be reverted, making this essential for applications requiring strong consistency.
Use Cases
- Exchange deposits - Only credit funds after finalization for AAA gaming (FIFA Rivals, NFL Rivals, Pudgy Party), player-owned economies, and bot-resistant matchmaking
- Bridge operations - Wait for finality before cross-chain transfers
- Critical state changes - Ensure irreversibility for important transactions
Request Parameters
This method accepts no parameters.
Response Body
Parent block hash
Block number
State trie root hash
Extrinsics trie root hash
Block digest with consensus logs
Code Examples
import { ApiPromise, WsProvider } from '@polkadot/api';
const provider = new WsProvider('wss://api-mythos-archive.n.dwellir.com/YOUR_API_KEY');
const api = await ApiPromise.create({ provider });
// Subscribe to finalized heads
const unsubscribe = await api.rpc.chain.subscribeFinalizedHeads((header) => {
console.log(`Finalized block #${header.number}`);
console.log(` Hash: ${header.hash.toHex()}`);
// Safe to consider this block permanent
processConfirmedBlock(header);
});
// Later: unsubscribe()import asyncio
import websockets
import json
async def subscribe_finalized():
uri = 'wss://api-mythos-archive.n.dwellir.com/YOUR_API_KEY'
async with websockets.connect(uri) as ws:
await ws.send(json.dumps({
'jsonrpc': '2.0',
'method': 'chain_subscribeFinalizedHeads',
'params': [],
'id': 1
}))
response = json.loads(await ws.recv())
sub_id = response['result']
print(f'Subscribed to finalized heads: {sub_id}')
while True:
message = json.loads(await ws.recv())
if 'params' in message:
header = message['params']['result']
block_num = int(header['number'], 16)
print(f"Finalized: #{block_num}")
asyncio.run(subscribe_finalized())Finality Lag
Finalized blocks typically lag behind the best block by a few blocks due to GRANDPA consensus requirements. This is normal and ensures Byzantine fault tolerance.
Related Methods
chain_subscribeNewHeads- Subscribe to all new blocks (not just finalized)chain_getFinalizedHead- Get current finalized block hashgrandpa_roundState- Monitor GRANDPA consensus progress
chain_subscribeNewHeads - Mythos RPC Method
Subscribe to new block headers on Mythos. Real-time notifications for new blocks as they are produced.
state_getStorage - Mythos RPC Method
Query storage values on Mythos. Essential for reading chain state for AAA gaming (FIFA Rivals, NFL Rivals, Pudgy Party), player-owned economies, and bot-resistant matchmaking.