8

I'm looking for a way to retrieve all address balances of addresses with a non-zero balance in the blockchain.

Is there a software tool that can calculate the balances in an accessible format? Or perhaps I can download them somewhere?

With an accessible format I mean that it can be interpreted by a computer. Either in a database-structure or in parseable text format.

2

2 Answers 2

12

This guy wanted to do the same thing. You can find a solution there.

in short:

  • get a Linux Box/VM with >=8GB RAM
  • download blockparser
  • compile it
  • run "./parser allBalances -w 250000 >allBalances.txt"

the parser run take around 2 minutes on my vSphere VM (2x3Ghz Xeon, 16GB of RAM)

now you have a list of the top 250.000 adresses sorted by BTC amount.

add some sed/awk/cut magic to make a csv and you are done.

3
  • how to get ALL "nonzero" balances? Jan 5, 2018 at 22:29
  • I am sorry, I don't remember. It was 4 years ago Jan 6, 2018 at 15:00
  • That's a brilliant answer. You might taken hours to test it out. Thanks and here's an up vote for your hard-working Maciej M. Jul 4, 2021 at 16:44
0

You can use btcposbal2csv.py script to export the list to CSV.

To get current addresses with positive balance, let the full node client sync with the network. Stop the bitcoin-core client before running this utility. If you not stop the client, the database might get corrupted.

Then run this program with path to chainstate directory (usually $HOME/.bitcoin/chainstate).

For example, the following will read from ~/.bitcoin/chainstate, and write result to ~/addresses_with_balance.csv:

./btcposbal2csv.py /home/USER/.bitcoin/chainstate /home/USER/addresses_with_balance.csv

Notes:

  • That the output may not be complete as there are some transactions which are not understood by the decoding lib, or that which do not have "address" at all. Such transactions are not processed. Number of them and the total ammount is displayed after the analysis.
  • The output csv file only reflects the chainstate leveldb at your disk. So it will always be few blocks behind the network as you need to stop the bitcoin-core client.

Other dumps:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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