current location:Home >> Solana Tutorial >> how to get solana token holder count

how to get solana token holder count

admin Solana Tutorial 1061

There are several methods to get the holder count for a Solana token (SPL token):

1. Using Solana Blockchain Explorers

how to get solana token holder count

Solscan (https://solscan.io/):

  1. Search for your token by name or mint address

  2. On the token page, you'll see the "Holders" count

SolanaFM (https://solana.fm/):

  1. Enter the token mint address

  2. View the "Holders" count on the token dashboard

2. Using Solana RPC Endpoints

You can programmatically fetch holder count using the getTokenLargestAccounts or getProgramAccounts methods:

const { Connection, PublicKey } = require("@solana/web3.js");

const connection = new Connection("https://api.mainnet-beta.solana.com");
const tokenMint = new PublicKey("YOUR_TOKEN_MINT_ADDRESS");

// Method 1: Get largest accounts (may not show all)
async function getHolderCount() {
  const accounts = await connection.getTokenLargestAccounts(tokenMint);
  console.log(`Number of holders: ${accounts.value.length}`);
}

// Method 2: Get all token accounts (more accurate but slower)
async function getFullHolderCount() {
  const accounts = await connection.getProgramAccounts(
    new PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),
    {
      filters: [
        {
          dataSize: 165, // Size of a token account
        },
        {
          memcmp: {
            offset: 0, // Mint address offset
            bytes: tokenMint.toBase58(),
          },
        },
      ],
    }
  );
  console.log(`Number of holders: ${accounts.length}`);
}

3. Using Helius API (Paid Option)

Helius offers enhanced APIs for Solana with holder count endpoints:

const response = await fetch('https://api.helius.xyz/v0/token-holders?mint=YOUR_TOKEN_MINT');
const data = await response.json();
console.log(data.holder_count);

4. Using Dune Analytics

You can create or find existing dashboards on Dune Analytics that track token holder counts over time.

Notes:

  • For new tokens, some methods might not immediately reflect all holders

  • Large holder counts (>10,000) may require pagination or specialized queries

  • Some methods may count empty accounts (balance = 0)

>>>>How to use GTokenTool Solana Token Holder Tool if you don't understand code

If you have any questions or uncertainties, please join the official Telegram group: https://t.me/GToken_EN

GTokenTool

GTokenTool is the most comprehensive one click coin issuance tool, supporting multiple public chains such as TON, SOL, BSC, etc. Function: Create tokensmarket value managementbatch airdropstoken pre-sales IDO、 Lockpledge mining, etc. Provide a visual interface that allows users to quickly create, deploy, and manage their own cryptocurrencies without writing code.

Similar recommendations