Balance Queries
Thexyz balance command queries account balances including native XYZ and CW20 tokens.
Basic Usage
Query Native Balance
By Address
By Key Name
Query All Balances
Include CW20 token balances with--all:
CW20 balances require tracked tokens in config. Add tokens with:
JSON Output
For scripting and automation:--all:
Command Options
| Flag | Description | Default |
|---|---|---|
--key | Key name from keyring | - |
--all | Include CW20 tokens | false |
--output, -o | Output format (table/json) | table |
--node | RPC endpoint override | config |
Examples
Check Test Account Balance
Check Multiple Accounts
Monitor Balance Changes
Parse Balance in Script
Understanding Amounts
All on-chain amounts are inuxyz (micro XYZ):
| Display | On-Chain (uxyz) |
|---|---|
| 1 XYZ | 1,000,000 |
| 0.5 XYZ | 500,000 |
| 0.000001 XYZ | 1 |
CW20 Token Balances
Setup Tracked Tokens
- Get token contract addresses
- Add to configuration:
- Query with
--all:
Query Single Token
For a specific token, use the token commands:Troubleshooting
Account not found
Account not found
The address may not exist on-chain yet (no transactions):Fund the account first or check the address is correct.
Connection refused
Connection refused
Node may not be running:
CW20 balance not showing
CW20 balance not showing
Ensure token is tracked:And use
--all flag:Zero balance
Zero balance
- Check address is correct
- Check you’re on the right network (chain-id)
- For localnet, use test accounts (alice, bob)