2

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 <address> 100000 where 100000 would be amount of required confirmations, so I would check 100000 blocks in the past?

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.

  • 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 May 30 '17 at 10:37
  • 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 May 30 '17 at 23:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.