getTokenLargestAccounts

Learn getTokenLargestAccounts use cases, code examples, request parameters, response structure, and tips.

The getTokenLargestAccounts RPC method in CoinVera returns the top 20 largest SPL token accounts for a given token mint. It’s primarily used to analyze token distribution, identify major holders, and power top-holder dashboards.


βœ… Common Use Cases

  • Token Distribution Analysis Understand how a token’s supply is distributed across wallets.

  • Identifying Whales Spot addresses holding large portions of a token supply.

  • Market Research & Risk Assessment Measure decentralization or the potential influence of top holders.

  • Explorer & Dashboard Integration Display the top token holders in user interfaces.


🧾 Request Parameters

[
  mintAddress: string,         // Required – base-58 address of the SPL token mint
  options?: {
    commitment?: string        // Optional – "processed", "confirmed", or "finalized"
  }
]
  • mintAddress: The SPL token mint for which to retrieve largest token accounts.

  • commitment: Optional commitment level to specify the network state snapshot.


πŸ“¦ Response Structure

The result is an array of up to 20 token account objects:

{
  "context": {
    "slot": 221446650
  },
  "value": [
    {
      "address": "AccountPubkeyHere",
      "amount": "500000000000",
      "decimals": 6,
      "uiAmount": 500000.0,
      "uiAmountString": "500000"
    },
    ...
  ]
}

Each entry includes:

  • address: Base-58 public key of the token account.

  • amount: Raw token balance (as a string).

  • decimals: Token mint’s decimal precision.

  • uiAmount: Balance as a float (optional, may be deprecated).

  • uiAmountString: Balance as a string (preferred for display).


πŸ§ͺ Example

Fetch Top 20 Largest Accounts for a Token

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getTokenLargestAccounts",
  "params": [
    "So11111111111111111111111111111111111111112"
  ]
}

Code Examples

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

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

    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';

getTokenLargestAccounts(RPC_URL);

Example Response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "context": {
      "slot": 355408555,
      "apiVersion": "2.2.7"
    },
    "value": [
      {
        "address": "DdDiTstikLPchipWjSQ9ZgJdE2wq99W2qjdGcJtSqJXc",
        "uiAmount": 999822991.855856,
        "decimals": 6,
        "amount": "999822991855856",
        "uiAmountString": "999822991.855856"
      },
      {
        "address": "AUSZfegoc2ZhkcMpU9PMcWpg7jLid1Vgp2yfxeEhXs23",
        "uiAmount": 177007.043244,
        "decimals": 6,
        "amount": "177007043244",
        "uiAmountString": "177007.043244"
      },
      {
        "address": "Fo8hU9VAMgQEXjJ3JxfJyrTh4PXkpqMW5eXxv3vPYZ2S",
        "uiAmount": 0.304141,
        "decimals": 6,
        "amount": "304141",
        "uiAmountString": "0.304141"
      },
      {
        "address": "HeTAA5GzNpa8Z1UFpk9sqZurHPJ6gpZuPCfoJHfcAfMG",
        "uiAmount": 0,
        "decimals": 6,
        "amount": "0",
        "uiAmountString": "0"
      },
      {
        "address": "B8TeUywdwHNGb6p9voiWcJSMYQ2eQB7ZszzLqhoNksbK",
        "uiAmount": 0,
        "decimals": 6,
        "amount": "0",
        "uiAmountString": "0"
      },
      {
        "address": "9XBsFrMwjMnXJE1sKM1waRtuULApmazNWFfZfPgWm9Qz",
        "uiAmount": 0,
        "decimals": 6,
        "amount": "0",
        "uiAmountString": "0"
      },
      {
        "address": "6qoLLeaYXr6x6bP2VbGPB9Y5kNmQ6MY2p7L6yiFUXhBJ",
        "uiAmount": 0,
        "decimals": 6,
        "amount": "0",
        "uiAmountString": "0"
      }
    ]
  }
}

πŸ’‘ Developer Tips

  • Fixed Result Size Always returns up to 20 largest accountsβ€”no support for pagination.

  • Token-Specific Query Only shows holders for the mint you provide. Use a valid SPL token mint.

  • uiAmountString Is Recommended It’s safer and more consistent for displaying token balances than uiAmount.

  • Avoid Excessive Polling While efficient, repeated queries in short intervals may add unnecessary load.

  • Commitment Level Matters Use finalized for the most stable snapshot of top token holders.


The getTokenLargestAccounts method is a simple yet powerful way to understand SPL token distribution and visualize key holders within the Solana ecosystem. It's ideal for dashboards, analytics tools, and smart contract tooling built on CoinVera.

Last updated