Skip to main content

chain_subscribeFinalisedHeads

Retrieves the best finalized header via subscription

The most recent completed block headers can be tracked in real time with the help of the chain_subscribeFinalisedHeads function. It creates a subscription that delivers the header information of the most recent blocks that have been finalized on a regular basis. Clients who require the most recent blockchain information without continuous polling may find this especially helpful.

info

Same results for method chain_subscribeFinalizedHeads!

Example Request and Result for chain_subscribeFinalisedHeads method

In this section, we provide an illustrative example of a request made to retrieve details contents using the chain_subscribeFinalisedHeads method. Additionally, we present the resulting response containing information about getting the best finalised header using WS subscription.

Parameters

FieldsTypeDescription
subscriptionstringManages header update subscription.
info

The example in this section uses a non-existing project id.

Make sure you replace it with your Vara Mainnet endpoint when issuing the API calls.

Don't have a project id? Here's a straightforward guide on how to obtain one!

Retrieves the best finalised header via subscription

POST wss://vara-mainnet.blastapi.io/<project-id>

Request Body

NameTypeDescription
subscriptionstring[]
{
"jsonrpc": "2.0",
"method": "chain_finalizedHead",
"params": {
"subscription": "ADzDUxSGHfHjOmV8",
"result": {
"parentHash": "0xd5264b5847c8684d07995a2738352cc612213d533679951507d3d6fafbb42369",
"number": "0x99c60a",
"stateRoot": "0x84ed19f2da6442f66c553c71d9c6d5f913c4c6b4814b975e9d39acc79ac88918",
"extrinsicsRoot": "0x238409ab3461eb6b2064a0139a8b32cc337d3fb84b5cc2db7285a12090596125",
"digest": {
"logs": [
"0x064241424534022600000060a1f82100000000",
"0x0542414245010120f47118f1d04bd0da0bf4dacfe01e2902f931290bad3645b71ba51f61581a58fdb220fcd52c69b8af552b8710fb94c04bb2bad89fa76ea7ebdd00a66c47bb87"
]
}
}
}
}

Curl Request example

wscat -c 'wss://vara-mainnet.blastapi.io/<project-id>'
# wait for connection
messasge:
{
"id": 1,
"jsonrpc": "2.0",
"method": "chain_subscribeFinalisedHeads",
"params": []
}