2

I have a tiny question regarding the Bitcoin JSON-RPC API. I have a transaction on Testnet which sends one coin to an other address owned by me (on an other account than the sender). The sending address, mtGaEd9zZU8B7aYSuQiDFZTo2wiS8dWb3c, is listed under the default account, running getaccount mtGaEd9zZU8B7aYSuQiDFZTo2wiS8dWb3c outputs indeed an empty string. The receiving address, mzcj8xYome3gmAWZG57yutv14sctPxbPV6, is listed under an account named test, as expected running getaccount mzcj8xYome3gmAWZG57yutv14sctPxbPV6 returns test. Both addresses also show up when I use getaddressesbyaccount, but the change that went to address mnUJRd9CL3GV1QbWFxJxLj2DgE1ADSB8oR, which also returns an emtpy string when using it as argument to getaccount, doesn't show up in the getaddressesbyaccount call output. Why is that? I can't sum the balances of each addresses now for a reliable account balance, only getbalance return the right answer.

2 Answers 2

1

Call listreceivedbyaddress(0, true) to get all of your addresses (even the empty ones or those who have a zero-confirmations balance).

By default (parameterless) it will only list the addresses that contain some confirmed balance and those who have at least one confirmation for their unconfirmed balance.

2
  • 1
    I believe I was talking about getaddressesbyaccount not listreceivedbyaddress. Don't get me wrong, I'm not asking a solution (getbalance works just fine), I'm trying to understand why getaddressesbyaccount does not work.
    – Jori
    Commented Mar 1, 2014 at 22:38
  • And why would mnUJRd9CL3GV1QbWFxJxLj2DgE1ADSB8oR have zero confirmations? It is in the same transaction as mzcj8xYome3gmAWZG57yutv14sctPxbPV6.
    – Jori
    Commented Mar 1, 2014 at 22:41
0

It doesn't show up in the results from getaddressesbyaccount() because addresses are only associated with accounts by use of getnewaddress() or setaccount().

1
  • Why did they use this approach? It doesn't make sense to me. Also is there any other way to show all Bitcoin addresses?
    – Jori
    Commented Nov 29, 2013 at 19:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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