The getbalance command shows an empty balance

1

I sent bitcoins to an address and blockcypher says the transaction is done but as I try to learn the balance using bitcoin-cli -testnet getbalance <address>, the address hasn't received yet. So why can't the address receive bitcoins even now?

I really don't know why I can't get bitcoins.

Obviously, as blockcypher says I sent some bitcoins to the address from other my address and blockcypher says that the transactions were confirmed.

西田龍

Posted 2018-01-29T08:30:37.157

Reputation: 59

What is your question?Зелёный 2018-01-29T08:32:55.473

Sorry, my question was unclear, so in brief, I want to send bitcoins successfully西田龍 2018-01-29T08:34:12.410

It is still unclear for me. Please read https://bitcoin.stackexchange.com/help/how-to-ask

Зелёный 2018-01-29T08:39:49.113

I see. sorry I've read. so I sent bitcoins to an address and blockcypher says the transaction has done but as I try to know the balance using bitcoin-cli -testnet getbalance the address, the address hasn't received yet.So why can't the address receive bitcoins even now?西田龍 2018-01-29T09:33:18.803

I've edited your question to include the relevant information from the comment.Murch 2018-01-29T19:23:09.503

Answers

3

You can query the balance only of address you own.

I sent bitcoins to an address and blockcypher says the transaction has done but as I try to know the balance using bitcoin-cli -testnet getbalance the address, the address hasn't received yet.So why couldn't the address receive bitcoins or couldn't I send ?

The getbalance RPC method(and related bitcoin-cli command) accept two arguments, first is a string and it isn't an address, it's an account name, second is a confirmation coint To get the balance of whole wallet use:

bitcoin-cli -testnet getbalance

Or use getreceivedbyaddress:

bitcoin-cli -testnet getreceivedbyaddress 'the address' 0

Зелёный

Posted 2018-01-29T08:30:37.157

Reputation: 871

$ bitcoin-cli -testnet getreceivedbyaddress mq7A3EUXa4eu3XUJeB2RjXyS75EzSkz4T2 0 =&gt; 0.00000000 it even says that the adress has nothing西田龍 2018-01-29T09:52:27.853

Is your bitcoind fully synced? what the output of getinfo command? Also is this address owned by wallet of your bitcoind ?Зелёный 2018-01-29T09:58:29.690

It was synced completely.Thank you, I just found that the address wasn't valid so that I couldn't make my wallet have the address then it said the address has nothing.西田龍 2018-01-29T17:01:32.650

-1

make sure you are passing the account name as first parameter. If no account name is passed it will show you the balance of all the address in that wallet

Support Blockchain

Posted 2018-01-29T08:30:37.157

Reputation: 11