<p>I have written a program in Python3 that allows you to search for any address on bitcoin core whether it belongs to your wallet or not.</p>
<p>Here is the github link:</p>
<p><a href="https://github.com/ORP967/Bitcoin_Core_RPC_par_address" rel="nofollow noreferrer">https://github.com/ORP967/Bitcoin_Core_RPC_par_address</a></p>
<p>Let me know what you think or if you have any improvements you might have.</p>

CC BY-SA 4.0
2022-01-23T23:01:41.363Z
2022-01-23T23:01:41.363Z
ORP967
<p>AFAIK, this can't be done in any reasonable way with Bitcoin Core and its derivatives.</p>

<p>The only way I know to do it with Bitcoin Core is to use <a href="https://bitcoin.org/en/developer-reference#importaddress" rel="noreferrer"><code>importaddress</code></a> or <a href="https://bitcoin.org/en/developer-reference#importmulti" rel="noreferrer"><code>importmulti</code></a> to add your address(es) to the wallet as watch-only, but this requires a full blockchain rescan in order to compute the balance.  This takes several minutes to hours depending on the speed of your hardware.</p>

<p>(Note that the bitcoin.it link you gave is obsolete and only covers the API up to version 0.8, so you won't find these commands listed there.)</p>

<p>You'd need to use some other software that actually indexes all transactions in the blockchain by their receiving addresses.  This is what a block explorer does, for instance.  </p>

<p>We have had a lot of other questions similar to this, so maybe there are some suggestions there: <a href="https://bitcoin.stackexchange.com/search?q=get+address+balance">https://bitcoin.stackexchange.com/search?q=get+address+balance</a></p>

CC BY-SA 3.0
2017-09-07T13:43:09.400Z
Using importaddress is a good idea! I don't mind doing a rescan because the address will not change often. Will I have problems when trying to spend bitcoins if there is an imported watch-only address in my wallet?
Paul
CC BY-SA 3.0
2017-09-07T14:04:31.613Z
@Paul: Not that I know of.  The wallet knows that the coins in the watch-only address don't belong to it, and it will ignore them when trying to spend coins.
Nate Eldredge
CC BY-SA 3.0
2017-09-07T13:09:31.653Z
2017-09-07T13:09:31.653Z
Nate Eldredge
<p>I'm having a hard time figuring out how to compute the balance of a given bitcoin address using only the standard RPC API. I would like to extend this logic to bitcoin clones as well so the solution should use standard API calls only (e.g. only calls listed here <a href="https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list</a> )</p>

<p>Can you think of a way of doing this?</p>

<bitcoin-core><bitcoind><json-rpc><altcoin>
Determine address balance using bitcoin core
Paul
# Determine address balance using bitcoin core

(Asked by: username_0 on 2017-09-06)

I'm having a hard time figuring out how to compute the balance of a given bitcoin address using only the standard RPC API. I would like to extend this logic to bitcoin clones as well so the solution should use standard API calls only (e.g. only calls listed here <https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list> )

Can you think of a way of doing this?

**Tags:** bitcoin-core, bitcoind, json-rpc, altcoin


---

## 2 answers

### Answer by username_2 on 2017-09-07. Score: 7 | Accepted answer

AFAIK, this can't be done in any reasonable way with Bitcoin Core and its derivatives.

The only way I know to do it with Bitcoin Core is to use [`importaddress`](https://bitcoin.org/en/developer-reference#importaddress) or [`importmulti`](https://bitcoin.org/en/developer-reference#importmulti) to add your address(es) to the wallet as watch-only, but this requires a full blockchain rescan in order to compute the balance. This takes several minutes to hours depending on the speed of your hardware.

(Note that the bitcoin.it link you gave is obsolete and only covers the API up to version 0.8, so you won't find these commands listed there.)

You'd need to use some other software that actually indexes all transactions in the blockchain by their receiving addresses. This is what a block explorer does, for instance.

We have had a lot of other questions similar to this, so maybe there are some suggestions there: <https://bitcoin.stackexchange.com/search?q=get+address+balance>

> **Comments:**
> **username_0**: Using importaddress is a good idea! I don't mind doing a rescan because the address will not change often. Will I have problems when trying to spend bitcoins if there is an imported watch-only address in my wallet?  
> **username_2**: @username_0: Not that I know of.  The wallet knows that the coins in the watch-only address don't belong to it, and it will ignore them when trying to spend coins.  

---

### Answer by username_1 on 2022-01-23. Score: 0

I have written a program in Python3 that allows you to search for any address on bitcoin core whether it belongs to your wallet or not.

Here is the github link:

<https://github.com/username_1/Bitcoin_Core_RPC_par_address>

Let me know what you think or if you have any improvements you might have.


---

