Post
Topic
Board Bitcoin Technical Support
Re: Getting number of bitcoins associated to bitcoin address/public key
by
oshirowanen
on 04/06/2020, 08:58:49 UTC
There is no direct RPC call built into Bitcoin Core that you can use to say "give me the balance of any given address". You would need to build your own bespoke database, derived from blockchain data that you could then query using your block explorer. Something similar to this open-source block explorer: https://github.com/iquidus/explorer

You'll see it has a "sync" module which parses transaction data and updates local database files.

It also requires that your node is running with the txindex=1 option enabled (either on commandline or in bitcoin.conf) so that all transactions are indexed and not just ones that are related to your own wallet addresses.

I think this is the kind of thing I am looking for, but even more low level.  As in, is it possible to extract the data stored in each block and save the addresses and balances in a custom database, in order to perform fast searches later based on address to output the balance?  Wondering if blockchain.info does something similar?