<p><code>getreceivedbyaddress</code> is a wallet RPC. It queries your own wallet for how much money it has received on that address. Arguably, the RPC should return an error if the address is not considered its by the wallet.</p>

<p>You can make the wallet treat addresses as its own even if it does not have the private key, by using the <em>watch-only</em> functionality. However, introducing a new address will require a lengthy rescan of all of history to discover the transactions.</p>

<p>There is no equivalent RPC that operates on the whole node, as Bitcoin Core does not maintain a full per-address index of the blockchain.</p>

<p>I filed an issue here: <a href="https://github.com/bitcoin/bitcoin/issues/10921" rel="nofollow noreferrer">https://github.com/bitcoin/bitcoin/issues/10921</a></p>

CC BY-SA 3.0
2017-07-24T22:10:05.533Z
2017-07-24T22:10:05.533Z
Pieter Wuille
<p>I've already synchronized about 400.000 blocks, but every time I'm trying to get balance for specific address, e.g. first coinbase address - <a href="https://blockchain.info/address/12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX" rel="nofollow noreferrer">link</a>:</p>

<pre><code>$ bitcoin-cli getreceivedbyaddress 12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX
0.00000000
</code></pre>

<p>It always returns <code>0.00000000</code>. What am I doing wrong?</p>

<p>P.S. My bitcoin-cli information:</p>

<pre><code>$ bitcoin-cli getinfo
{
  "version": 140200,
  "protocolversion": 70015,
  "walletversion": 130000,
  "balance": 0.00000000,
  "blocks": 396531,
  "timeoffset": -2,
  "connections": 8,
  "proxy": "",
  "difficulty": 120033340651.237,
  "testnet": false,
  "keypoololdest": 1500906189,
  "keypoolsize": 100,
  "paytxfee": 0.00000000,
  "relayfee": 0.00001000,
  "errors": ""
}
</code></pre>

<address><balance><bitcoin-cli>
Why 'bitcoin-cli getreceivedbyaddress ...' always returns 0?
Sergey Potekhin
# Why 'bitcoin-cli getreceivedbyaddress ...' always returns 0?

(Asked by: username_0 on 2017-07-24)

I've already synchronized about 400.000 blocks, but every time I'm trying to get balance for specific address, e.g. first coinbase address - [link](https://blockchain.info/address/12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX):

```
$ bitcoin-cli getreceivedbyaddress 12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX
0.00000000

```

It always returns `0.00000000`. What am I doing wrong?

P.S. My bitcoin-cli information:

```
$ bitcoin-cli getinfo
{
  "version": 140200,
  "protocolversion": 70015,
  "walletversion": 130000,
  "balance": 0.00000000,
  "blocks": 396531,
  "timeoffset": -2,
  "connections": 8,
  "proxy": "",
  "difficulty": 120033340651.237,
  "testnet": false,
  "keypoololdest": 1500906189,
  "keypoolsize": 100,
  "paytxfee": 0.00000000,
  "relayfee": 0.00001000,
  "errors": ""
}

```

**Tags:** address, balance, bitcoin-cli


---

## 1 answers

### Answer by username_1 on 2017-07-24. Score: 4 | Accepted answer

`getreceivedbyaddress` is a wallet RPC. It queries your own wallet for how much money it has received on that address. Arguably, the RPC should return an error if the address is not considered its by the wallet.

You can make the wallet treat addresses as its own even if it does not have the private key, by using the *watch-only* functionality. However, introducing a new address will require a lengthy rescan of all of history to discover the transactions.

There is no equivalent RPC that operates on the whole node, as Bitcoin Core does not maintain a full per-address index of the blockchain.

I filed an issue here: <https://github.com/bitcoin/bitcoin/issues/10921>


---

