voteSubscribe
Subscribe to receive notification anytime a new vote is observed in gossip. These votes are pre-consensus therefore there is no guarantee these votes will enter the ledger.
Common use cases
| Validator behavior analysis | Monitor gossip vote activity to analyze validator voting patterns and detect anomalies in consensus participation. Requires validator started with --rpc-pubsub-enable-vote-subscription flag. |
| Consensus mechanism research | Observe pre-consensus votes for research into Solana's Tower BFT consensus algorithm. Votes received are not guaranteed to enter the ledger. |
Parameters
No parameters required.
Request
- wscat
- JavaScript
- Python
wscat -c wss://solana-mainnet.api.syndica.io -x '{
"jsonrpc": "2.0",
"id": 1,
"method": "voteSubscribe"
}'
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": "voteSubscribe"
}));
});
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": "voteSubscribe"
}))
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:
hash: <string>- The vote hashslots: <array>- The slots covered by the vote, as an array of u64 integerstimestamp: <i64|null>- The timestamp of the votesignature: <string>- The signature of the transaction that contained this votevotePubkey: <string>- The public key of the vote account, as base-58 encoded string
{
"jsonrpc": "2.0",
"method": "voteNotification",
"params": {
"result": {
"hash": "8Rshv2oMkPu5E4opXTRyuyBeZBqQ4S477VG26wUTFxUM",
"slots": [1, 2],
"timestamp": null
},
"subscription": 0
}
}
FAQ and Troubleshooting
Why do I get "Method not found" errors?
This method requires the validator to start with --rpc-pubsub-enable-vote-subscription flag. Most RPC providers don't enable this unstable method.
Can I use this for production vote monitoring?
No. This is an unstable method that may change format. Votes are pre-consensus and may never reach the ledger. Use for research only.
What's the difference between gossip votes and confirmed votes?
Gossip votes are observed before consensus (pre-confirmation). They represent validator intentions but aren't guaranteed to be included in the blockchain.
Related Methods
voteUnsubscribe
Cancels vote subscription. Always paired with voteSubscribe; both are unstable methods requiring same validator flag for proper vote monitoring lifecycle.
slotSubscribe
Subscribe to processed slot updates. More stable alternative for monitoring blockchain progression; use when pre-consensus vote data isn't required.