slotSubscribe
Subscribe to receive notification anytime a slot is processed by the validator
Common use cases
| Monitor blockchain progression in real-time | Track slot updates at the processed commitment level to detect when new blocks are produced. Essential for DeFi applications that need to time transactions or detect epoch boundaries for validator rewards and staking operations. |
| Implement RPC load balancing and validator health monitoring | Monitor multiple RPC endpoints simultaneously to detect the most up-to-date validator nodes and automatically route requests to nodes with the latest slot information. Helps maintain service reliability during network congestion or validator delays. |
| Detect transaction confirmation timing | Use slot progression to estimate when transactions will reach higher commitment levels. Slot notifications provide the foundational timing mechanism for tracking when processed transactions advance to confirmed and finalized states. |
Parameters
No parameters required.
Request
- wscat
- JavaScript
- Python
wscat -c wss://solana-mainnet.api.syndica.io -x '{
"jsonrpc": "2.0",
"id": 1,
"method": "slotSubscribe"
}'
const ws = new WebSocket('wss://solana-mainnet.api.syndica.io');
ws.on('open', function open() {
ws.send(JSON.stringify({
"jsonrpc": "2.0",
"id": 1,
"method": "slotSubscribe"
}));
});
ws.on('message', function incoming(data) {
console.log(data);
});
import websocket
import json
ws = websocket.create_connection('wss://solana-mainnet.api.syndica.io')
ws.send(json.dumps({
"jsonrpc": "2.0",
"id": 1,
"method": "slotSubscribe"
}))
result = ws.recv()
print(result)
ws.close()
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 notification will be an object with the following fields:
parent: <u64>- The parent slotroot: <u64>- The current root slotslot: <u64>- The newly set slot value
Example:
{
"jsonrpc": "2.0",
"method": "slotNotification",
"params": {
"result": {
"parent": 75,
"root": 44,
"slot": 76
},
"subscription": 0
}
}
FAQ and Troubleshooting
Why doesn't slotSubscribe accept a commitment parameter?
slotSubscribe always uses 'processed' commitment level because it reports slots as soon as they are processed by the validator. This is the earliest commitment level and cannot be configured.
What's the difference between parent, root, and slot in the notification?
The 'slot' field is the current slot number, 'parent' is the previous slot, and 'root' is the most recent rooted (finalized) slot. All three are u64 integers representing slot heights.
How frequently will I receive slot notifications?
Notifications arrive approximately every 400-600ms during normal operation, matching Solana's target slot time of ~400ms. Actual timing varies based on network conditions and validator performance.
Should I use slotSubscribe or slotsUpdatesSubscribe?
Use slotSubscribe for simple slot progression monitoring at processed commitment. Use slotsUpdatesSubscribe when you need detailed slot lifecycle events including optimistic confirmations, frozen slots, and dead slot detection.
Related Methods
slotUnsubscribe
Cancels the slot subscription. Always call slotUnsubscribe when monitoring is no longer needed to free server resources and maintain proper WebSocket connection lifecycle.
slotsUpdatesSubscribe
Provides more detailed slot lifecycle events including optimistic confirmations, frozen slots, and dead slots. Use this instead of slotSubscribe when you need visibility into slot state transitions beyond basic progression.
blockSubscribe
Subscribe to block notifications with full transaction and account data. Complements slotSubscribe by providing block content once you've identified slots of interest through slot monitoring.