Skip to content

This script fetches the balance of a specified Solana token for all addresses listed in a JSON file. It supports checking the native SOL balance as well as SPL token balances.

License

Notifications You must be signed in to change notification settings

Aero25x/solana-bulk-balance-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Join our Telegram GitHub Twitter YouTube

Solana Token Balance Checker

This script fetches the balance of a specified Solana token for all addresses listed in a JSON file. It supports checking the native SOL balance as well as SPL token balances.

Requirements

  • Python 3.6+

Setup

  1. Clone the repository and navigate to the project directory.

  2. Create a .env file with the following content:

    RPC_URL=https://api.mainnet-beta.solana.com
    TOKEN_CONTRACT=B6h248NJkAcBAkaCnji889a26tCiGXGN8cxhEJ4dX391

    Replace the RPC_URL and TOKEN_CONTRACT values with your own. For tracking the native SOL balance, set TOKEN_CONTRACT to 0x0.

  3. Create a solana_wallet.json file with the following content:

    [
      {
        "isConnected": true,
        "address": "DHAzXyqVFqw31qX6Jhvm8o6QPBKy67dAYRjMiVMuG4tm",
        "balance": null,
        "isDisabled": false,
        "type": "SOL",
        "phrase": "-=--=-=-=-",
        "label": null,
        "ens": null,
        "group": ["Personal Group"]
      }
    ]

    You can also generate a sample JSON file using the Makefile:

    make example

Usage

  1. To install dependencies and run the script:

    make all
  2. To install dependencies only:

    make setup
  3. To run the script only:

    make run
  4. To clean up generated Excel files:

    make clean
  5. To create a sample solana_wallet.json file:

    make example
  6. To display help information:

    make help

Tracking Native SOL Token

To track the native SOL balance, set the TOKEN_CONTRACT variable in your .env file to 0x0:

RPC_URL=https://api.mainnet-beta.solana.com
TOKEN_CONTRACT=0x0

This will make the script query the native SOL balance for the given wallet addresses.

Tracking SPL Tokens

To track an SPL token balance, set the TOKEN_CONTRACT variable in your .env file to the mint address of the SPL token:

RPC_URL=https://api.mainnet-beta.solana.com
TOKEN_CONTRACT=B6h248NJkAcBAkaCnji889a26tCiGXGN8cxhEJ4dX391

Replace B6h248NJkAcBAkaCnji889a26tCiGXGN8cxhEJ4dX391 with the mint address of your desired SPL token.

Output

The script will save the wallet balances to an Excel file named solana_<TOKEN_CONTRACT>.xlsx.

Join our Telegram

About

This script fetches the balance of a specified Solana token for all addresses listed in a JSON file. It supports checking the native SOL balance as well as SPL token balances.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published