Skip to main content

chain_subscribeNewHeads RPC method

The chain_subscribeNewHeads RPC method is instrumental for clients needing continuous updates of the most significant or 'best' block headers as they are appended to the blockchain. This subscription-based approach provides timely header data, crucial for applications requiring the latest blockchain information without repetitive manual queries.

Parameters

subscription string

Enables subscription management for header updates.

Returns

parentHash string

Hash of the preceding block's header.

number string

The number of the best header's block.

stateRoot string

State root hash for the best header.

extrinsicsRoot string

Root hash for the extrinsics in the best header.

digest object

Contains additional details and logs for the best header.

logs array

Log entries associated with the best header.

Code Examples

wscat -c wss://api-polkadot.dwellir.com/<API-KEY> \
# wait for connection
{"id":1,"jsonrpc":"2.0","method":"chain_subscribeNewHeads","params":[]}