# getVoteAccounts

The `getVoteAccounts` RPC method in **CoinVera** returns detailed information about **all validator vote accounts** currently known to the network. It separates **active (current)** validators from **delinquent** ones and provides insights into their identity, stake, commission, voting performance, and more.

***

#### ✅ Common Use Cases

* **Validator Monitoring**\
  Track validator voting status, commission rates, and recent activity.
* **Staking Dashboards**\
  Display available validators for delegators, including performance metrics and stake data.
* **Network Health Analysis**\
  Assess decentralization and performance by examining stake distribution and active participation.
* **Identifying Delinquent Validators**\
  Detect validators that have fallen behind or are not actively voting in consensus.

***

#### 🧾 Request Parameters

```ts
[
  options?: {
    commitment?: string,                 // Optional – "processed", "confirmed", or "finalized"
    votePubkey?: string,                 // Optional – Filter by a specific validator vote account
    keepUnstakedDelinquents?: boolean,   // Optional – Include unstaked delinquent validators
    delinquentSlotDistance?: number      // Optional – Slots behind tip to consider as delinquent
  }
]
```

* **commitment** *(optional)*:\
  The desired commitment level for the returned data. Defaults to the node’s configuration.
* **votePubkey** *(optional)*:\
  Filter results to a specific vote account (base-58 public key).
* **keepUnstakedDelinquents** *(optional)*:\
  Include delinquent validators with **zero** active stake. Defaults to `false`.
* **delinquentSlotDistance** *(optional)*:\
  Specify how many slots a validator must fall behind the ledger tip to be marked delinquent.

***

#### 📦 Response Structure

The response contains two arrays:

**`current`: List of active vote accounts**

**`delinquent`: List of delinquent vote accounts**

Each object includes:

```json
{
  "votePubkey": "VoteAccountAddress",
  "nodePubkey": "ValidatorIdentityPubkey",
  "activatedStake": 543210000000,
  "epochVoteAccount": true,
  "commission": 8,
  "lastVote": 221446590,
  "rootSlot": 221446500,
  "epochCredits": [
    [378, 144, 20094],
    [379, 150, 20244]
  ]
}
```

**Key fields:**

* **votePubkey**: Public key of the vote account.
* **nodePubkey**: Validator’s identity (node) key.
* **activatedStake**: Currently active delegated stake in lamports.
* **commission**: Validator fee charged (percentage from 0–100).
* **lastVote**: Last slot this validator voted on.
* **rootSlot**: Last fully confirmed slot recognized by this validator.
* **epochVoteAccount**: `true` if active this epoch.
* **epochCredits**: List of `[epoch, earned_credits, previous_total]`.

***

#### 🧪 Example

**Fetch All Validator Vote Accounts**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getVoteAccounts",
  "params": [
    {
      "commitment": "finalized",
      "keepUnstakedDelinquents": true
    }
  ]
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getVoteAccounts(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getVoteAccounts',
        "params": [
            {
              "commitment": "confirmed",
              "keepUnstakedDelinquents": true
            }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getVoteAccounts(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_vote_accounts(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getVoteAccounts',
                'params': [
                    {
                        'commitment': 'confirmed',
                        'keepUnstakedDelinquents': True
                    }
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_vote_accounts(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "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
}
```

***

#### 💡 Developer Tips

* **Large Data Size**\
  Expect large responses on Mainnet Beta. Use pagination or lazy loading in UIs.
* **Delinquency Is Node-Relative**\
  The `delinquentSlotDistance` setting and local node state determine who appears delinquent—results may differ across nodes.
* **Stake Activation Delays**\
  Stake transitions take several epochs. `activatedStake` only includes stake that is currently active.
* **Use `epochCredits` to Measure Voting Performance**\
  High credit gains indicate reliable voting behavior.

***

The `getVoteAccounts` method is a foundational tool for validator monitoring, staking interfaces, and network observability in Solana applications powered by **CoinVera**.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.coinvera.io/integration/solana/rpc/getvoteaccounts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
