Unexpected behaviour Bitcoin RPC getbalance

0

I am seeing a smaller amount of BTC when I run ./bitcoin-cli getbalance compared to ./bitcoin-cli getbalance "" Here is the documentation on GetBalance from the BTC wiki, which highlights why I am confused

getbalance [account] [minconf=1]

If [account] is not specified, returns the server's total available balance. If [account] is specified, returns the balance in the account.

If no account is specified, it should return the server's total balance, and yet here is my result:

./bitcoin-cli getbalance --- 0.00001250

./bitcoin-cli getbalance "" --- 0.34869089

Why is this happening?

Barney Chambers

Posted 2019-11-21T14:35:35.257

Reputation: 291

Answers

0

It turns out that the reason was because the blockchain (Bitcoin Cash) had hardforked, after updating to the latest version my issue was resolved

Barney Chambers

Posted 2019-11-21T14:35:35.257

Reputation: 291

0

NULL and an empty string are interpreted differently. An empty string has no values. It’s an empty char array, one that hasn’t been assigned any elements. The string exists in memory, so it’s not NULL. Therefore we have two different labels and two different balances associated with those labels.

m1xolyd1an

Posted 2019-11-21T14:35:35.257

Reputation: 3 356

Thanks, how do I move the bitcoin into the main balance so I can run sendtoaddress without an account argument?Barney Chambers 2019-11-22T20:40:51.230

Also, when I use listaccounts there is only one account, so I'm not sure why there are 2 separate balancesBarney Chambers 2019-11-22T21:06:56.377

Accounts were deprecated a couple years ago. In version 0.17 labels were introduced as a "replacement" for accounts however the main differences are you can't spend from a label and labels don't have balances. https://bitcoin.org/en/release/v0.17.0#configuration-sections-for-testnet-and-regtest

m1xolyd1an 2019-11-23T18:46:32.433