0

Is there a command to output my wallet balance and unlocked balance from my main monero address using the command line Monero wallet? And what if I wanted to get the balance of my subaddresses?

I want to get it without interaction as this would be used in a script, which means the wallets won't have a password or a simple password if it's mandatory.

2

Yes. Using monero-wallet-cli you can run the command balance detail, which will show you your wallets balance and each balance received at each subaddress.

Typically for non-interactive usage you'd use monero-wallet-rpc, for which there is an equivalent method get_balance, which gives you result in something more machine readable (e.g. JSON).

You can also use the monero-wallet-cli non-interactively like:

monero-wallet-cli --testnet --wallet-file testnet-wallet --password 'yourpassword' balance detail
| improve this answer | |
  • is there a way to output the data in a json format? – Patoshi パトシ Dec 10 '19 at 23:57
  • also where can i find all the options for the cli and rpc commands like balance detail? – Patoshi パトシ Dec 10 '19 at 23:59
  • actually I just did the command you mentioned on a new wallet i created and funded it with some coins. the balance doesn't update until I do a "refresh", but it hits me with a password prompt, which isn't going to work for me. Is there a way to get an updated balance when passing in the balance detail or even show_transfers in command? – Patoshi パトシ Dec 11 '19 at 0:16
  • "is there a way to output the data in a json format?" <- for that, use the monero-wallet-rpc – jtgrassie Dec 11 '19 at 5:46
  • "also where can i find all the options for the cli and rpc commands like balance detail?" <- type help – jtgrassie Dec 11 '19 at 5:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.