Skip to main content

chain_subscribeNewHead RPC method

The chain_subscribeNewHead method is designed to enable clients to receive real-time updates of the latest block headers. This subscription-based approach is key for applications that require immediate information about new blocks added to the blockchain, ensuring timely data delivery without the need for repetitive querying.

Parameters

subscription string

Manages header update subscription.

Returns

parentHash string

Hash of the previous block's header.

number string

Numerical position of the latest block.

stateRoot string

State root hash of the latest header.

extrinsicsRoot string

Root hash of the block's extrinsics.

digest object

Contains additional header details and logs.

logs array

Array of log entries related to the header.

Code Examples

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