4

The current rpc interface only allows you to see either 1. The balance of the entire wallet 2. How much was received by an address (which is okay... if you never spend)

Basically, I want to know how to get the balance of a specific address in my wallet. I've searched high and low and cannot find anything.

4 Answers4

3

If you are only using Bitcoin through RPC commands, you might want to look into accounts. Using those you can just call getbalance and you will know how much Bitcoins are in each of the accounts.

If you are using only addresses, you can only see how many Bitcoins you received with it through listreceivedbyaddress, which can be not reliable if you spend any money from them.

All in all, you ought to just use accounts, as they can encompass many addresses and provide a lot of functionality for separating your coins into many parts in the same wallet.

ThePiachu
  • 43,091
  • 25
  • 139
  • 348
2

The current rpc interface don't have a command to check balance of a address

0

I had the same issue and searched high and low but finally found the exact answer needed In the debug console type in the following command

 listaddressgroupings

This will return every address in that wallet and its balance

Hope this helps

0

getinfo also includes a "balance" field that encompasses all spendable Bitcoin. Getbalance and listreceivedbyaddress can do slightly more advanced things, including confirmation count, but you don't seem to need them.

Reference this: https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list

Lodewijk
  • 1,575
  • 10
  • 15