<p>As you have rightly mentioned <code>getreceivedbyaddress</code> does not return a value for non node addresses, i.e. the addresses which are not in your nodes wallet. </p>

<p>txindex=1 in the configuration file followed by restarting bitcoind with -reindex parameter creates indexes for all the txs so that you can open them up with getrawtransaction and check the details inside the transaction.</p>

<p>The only way you can check for the addresses balance at any given block is to crawl all the blocks before the block under consideration and check each transaction's vout whether it contains the address under consideration. Also you will have to check whether any of the vouts you just went through have not been spent which would decrease the balance accordingly.</p>

CC BY-SA 3.0
2017-05-30T10:37:07.397Z
The reason why there are 3rd party services for this exact problem kind of supports the notion that this is very complex, which you might get after going through the answer.
Shabahat M. Ayubi
CC BY-SA 3.0
2017-05-30T23:34:27.107Z
3rd party libraries are ok, as long as I can run them on my own machine, to not count on some server which doesn't belong to me.
noisy
CC BY-SA 3.0
2017-05-30T10:35:37.663Z
2017-05-30T10:46:02.060Z
2017-05-30T10:46:02.060Z
Shabahat M. Ayubi
<p>I need to have a possibility to check balance on every address. So far I tried used <code>getreceivedbyaddress</code>, but as far as I understand with this command I can check only addresses which I have in my wallet, right?</p>

<p>I also found information, that to have a possibility to analyze transactions of others I need to set <code>txindex=1</code> in my bitcoin <code>bitcoin.conf</code> file. I read that this will help me with <code>getrawtransaction</code> which will be able to get me details about any transaction. Does <code>txindex=1</code> will also help with <code>getreceivedbyaddress</code>?</p>

<p>and last, but not least... how to check balance of particular address in the past? Can I use <code>getreceivedbyaddress &lt;address&gt; 100000</code> where <code>100000</code>  would be amount of required confirmations, so I would check <code>100000</code> blocks in the past? </p>

<transactions><bitcoin-core><address><balance>
What is the easiest way to check what was the balance of address X at block Y? (without 3rd party services)
noisy
# What is the easiest way to check what was the balance of address X at block Y? (without 3rd party services)

(Asked by: username_0 on 2017-05-30)

I need to have a possibility to check balance on every address. So far I tried used `getreceivedbyaddress`, but as far as I understand with this command I can check only addresses which I have in my wallet, right?

I also found information, that to have a possibility to analyze transactions of others I need to set `txindex=1` in my bitcoin `bitcoin.conf` file. I read that this will help me with `getrawtransaction` which will be able to get me details about any transaction. Does `txindex=1` will also help with `getreceivedbyaddress`?

and last, but not least... how to check balance of particular address in the past? Can I use `getreceivedbyaddress  100000` where `100000` would be amount of required confirmations, so I would check `100000` blocks in the past?

**Tags:** transactions, bitcoin-core, address, balance


---

## 1 answers

### Answer by username_1 on 2017-05-30. Score: 3

As you have rightly mentioned `getreceivedbyaddress` does not return a value for non node addresses, i.e. the addresses which are not in your nodes wallet.

txindex=1 in the configuration file followed by restarting bitcoind with -reindex parameter creates indexes for all the txs so that you can open them up with getrawtransaction and check the details inside the transaction.

The only way you can check for the addresses balance at any given block is to crawl all the blocks before the block under consideration and check each transaction's vout whether it contains the address under consideration. Also you will have to check whether any of the vouts you just went through have not been spent which would decrease the balance accordingly.

> **Comments:**
> **username_1**: The reason why there are 3rd party services for this exact problem kind of supports the notion that this is very complex, which you might get after going through the answer.  
> **username_0**: 3rd party libraries are ok, as long as I can run them on my own machine, to not count on some server which doesn't belong to me.  

---

