0
bitcoin > bitcoin-cli listaccounts
{
  "": 5648.99996160
}

bitcoin > bitcoin-cli getaccountaddress ""
mui4xgNgZBr3XhdL4dDDHkRFEvSXZmSi7t

bitcoin > bitcoin-cli getreceivedbyaddress mui4xgNgZBr3XhdL4dDDHkRFEvSXZmSi7t
0.00000000

I expect it will return 5648.99996160 after calling 'getreceivedbyaddress'.

1

An account can have multiple associated addresses. Presumably you had another address associated with "" beforehand, and received money using that address.

The getaccountaddress RPC call gives a fresh address. If money had been received already on the previous account address, a new one is created and associated with the account.

  • Thank you! However I still get problem. I call RPC getaddressesbyaccount and get 3 addresses. Then I call RPC getreceivedbyaddress for each 3 address, but the result are all 0.00000000. – Anderson Nov 22 '17 at 9:24
  • Did you send money to any of those 3 addresses? – Pieter Wuille Nov 22 '17 at 9:24
  • No. However, I expect one of the addresses should have money because the result of RPC "listaccounts" shows there is money in the account. – Anderson Nov 23 '17 at 6:04
  • getreceivedbyaddress shows (surprise!) how much was received by the address. If you literally tell me you never sent money to any of them, then by definition the response should be 0. There are plenty of other ways through which the account may have been credited before. – Pieter Wuille Nov 23 '17 at 6:11
  • 1
    You could have received money using a getnewaddress call before any of those 3, or using the move command you can move money from other accounts (even if that makes those others negative). – Pieter Wuille Nov 24 '17 at 3:57

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.