<p>You can use the command <code>bitcoin-cli importaddress</code> to watch addresses that your wallet does not control. This command will generally require a rescan of the chain, which can take some time depending on your computational resources.</p>

<p>Note that if you happen to know which blocks contain transactions related to the address in question, you can turn off the rescan when importing the address, and then separately run a <code>rescanblockchain</code> command to only search the necessary blocks. This can <em>greatly</em> reduce the rescan time.</p>

<p>Here is a dump of <code>bitcoin-cli help importaddress</code>, running bitcoin-core v0.17.0.1.</p>

<pre><code>importaddress "address" ( "label" rescan p2sh )

Adds an address or script (in hex) that can be watched as if it were in your wallet but cannot be used to spend. Requires a new wallet backup.

Arguments:
1. "address"          (string, required) The Bitcoin address (or hex-encoded script)
2. "label"            (string, optional, default="") An optional label
3. rescan               (boolean, optional, default=true) Rescan the wallet for transactions
4. p2sh                 (boolean, optional, default=false) Add the P2SH version of the script as well

Note: This call can take over an hour to complete if rescan is true, during that time, other rpc calls
may report that the imported address exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.
If you have the full public key, you should call importpubkey instead of this.

Note: If you import a non-standard raw script in hex form, outputs sending to it will be treated
as change, and not show up in many RPCs.

Examples:

Import an address with rescan
&gt; bitcoin-cli importaddress "myaddress"

Import using a label without rescan
&gt; bitcoin-cli importaddress "myaddress" "testing" false

As a JSON-RPC call
&gt; curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "importaddress", "params": ["myaddress", "testing", false] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
</code></pre>

CC BY-SA 4.0
2020-04-28T01:27:45.740Z
2020-04-28T01:27:45.740Z
chytrik
<p>When im trying to get balance of remote address I'm getting an error, this address not exists on my wallet and I want to follow her balance.</p>

<p>This is what I tried:</p>

<pre><code>bitcoin-cli getreceivedbyaddress "1FJhBusrEHPZVTey5Q7zb3ZND86nYWrNV2" 0
</code></pre>

<p>And this is the error that I'm getting:</p>

<pre><code>error code: -4
error message:
Address not found in wallet
</code></pre>

<p>I know that this address is not existing in my wallet but i do want to follow her balance.</p>

<json-rpc><balance>
Getting address balance that not exists in my wallet
MisterPython
# Getting address balance that not exists in my wallet

(Asked by: username_0 on 2020-04-27)

When im trying to get balance of remote address I'm getting an error, this address not exists on my wallet and I want to follow her balance.

This is what I tried:

```
bitcoin-cli getreceivedbyaddress "1FJhBusrEHPZVTey5Q7zb3ZND86nYWrNV2" 0

```

And this is the error that I'm getting:

```
error code: -4
error message:
Address not found in wallet

```

I know that this address is not existing in my wallet but i do want to follow her balance.

**Tags:** json-rpc, balance


---

## 1 answers

### Answer by username_1 on 2020-04-28. Score: 3

You can use the command `bitcoin-cli importaddress` to watch addresses that your wallet does not control. This command will generally require a rescan of the chain, which can take some time depending on your computational resources.

Note that if you happen to know which blocks contain transactions related to the address in question, you can turn off the rescan when importing the address, and then separately run a `rescanblockchain` command to only search the necessary blocks. This can *greatly* reduce the rescan time.

Here is a dump of `bitcoin-cli help importaddress`, running bitcoin-core v0.17.0.1.

```
importaddress "address" ( "label" rescan p2sh )

Adds an address or script (in hex) that can be watched as if it were in your wallet but cannot be used to spend. Requires a new wallet backup.

Arguments:
1. "address"          (string, required) The Bitcoin address (or hex-encoded script)
2. "label"            (string, optional, default="") An optional label
3. rescan               (boolean, optional, default=true) Rescan the wallet for transactions
4. p2sh                 (boolean, optional, default=false) Add the P2SH version of the script as well

Note: This call can take over an hour to complete if rescan is true, during that time, other rpc calls
may report that the imported address exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.
If you have the full public key, you should call importpubkey instead of this.

Note: If you import a non-standard raw script in hex form, outputs sending to it will be treated
as change, and not show up in many RPCs.

Examples:

Import an address with rescan
> bitcoin-cli importaddress "myaddress"

Import using a label without rescan
> bitcoin-cli importaddress "myaddress" "testing" false

As a JSON-RPC call
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "importaddress", "params": ["myaddress", "testing", false] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/

```


---

