1

I'm not quite sure what I'm doing wrong here. I believe I have followed everything correctly but for some reason its still not working? I am using directions from here: https://bitcoin.org/en/developer-examples

bitcoin-cli -regtest generate 101 < This prints that long list of new satoshis

bitcoin-cli -regtest getbalance

50.00000000 Ensuring that the balance is 50

bitcoin-cli -regtest getnewaddress < Make sure I have a new address to send satoshis to

bitcoin-cli -regtest sendtoaddress mviKj9i2zQmoLVUGkLBMuDhwvAwDmfrAmZ 10.00 Attempting to send satoshis. This returns the transaction ID.

bitcoin-cli -regtest generate 1 < Should confirm it

bitcoin-cli -regtest getbalance mviKj9i2zQmoLVUGkLBMuDhwvAwDmfrAmZ

I am expecting this to return 10.00 however it returns 0.00000000

Any ideas on how to fix this?

  • 4
    You're passing an argument to getbalance, which is interpreted as an account name (a feature that is deprecated and will be removed soon). If you drop that, you'll get the wallet balance. Alternatively, you could use getreceivedbyaddress. – Pieter Wuille Nov 29 '16 at 19:25
2

If you go through the documentation, the getbalance command can take arguments for an account name, but not an address. I see that you are trying to get the balance for an address.

On blockchain, each account will be linked to non-zero number of addresses. Money sent to any of these addresses will be shown on the same account. So it doesn't make sense in showing the balance on an address. You command was interpreted as getting the balance on the account mviKj9i2zQmoLVUGkLBMuDhwvAwDmfrAmZ, which is non-existent. Hence, the result of 0.00000000.

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.