After bitcoin-cli -regtest -sendtoaddress "address" That address's balance is always 0

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?

Benjamin Creem

Posted 2016-11-29T19:13:59.520

Reputation: 11

4You'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 2016-11-29T19:25:35.080

Answers

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.

Kalyan Kumar

Posted 2016-11-29T19:13:59.520

Reputation: 21