Post
Topic
Board Development & Technical Discussion
Re: Get list of all addresses with a balance over x?
by
starmyc
on 16/03/2018, 14:58:41 UTC
A few minutes? Whole core? That's really fast. When i tried to parse it with old "blockparser" i have 20% in 2 days and time was increased very fast every hour.

Can you share with me your chainstate parser? Wanna try it. Thanks.

The source code is opensource, on github: https://github.com/mycroft/chainstate
It doesn't parse the blockchain. It just read the chainstate from Bitcoin Core. https://en.bitcoin.it/wiki/Data_directory#chainstate_subdirectory
The chainstate is the result of parsing the blockchain, and contains all unspent transactions for new transaction validation purposes. When a new block is recieved by Bitcoin core, it will update this database to remove spent transactions and fills in new unspent transactions.

As for now, the chainstate is a 3-4GB leveldb database, with ~35 millions records (I didn't check recently). My tool will just read this database, and for each record (which are unspent transactions), decode it and find out which is the address & value (unspent amount of bitcoin).
Then, with a set of scripts, I sort unique addresses & compute their final balance. The whole process takes ~ 10 minutes (and it is not optimized at all).