I created a transaction that submits 2 ADA to stake address. How do I check the balance of stake address? This usual command fails to get the output.
cardano-cli query utxo
–address $(cat payment.addr)
–mainnet
What output is returned when the command is ran? Also if you run “cat payment.addr” in your CLI, do you see your address printed out?
Also, it could just be the forum formatting the command poorly, but the “dashes” before “address” and “mainnet” don’t appear to be double-dashes, it looks like it’s some kind of elongated single-dash… might be another thing to look at… all in all, it should be:
cardano-cli query utxo
--address $(cat payment.addr)
--mainnet
Hi - I validated the address and its accurate. Also dashes are double and its forum formatting issue. I think regular addresses are different than staking addresses. Is there a specific way to check balance of staking address?
A staking address doubles as a pool-reward address and also encapsulates your parment address that was used building your stake pool. For querying the rewards of your stake pool, you would run:
cardano-cli query stake-address-info \
--address $(cat stake.addr) \
--mainnet
This will show you your “rewardAccountBalance” in the returned json of the query.
But this is only your “rewards”, not the live stake that is present in your payment address. The payment address query that you have should work in fetching the utxos of the address.
CoinCashew has a very nice all-in-one command for fetching the amount of ADA in your address:
cardano-cli query utxo \
--address $(cat payment.addr) \
--mainnet > fullUtxo.out
tail -n +3 fullUtxo.out | sort -k3 -nr > balance.out
cat balance.out
tx_in=""
total_balance=0
while read -r utxo; do
in_addr=$(awk '{ print $1 }' <<< "${utxo}")
idx=$(awk '{ print $2 }' <<< "${utxo}")
utxo_balance=$(awk '{ print $3 }' <<< "${utxo}")
total_balance=$((${total_balance}+${utxo_balance}))
echo TxHash: ${in_addr}#${idx}
echo ADA: ${utxo_balance}
tx_in="${tx_in} --tx-in ${in_addr}#${idx}"
done < balance.out
txcnt=$(cat balance.out | wc -l)
echo Total ADA balance: ${total_balance}
echo Number of UTXOs: ${txcnt}
Also - make sure your nodes are 100% synced to the blockchain - if you’re querying the address and you aren’t caught up, then the address query will not work and it could be the cause of your problems.