Search content
Sort by

Showing 1 of 1 result by zzyyxx332211
Post
Topic
Board Bitcoin Technical Support
Merits 6 from 2 users
Topic OP
Check BTC balance programmatically
by
zzyyxx332211
on 31/01/2024, 22:01:26 UTC
⭐ Merited by LoyceV (4) ,ABCbits (2)
Hi,

I've got a list (200 million+) of bitcoin and ethereum addresses I need to check the balance for.

For ethereum, I'm running a geth + prysm node and I can simply check the balance for a specific address by calling `provider.getBalance(address)`.

For bitcoin, I initially assumed that this was possible in the same way by using bitcoin-core, so I synced the blocks but then find out this is not possible (I can use `client.importAddress(address, '', false)` but then I will have to rescan the blocks and it doesn't seem a viable solution considering the amount of addresses I have to check).

I also looked into bitcoin-abe and it seems that it will import all blocks in a database so then I may be able to query the data to check the balance (I probably will have to calculate it by summing up all unspent transaction outputs associated with each address).

I was wondering if anyone knew a better way of doing this or had any suggestion.

Thanks!