Slot, Block, Root, and Vote
blockSubscribe
WebSocket - JSON-RPC
Subscribe to receive notifications anytime a new block is confirmed or finalized.
This is an unstable method that requires the validator to run with --rpc-pubsub-enable-block-subscription.
Parameters
string | objectrequiredFilter - either "all" for all transactions, or an object:
mentionsAccountOrProgram(string) - only return transactions mentioning this public key
objectConfiguration object:
commitment(string) -finalizedorconfirmedencoding(string) -json,jsonParsed,base58,base64transactionDetails(string) -full,accounts,signatures,nonemaxSupportedTransactionVersion(integer)showRewards(boolean)
Request
wscat -c wss://ws.sol.cubestech.online -H "x-api-key: YOUR_API_KEY"
> {"jsonrpc":"2.0","id":1,"method":"blockSubscribe","params":["all"]}{
"jsonrpc": "2.0",
"id": 1,
"method": "blockSubscribe",
"params": ["all"]
}With Filter
wscat -c wss://ws.sol.cubestech.online -H "x-api-key: YOUR_API_KEY"
> {"jsonrpc":"2.0","id":1,"method":"blockSubscribe","params":[{"mentionsAccountOrProgram":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{"commitment":"confirmed","encoding":"base64","transactionDetails":"full","showRewards":true,"maxSupportedTransactionVersion":0}]}{
"jsonrpc": "2.0",
"id": 1,
"method": "blockSubscribe",
"params": [
{
"mentionsAccountOrProgram": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
},
{
"commitment": "confirmed",
"encoding": "base64",
"transactionDetails": "full",
"showRewards": true,
"maxSupportedTransactionVersion": 0
}
]
}Response
{
"jsonrpc": "2.0",
"result": 0,
"id": 1
}blockUnsubscribe
WebSocket - JSON-RPC
Cancel block notifications.
integerrequiredSubscription ID returned by blockSubscribe.
wscat -c wss://ws.sol.cubestech.online -H "x-api-key: YOUR_API_KEY"
> {"jsonrpc":"2.0","id":1,"method":"blockUnsubscribe","params":[0]}{
"jsonrpc": "2.0",
"id": 1,
"method": "blockUnsubscribe",
"params": [0]
}{
"jsonrpc": "2.0",
"result": true,
"id": 1
}voteSubscribe
WebSocket JSON-RPC
Subscribe to vote notifications observed by the validator.
Parameters: None
Request
wscat -c wss://ws.sol.cubestech.online -H "x-api-key: YOUR_API_KEY"
> {"jsonrpc":"2.0","id":"votes","method":"voteSubscribe"}{
"jsonrpc": "2.0",
"id": "votes",
"method": "voteSubscribe"
}The response returns a numeric subscription ID.
Notification
{
"jsonrpc": "2.0",
"method": "voteNotification",
"params": {
"result": {
"hash": "7bZ...",
"slots": [357954001],
"timestamp": 1785206400
},
"subscription": 42
}
}voteUnsubscribe
Pass the subscription ID from voteSubscribe.
{
"jsonrpc": "2.0",
"id": "stop-votes",
"method": "voteUnsubscribe",
"params": [42]
}rootSubscribe
WebSocket - JSON-RPC
Subscribe to receive notifications anytime a new root is set by the validator.
Parameters: None
Request
wscat -c wss://ws.sol.cubestech.online -H "x-api-key: YOUR_API_KEY"
> {"jsonrpc":"2.0","id":1,"method":"rootSubscribe"}{
"jsonrpc": "2.0",
"id": 1,
"method": "rootSubscribe"
}Response
{
"jsonrpc": "2.0",
"result": 0,
"id": 1
}Notification Format
Notifications contain the latest root slot number as an integer.
rootUnsubscribe
WebSocket - JSON-RPC
Cancel root notifications.
integerrequiredSubscription ID returned by rootSubscribe.
wscat -c wss://ws.sol.cubestech.online -H "x-api-key: YOUR_API_KEY"
> {"jsonrpc":"2.0","id":1,"method":"rootUnsubscribe","params":[0]}{
"jsonrpc": "2.0",
"id": 1,
"method": "rootUnsubscribe",
"params": [0]
}{
"jsonrpc": "2.0",
"result": true,
"id": 1
}slotSubscribe
WebSocket - JSON-RPC
Subscribe to receive notifications whenever a slot is processed by the validator.
Parameters: None
Request
wscat -c wss://ws.sol.cubestech.online -H "x-api-key: YOUR_API_KEY"
> {"jsonrpc":"2.0","id":1,"method":"slotSubscribe"}{
"jsonrpc": "2.0",
"id": 1,
"method": "slotSubscribe"
}Response
{
"jsonrpc": "2.0",
"result": 0,
"id": 1
}Notification Format
resultobjectproperties
parentintegerrootintegerslotintegerslotUnsubscribe
WebSocket - JSON-RPC
Cancel slot notifications.
integerrequiredSubscription ID returned by slotSubscribe.
wscat -c wss://ws.sol.cubestech.online -H "x-api-key: YOUR_API_KEY"
> {"jsonrpc":"2.0","id":1,"method":"slotUnsubscribe","params":[0]}{
"jsonrpc": "2.0",
"id": 1,
"method": "slotUnsubscribe",
"params": [0]
}{
"jsonrpc": "2.0",
"result": true,
"id": 1
}slotsUpdatesSubscribe
WebSocket - JSON-RPC
Subscribe to receive notifications from the validator on a variety of updates on every slot.
This is an unstable method. The response format may change in future releases.
Parameters: None
Request
wscat -c wss://ws.sol.cubestech.online -H "x-api-key: YOUR_API_KEY"
> {"jsonrpc":"2.0","id":1,"method":"slotsUpdatesSubscribe"}{
"jsonrpc": "2.0",
"id": 1,
"method": "slotsUpdatesSubscribe"
}Response
{
"jsonrpc": "2.0",
"result": 0,
"id": 1
}Notification Format
resultobjectproperties
slotintegertimestampintegererrstring | nulltypestringUpdate type - one of:
firstShredReceived- first shred of a new slot receivedcompleted- slot completed receiving all shredscreatedBank- bank created for slotfrozen- slot frozendead- slot is deadoptimisticConfirmation- optimistically confirmedroot- slot rooted
slotsUpdatesUnsubscribe
WebSocket - JSON-RPC
Cancel slot-update notifications.
integerrequiredSubscription ID returned by slotsUpdatesSubscribe.
wscat -c wss://ws.sol.cubestech.online -H "x-api-key: YOUR_API_KEY"
> {"jsonrpc":"2.0","id":1,"method":"slotsUpdatesUnsubscribe","params":[0]}{
"jsonrpc": "2.0",
"id": 1,
"method": "slotsUpdatesUnsubscribe",
"params": [0]
}{
"jsonrpc": "2.0",
"result": true,
"id": 1
}