graymauser / btcposbal2csv

List all bitcoin addresses with positive balance.
BSD 3-Clause "New" or "Revised" License
268 stars 201 forks source link
address-positive-balance bitcoin unspent-output utxo

Dump Bitcoin addresses with positive balance

Simple utility to list all bitcoin addresses with positive balance. It works by analysing the current unspent transaction output set (UTXO), aggregating outputs to same addresses together and write them to csv file.

Prequisities:

python 2.7
pip

To install:

run pip install -r requirements.txt

or install following packages with pip manualy

for linux:

for windows:

Usage

To use this script, you will need copy of chainstate database as created by bitcoin core client. I've not tried different clients.

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 (usualy $HOME/.bitcoin/chainstate).

Show help

python btcposbal2csv.py -h

Example:

The following will read from /home/USER/.bitcoin/chainstate, and write result to /home/USER/addresses_with_balance.csv.

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

Converting to RIPEMD160

Per request, I'm adding script which is able to convert BTC address to RIPEMD160 representation. BTC address must be in fist column, RIPEMD160 is added to csv. Output goes to stdout.

Example:

python convert2ripemd160.py /home/USER/addresses_with_balance.csv

Acknowledgement

This utility builds on very nice bitcoin_tools lib, which does the UTXO parsing.

Support

If you like this utility, please consider supporting the bitcoin_tools library which does all the heavy lifting.

If this particular functionality made your life easier you can support coffee consumption in BTC 1FxC1mgJkad63beJcECfZMRaFSf4PBLr2f.

FAQ