getVoteAccounts
Returns vote accounts visible at the requested commitment, partitioned into current and delinquent.
Request
Send a JSON-RPC 2.0 POST request with method: "getVoteAccounts". The params array accepts an optional configuration object.
curl · JSON-RPCjson
{ "jsonrpc": "2.0", "id": 1, "method": "getVoteAccounts", "params": [ { "commitment": "finalized", "votePubkey": "i7NyKBMJCA9bLM2nsGyAGCKHECuR2L5eh4GqFciuwNT" } ]}@solana/kit
kit.tsts
import { address, createSolanaRpc } from "@solana/kit"; const rpc_url = "https://rpc.openinfra.sh";const rpc = createSolanaRpc(rpc_url); let votePubkey = address("5ZWgXcyqrrNpQHCme5SdC5hCeYb2o3fEJhF7Gok3bTVN"); let voteAccounts = await rpc .getVoteAccounts({ votePubkey }) .send(); console.log(voteAccounts);@solana/web3.js
web3.tsts
import { Connection, clusterApiUrl } from "@solana/web3.js"; const connection = new Connection("https://rpc.openinfra.sh", "confirmed"); let voteAccounts = await connection.getVoteAccounts(); console.log(voteAccounts);Rust
main.rsrs
use anyhow::Result;use solana_client::{nonblocking::rpc_client::RpcClient, rpc_config::RpcGetVoteAccountsConfig};use solana_commitment_config::CommitmentConfig; #[tokio::main]async fn main() -> Result<()> { let client = RpcClient::new_with_commitment( String::from("https://rpc.openinfra.sh"), CommitmentConfig::confirmed(), ); let vote_pubkey = String::from("5ZWgXcyqrrNpQHCme5SdC5hCeYb2o3fEJhF7Gok3bTVN"); let config = RpcGetVoteAccountsConfig { vote_pubkey: Some(vote_pubkey), commitment: CommitmentConfig::finalized().into(), keep_unstaked_delinquents: None, delinquent_slot_distance: None, }; let vote_accounts = client.get_vote_accounts_with_config(config).await?; println!("{:#?}", vote_accounts); Ok(())}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| config | object | No | Optional configuration object. See fields below. |
| config.commitment | string | No | Desired finality level. Accepted values: processed, confirmed, finalized (default). |
| config.votePubkey | string | No | Return only entries for this vote account address, as a base-58 encoded string. |
| config.keepUnstakedDelinquents | bool | No | Keep delinquent vote accounts even if their activated stake is zero. Defaults to false. |
| config.delinquentSlotDistance | u64 | No | Number of slots a validator may trail the selected slot before being classified as delinquent. Defaults to 128. Ecosystem tools typically leave this unset to preserve consistent behavior. |
commitment values
| Value | Description |
|---|---|
| processed | Return data from the highest slot this node has processed on the fork it currently considers best. This is the newest view, but it can still change if the cluster switches forks. |
| confirmed | Return data from the highest slot that at least two-thirds of active stake has directly voted to confirm. More stable than processed, but a weaker guarantee than finalized. |
| finalized | Return data from the highest slot that the cluster recognizes as finalized. The slot has reached maximum vote lockout in validators' vote towers and is recognized by at least two-thirds of active stake. This is the strongest commitment level. |
keepUnstakedDelinquents example
{ "keepUnstakedDelinquents": true }delinquentSlotDistance example
{ "delinquentSlotDistance": 256 }Response
response.jsonjson
{ "jsonrpc": "2.0", "result": { "current": [ { "activatedStake": 38263229364446900, "commission": 95, "epochCredits": [ [902, 1383125544, 1376213656], [903, 1390037304, 1383125544], [904, 1396949288, 1390037304], [905, 1403861272, 1396949288], [906, 1406766600, 1403861272] ], "epochVoteAccount": true, "lastVote": 391573587, "nodePubkey": "dv2eQHeP4RFrJZ6UeiZWoc3XTtmtZCUKxxCApCDcRNV", "rootSlot": 391573556, "votePubkey": "i7NyKBMJCA9bLM2nsGyAGCKHECuR2L5eh4GqFciuwNT" } ], "delinquent": [] }, "id": 1}The result is an object with two keys: current and delinquent. Each is an array of vote-account records classified by the node at the requested commitment.
| Field | Type | Description |
|---|---|---|
| current | array | Vote accounts the RPC node classifies as current at the requested commitment. |
| delinquent | array | Vote accounts the RPC node classifies as delinquent at the requested commitment. |
Vote account record fields
Each element of current and delinquent is a vote-account object with the following fields:
| Field | Type | Description |
|---|---|---|
| activatedStake | u64 | Stake, in lamports, delegated to this vote account and active in the current epoch. |
| commission | u8 | Commission rate used for rewards payout, expressed as an 8-bit fraction. |
| epochCredits | array | Recent history of earned credits for up to five epochs. Each element is [epoch, credits, previousCredits]. |
| epochVoteAccount | bool | Whether this vote account is staked for the current epoch. |
| lastVote | u64 | Most recent slot this vote account voted on. Returns 0 if no votes exist. |
| nodePubkey | string | Validator identity pubkey, as a base-58 encoded string. |
| rootSlot | u64 | Current root slot for this vote account. Returns 0 if no root slot exists. |
| votePubkey | string | Vote account pubkey, as a base-58 encoded string. |