Skip to main content

chain_subscribeAllHeads RPC method

The chain_subscribeAllHeads method allows clients to establish a subscription to receive updates on the latest block headers as they are produced. This continuous stream of data is vital for applications that need real-time information about block additions to the blockchain. The subscription mechanism ensures clients are updated promptly without the need to repeatedly poll the network.

Parameters

subscription string

Manages the subscription to header updates.

Returns

parentHash string

The hash of the parent block header

number string

Current block's numerical position in the chain

stateRoot string

State root hash of the current header

extrinsicsRoot string

The hash of the extrinsic root of the current header

digest object

Contains logs and additional header data

logs array

Array of block header logs

Code Examples

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