<p>This is probably not a full solution, but maybe a possible optimization.  Since you send all BTC out of the address in every send transaction, you should only have to look at the transactions that happen after the last sending transaction to calculate the value at an address.</p>

CC BY-SA 3.0
2013-05-14T15:17:58.370Z
2013-05-14T15:17:58.370Z
abommarito
<p>You would need to use a client node that has a different architecture, from the satoshi's client.
Specifically, the client must be able to quickly browse through all the unspent outputs.</p>

<p>You may want to check <a href="https://en.bitcoin.it/wiki/Clients#Table" rel="nofollow">this table</a> for clients that support <strong>Multi-wallet</strong>.
Among them, there is a new client <a href="https://en.bitcoin.it/wiki/Gocoin" rel="nofollow">Gocoin</a>. It is currently in a testing phase, and you need to build it yourself from sources, but if you have a PC powerful enough to run it, it needs less than a second to give you an unspent balance of any standard bitcoin address.</p>

CC BY-SA 3.0
2013-05-14T15:31:30.907Z
2013-05-14T17:02:56.850Z
2013-05-14T17:02:56.850Z
Gigi
<p>Is there some method how you can calculate the balance of an address without resorting to web-based API's? When I import a private key the rescanning of bitcoind takes hours. I know to get a balance you would need to iterate over all transactions in the whole chain, but maybe there is still some optimization possible.</p>

CC BY-SA 3.0
2013-05-14T13:43:17.600Z
possible duplicate of [How to get an address's balance with the bitcoin client?](http://bitcoin.stackexchange.com/questions/10090/how-to-get-an-addresss-balance-with-the-bitcoin-client)
Steven Roose
CC BY-SA 3.0
2013-05-14T20:20:22.843Z
@StevenRoose It's not a duplicate, I know how to do it via bitcoind, I'm looking for alternatives.
Maestro
CC BY-SA 3.0
2013-05-14T20:31:30.587Z
I see, sadly I cannot revert my vote, but maybe no additional close votes are cast. (http://meta.stackexchange.com/questions/915/can-we-have-the-ability-to-rescind-a-close-vote-before-it-closes)
Steven Roose
CC BY-SA 3.0
2013-07-02T20:46:00.567Z
I would like to know how to this in bitcoind. The question Steven linked is also not properly answered. They all say "its not possible". What I'd like to know is how to traverse all unspent outputs, and find those corresponding to a given address, possibly not in the wallet.
Jus12
CC BY-SA 3.0
2014-03-11T11:10:22.750Z
see also [How to know there is a new transaction?](http://bitcoin.stackexchange.com/q/1725/3347)
Janus Troelsen
<blockchain><bitcoind><json-rpc><api><balance>
Calculating address balance
Maestro
# Calculating address balance

(Asked by: username_0 on 2013-05-14)

Is there some method how you can calculate the balance of an address without resorting to web-based API's? When I import a private key the rescanning of bitcoind takes hours. I know to get a balance you would need to iterate over all transactions in the whole chain, but maybe there is still some optimization possible.

**Tags:** blockchain, bitcoind, json-rpc, api, balance

> **Comments:**
> **username_1**: possible duplicate of [How to get an address's balance with the bitcoin client?](http://bitcoin.stackexchange.com/questions/10090/how-to-get-an-addresss-balance-with-the-bitcoin-client)  
> **username_0**: @username_1 It's not a duplicate, I know how to do it via bitcoind, I'm looking for alternatives.  
> **username_1**: I see, sadly I cannot revert my vote, but maybe no additional close votes are cast. (http://meta.stackexchange.com/questions/915/can-we-have-the-ability-to-rescind-a-close-vote-before-it-closes)  
> **username_2**: I would like to know how to this in bitcoind. The question username_1 linked is also not properly answered. They all say "its not possible". What I'd like to know is how to traverse all unspent outputs, and find those corresponding to a given address, possibly not in the wallet.  
> **username_3**: see also [How to know there is a new transaction?](http://bitcoin.stackexchange.com/q/1725/3347)  

---

## 2 answers

### Answer by username_5 on 2013-05-14. Score: 4 | Accepted answer

You would need to use a client node that has a different architecture, from the satoshi's client.
Specifically, the client must be able to quickly browse through all the unspent outputs.

You may want to check [this table](https://en.bitcoin.it/wiki/Clients#Table) for clients that support **Multi-wallet**.
Among them, there is a new client [Gocoin](https://en.bitcoin.it/wiki/Gocoin). It is currently in a testing phase, and you need to build it yourself from sources, but if you have a PC powerful enough to run it, it needs less than a second to give you an unspent balance of any standard bitcoin address.


---

### Answer by username_4 on 2013-05-14. Score: 3

This is probably not a full solution, but maybe a possible optimization. Since you send all BTC out of the address in every send transaction, you should only have to look at the transactions that happen after the last sending transaction to calculate the value at an address.


---

