Skip to main content

rootSubscribe

Subscribe to receive notification anytime a new root is set by the validator.

Common use cases
Finalization lag monitoringTrack the delay between current slot and finalized root to measure network finalization health. Subscribe to both slotSubscribe and rootSubscribe, then calculate the difference to identify finalization bottlenecks.
Safe state confirmationDetermine when blockchain state becomes immutable for critical operations like large financial transfers or irreversible state changes. Wait for relevant slots to become rooted before proceeding with dependent actions.

Parameters

No parameters required.

Request

wscat -c wss://solana-mainnet.api.syndica.io -x '{
"jsonrpc": "2.0",
"id": 1,
"method": "rootSubscribe"
}'
Network Selection

Replace mainnet with devnet in the URL to query devnet instead.

Response

{
"jsonrpc": "2.0",
"result": 0,
"id": 1
}

Response Fields

Return value: integer

subscription id (needed to unsubscribe)

Notification Format

The result is the latest root slot number.

{
"jsonrpc": "2.0",
"method": "rootNotification",
"params": {
"result": 42,
"subscription": 0
}
}

FAQ and Troubleshooting

What's the difference between root and confirmed slots?

Root slots are finalized and cannot be rolled back, while confirmed slots may still be part of a fork that gets abandoned. Use rootSubscribe when you need guaranteed immutability.

How often do root notifications arrive?

Root slots advance as the validator's supermajority votes finalize slots, typically trailing current slot by 31+ slots. Frequency depends on network voting patterns and validator participation.

Does rootSubscribe take any parameters?

No. rootSubscribe accepts no parameters and subscribes to all root updates from the connected validator.

rootUnsubscribe
Cancels root subscription. Always call when subscription no longer needed to free resources; paired subscribe/unsubscribe pattern required for proper WebSocket lifecycle management.

slotSubscribe
Subscribes to all slot progression updates. Use together with rootSubscribe to calculate finalization lag by comparing current slot with most recent root; complementary for monitoring blockchain health.

External Resources