subscribe_newHead
Allows clients to subscribe from receiving updates on new block headers.
Example Request and Result for subscribe_newHead method
In this section, we provide an illustrative example of a request made to retrieve details contents using the subscribe_newHead
method. Additionally, we present the resulting response containing information about subscribing to new block headers updates using WS subscription.
Parameters
- none
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!
Allows clients to subscribe from receiving updates on new block headers.
POST
wss://vara-mainnet.blastapi.io/<project-id>
- 200: OK Expand for a detailed response example
{
"jsonrpc": "2.0",
"method": "chain_newHead",
"params": {
"subscription": "wSKybsRsQYlGu3fH",
"result": {
"parentHash": "0x028a7556cc223aa9fa8e54441d5ef663bd457876bba8baca5191b91bd45eb43d",
"number": "0x9b28c9",
"stateRoot": "0xe4c6988ee929944c00f6bb40f71b952607e7aacea05ba55317404c5cadbc30ba",
"extrinsicsRoot": "0x405375c6fac1245917da867bca46f94b22707a6185b92318d112318ae5640e2f",
"digest": {
"logs": [
"0x06424142453402130000002904fa2100000000",
"0x05424142450101848a89b4c95cc94a0283bf5d527a71b777f52d6340a8792da2f6ff9e4c93ae1e48c3fed7486901988c63da2bbd60f3684d7f7855ecd8f3de423d565f5fce6583"
]
}
}
}
}
Curl Request example
wscat -c 'wss://vara-mainnet.blastapi.io/<project-id>'
# wait for connection
messasge:
{
"id": 1,
"jsonrpc": "2.0",
"method": "subscribe_newHead",
"params": []
}