1

I would like to get the balance of a Bitcoin address at a particular block number or date.

Is there any way to retrieve this data from JSON-RPC? Alternatively, is there any API or blockchain analytics service that provides this? Thanks.

2

Account/address balance are higher level constructs that are built on Bitcoin's low-level transaction scripting language and cryptography. As such, data related to funds 'belonging' to a particular address is not readily available in the blockchain, but has to be built separately by scanning the entire database. The Bitcoin-Core reference client does not even support showing 'balances' of address that are not part of your wallet, let alone providing you the data related to a particular address at a particular point in time. You would either have to do this yourself or search for third-party data providers who provide this kind of information through an API (that is off-topic on this forum).

0

That's rather complicated as "balance" is an higher order construct which exists only at wallet application level.

This means that you need to do some substancial coding.

Anyway, you could approach the problem this way:

1) convert the desired point in time to block height

2) query the blockchain by address. You can easily do that using blockchain.info API

https://blockchain.info/multiaddr?active=$address|$address

the API will return also a list of transactions received/sent by a given address.

3) loop through the transaction list to figure if relevant outputs (UTXOs) ware received and unspent at a given point in time. You can do that by referencing the transaction block height provided by the API after having mapped incoming (received) and outgoing (sent) TXs by cross-referencing TX hashes.

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.