Why a Solana wallet's token balance is missing
Last updated:
At a glance
| Property | Value |
|---|---|
| getBalance returns | The account's own balance in lamports (SOL only) |
| Where token balances live | Token accounts whose owner field is the wallet |
| Token account layout | Mint at offset 0, owner at offset 32 |
| ATA address derived from | Wallet address, token program ID and mint |
| getTokenAccountsByOwner filter | Either mint or programId |
What you see
A wallet clearly holds tokens in a wallet app or explorer, but getBalance returns only a small SOL amount and getAccountInfo on the wallet shows no token data. A token lookup for one program returns nothing for tokens that belong to the other.
Why this happens
Solana's getBalance returns the account's balance "in lamports" — native SOL only. SPL tokens are held in token accounts: each one records a mint (at offset 0) and an owner (at offset 32), and the wallet is that owner. The associated token account for a wallet and a mint sits at an address deterministically derived from the wallet address, the token program ID and the mint, so the same wallet and mint map to different associated accounts under the classic Token program and Token-2022, which is "deployed to a different address than the Token program". getTokenAccountsByOwner takes the owner plus a filter with either a mint or a programId — "the Token program that owns the accounts" — so a query for one program will not return accounts owned by the other.
What to do
- Use getTokenAccountsByOwner for the wallet, once with the classic Token program's ID and once with Token-2022's, or with the mint when you already know it.
- Read the token amount from the token account, not from the wallet's getBalance.
- When you compute an associated token account address yourself, use the token program that actually issued the mint.
When this is not our problem
The account model and the split between the two token programs are defined by Solana and its token programs, the same on every node, whoever operates it, Triport included. Only the query decides which token accounts come back.
FAQ
- Why doesn't getBalance show my SPL tokens?
- getBalance returns only lamports (SOL). Token balances are held in token accounts owned by the wallet; list them with getTokenAccountsByOwner.
- Why are Token-2022 tokens missing from my token account query?
- Token-2022 is a separate program at a different address. Query with its program ID, or by mint.