OpenInfra.sh is now live - Solana infrastructure, included with every server. LEARN MORE HERE >

OpenInfra.shopeninfra.sh

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

ParameterTypeRequiredDescription
configobjectNoOptional configuration object. See fields below.
config.commitmentstringNoDesired finality level. Accepted values: processed, confirmed, finalized (default).
config.votePubkeystringNoReturn only entries for this vote account address, as a base-58 encoded string.
config.keepUnstakedDelinquentsboolNoKeep delinquent vote accounts even if their activated stake is zero. Defaults to false.
config.delinquentSlotDistanceu64NoNumber 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

ValueDescription
processedReturn 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.
confirmedReturn 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.
finalizedReturn 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.

FieldTypeDescription
currentarrayVote accounts the RPC node classifies as current at the requested commitment.
delinquentarrayVote 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:

FieldTypeDescription
activatedStakeu64Stake, in lamports, delegated to this vote account and active in the current epoch.
commissionu8Commission rate used for rewards payout, expressed as an 8-bit fraction.
epochCreditsarrayRecent history of earned credits for up to five epochs. Each element is [epoch, credits, previousCredits].
epochVoteAccountboolWhether this vote account is staked for the current epoch.
lastVoteu64Most recent slot this vote account voted on. Returns 0 if no votes exist.
nodePubkeystringValidator identity pubkey, as a base-58 encoded string.
rootSlotu64Current root slot for this vote account. Returns 0 if no root slot exists.
votePubkeystringVote account pubkey, as a base-58 encoded string.