Skip to main content
added 348 characters in body
Source Link
AMilz
  • 1.9k
  • 3
  • 11

I'd imagine you could do a shell script like this to iterate over different wallets in a file, list.txt:

list.txt:

WALLET_ID_1
WALLET_ID_2
WALLET_ID_3

balances.sh:

output_file="balances.txt"

while read line; do
    balance=$(solana balance "$line")
    echo "$line: $balance" >> "$output_file"
done < list.txt

This should output a file, balances.txt that looks something like this:

WALLET_ID_1: 1.181062312 SOL
WALLET_ID_2: 2.046516532 SOL
WALLET_ID_3: 3.84642558 SOL

if you wanted to do this from private keys saved on your machine (as opposed to public keys, you'd modify your list to include file paths to each private key (or have your shell script loop through files in a folder). and add -k to your solana balance query, eg:

balance=$(solana balance -k "$path")

something like:

output_file="balances.txt"
directory="/keys/"

for file in in "$directory"/*.json; do
    # Extract public key from private key
    key=$(solana address -k "$file")

    # Get balance from private key
    balance=$(solana balance -k "$file")
    echo "$key: $balance" >> "$output_file"
done

I'd imagine you could do a shell script like this to iterate over different wallets in a file, list.txt:

list.txt:

WALLET_ID_1
WALLET_ID_2
WALLET_ID_3

balances.sh:

output_file="balances.txt"

while read line; do
    balance=$(solana balance "$line")
    echo "$line: $balance" >> "$output_file"
done < list.txt

This should output a file, balances.txt that looks something like this:

WALLET_ID_1: 1.181062312 SOL
WALLET_ID_2: 2.046516532 SOL
WALLET_ID_3: 3.84642558 SOL

if you wanted to do this from private keys saved on your machine (as opposed to public keys, you'd modify your list to include file paths to each private key (or have your shell script loop through files in a folder). and add -k to your solana balance query, eg:

balance=$(solana balance -k "$path")

I'd imagine you could do a shell script like this to iterate over different wallets in a file, list.txt:

list.txt:

WALLET_ID_1
WALLET_ID_2
WALLET_ID_3

balances.sh:

output_file="balances.txt"

while read line; do
    balance=$(solana balance "$line")
    echo "$line: $balance" >> "$output_file"
done < list.txt

This should output a file, balances.txt that looks something like this:

WALLET_ID_1: 1.181062312 SOL
WALLET_ID_2: 2.046516532 SOL
WALLET_ID_3: 3.84642558 SOL

if you wanted to do this from private keys saved on your machine (as opposed to public keys, you'd modify your list to include file paths to each private key (or have your shell script loop through files in a folder). and add -k to your solana balance query, eg:

balance=$(solana balance -k "$path")

something like:

output_file="balances.txt"
directory="/keys/"

for file in in "$directory"/*.json; do
    # Extract public key from private key
    key=$(solana address -k "$file")

    # Get balance from private key
    balance=$(solana balance -k "$file")
    echo "$key: $balance" >> "$output_file"
done
added 312 characters in body
Source Link
AMilz
  • 1.9k
  • 3
  • 11

I'd imagine you could do a shell script like this to iterate over different wallets in a file, list.txt:

list.txt:

WALLET_ID_1
WALLET_ID_2
WALLET_ID_3

balances.sh:

output_file="balances.txt"

while read line; do
    balance=$(solana balance "$line")
    echo "$line: $balance" >> "$output_file"
done < list.txt

This should output a file, balances.txt that looks something like this:

WALLET_ID_1: 1.181062312 SOL
WALLET_ID_2: 2.046516532 SOL
WALLET_ID_3: 3.84642558 SOL

if you wanted to do this from private keys saved on your machine (as opposed to public keys, you'd modify your list to include file paths to each private key (or have your shell script loop through files in a folder). and add -k to your solana balance query, eg:

balance=$(solana balance -k "$path")

I'd imagine you could do a shell script like this to iterate over different wallets in a file, list.txt:

list.txt:

WALLET_ID_1
WALLET_ID_2
WALLET_ID_3

balances.sh:

output_file="balances.txt"

while read line; do
    balance=$(solana balance "$line")
    echo "$line: $balance" >> "$output_file"
done < list.txt

This should output a file, balances.txt that looks something like this:

WALLET_ID_1: 1.181062312 SOL
WALLET_ID_2: 2.046516532 SOL
WALLET_ID_3: 3.84642558 SOL

I'd imagine you could do a shell script like this to iterate over different wallets in a file, list.txt:

list.txt:

WALLET_ID_1
WALLET_ID_2
WALLET_ID_3

balances.sh:

output_file="balances.txt"

while read line; do
    balance=$(solana balance "$line")
    echo "$line: $balance" >> "$output_file"
done < list.txt

This should output a file, balances.txt that looks something like this:

WALLET_ID_1: 1.181062312 SOL
WALLET_ID_2: 2.046516532 SOL
WALLET_ID_3: 3.84642558 SOL

if you wanted to do this from private keys saved on your machine (as opposed to public keys, you'd modify your list to include file paths to each private key (or have your shell script loop through files in a folder). and add -k to your solana balance query, eg:

balance=$(solana balance -k "$path")

Source Link
AMilz
  • 1.9k
  • 3
  • 11

I'd imagine you could do a shell script like this to iterate over different wallets in a file, list.txt:

list.txt:

WALLET_ID_1
WALLET_ID_2
WALLET_ID_3

balances.sh:

output_file="balances.txt"

while read line; do
    balance=$(solana balance "$line")
    echo "$line: $balance" >> "$output_file"
done < list.txt

This should output a file, balances.txt that looks something like this:

WALLET_ID_1: 1.181062312 SOL
WALLET_ID_2: 2.046516532 SOL
WALLET_ID_3: 3.84642558 SOL