Table Details
Solana Balances
Thesolana.assets.balances table provides transaction-level SOL and SPL token balances of all Solana accounts. Each row corresponds to a change in the balance of SOL / SPL tokens caused by the transaction.
Note that 0 balance changes are not present in this table.
Why some addresses appear in
transfers but not in balances:
Balance records are extracted at the transaction level from RPC-reported balance changes. If an address’s SOL movements within a transaction are transient (e.g. SOL passed through to fund a token account) and the net balance change is zero, the RPC does not report a balance change — so no row appears in this table.These movements still appear in solana.assets.transfers because transfers capture individual instruction-level activity, including token account funding.Both
sol_balances and spl_token_balances are huge tables. It is advised that you query time ranges and specific addresses- spl_token_balances: about 300 billion rows
- sol_balances: more than 230 billion rows (non-voting transactions alone)
Querying balances
What a row is
- Each row is the balance of one account for one token after a transaction changed it. A transaction that changes several accounts adds one row per account and token.
- SOL and SPL tokens are in the same table. Filter on
token_type:SOLorSPL-TOKEN. - SOL rows have no
token_account, andmintis the wrapped SOL mintSo11111111111111111111111111111111111111112. - SPL token balances belong to a token account.
addressis the owner of that token account, and one wallet can own several token accounts for the same mint. - A balance that drops to zero gets a row with
balance = 0. A transaction that leaves a balance unchanged adds no row. - Block rewards paid to a slot’s leader don’t come from a transaction. Their rows have a null
txn_idandtxn_index, and aunique_idsuch asblock_slot-471327982_reward_index-0.
Order rows and find a balance at a point in time
Several rows can share ablock_timestamp. Order by block_slot, then txn_index. Block rewards are credited after the slot’s transactions, so their null txn_index sorts last within the slot.
To get a wallet’s balance as of a slot, take the latest row per token account at or before that slot. Keep the block_timestamp filter so the query only scans the range you need. The range must include the account’s last change before the slot.
balance across the returned rows to get the wallet’s total for that mint.
Daily and latest balances
- For end-of-day balances, use
solana.assets.balances_daily. See Querying daily balances before you query it. - For each account’s current balance, use
solana.assets.balances_latestinstead of finding the latest row here.
Balances or transfers?
This table gives the balance after each change. It doesn’t say who sent or received the tokens. For flows and counterparties, usesolana.assets.transfers or solana.assets.credit_debit. See Choosing a transfers table.
Sample Query
Generate Daily Balances from tx-level balances data
Generate Daily Balances from tx-level balances data
This query generates daily end-of-day balances from txn-level balances data.Note: the final output will contain all tokens held by the wallet, including undesirable spam tokens.
One approach to counter this would be to filter the output of the query with the desired token mints or balances above a certain USD value.
- Replace the address with the desired wallet address.