graymauser / btcposbal2csv

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

Doesn't work with Ubuntu20.04 and Python3 #21

Closed Stonica closed 3 years ago

Stonica commented 3 years ago
kevin@Kevin-PC:~/btcposbal2csv$ python3 btcposbal2csv.py /windir/g/.bitcoin/chainstate/ /windir/g/bitcoin_balance.csv
reading chainstate database
inmem
Traceback (most recent call last):
  File "btcposbal2csv.py", line 201, in <module>
    for address, sat_val, block_height in add_iter:
  File "btcposbal2csv.py", line 98, in in_mem
    for add, val, height in parse_ldb(
  File "/home/kevin/btcposbal2csv/utils.py", line 317, in parse_ldb
    o_key = db.get((unhexlify("0e00") + "obfuscate_key"))
TypeError: can't concat str to bytes
Witchtower commented 3 years ago

I thought about porting the script, but instead i put it in a docker container.

Here's the Dockerfile

FROM ubuntu
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Berlin
RUN apt-get update && apt-get install -y software-properties-common curl build-essential libleveldb-dev && add-apt-repository universe
RUN apt-get update && apt-get install -y python2 python-dev
RUN curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output /get-pip.py
RUN python2 /get-pip.py
RUN pip2 install plyvel base58

CMD ["python2", "/data/btcposbal2csv.py", "/chainstate", "/data/btcbal.csv"

mount chainstate and script directory according to last line in dockerfile. output goes to the directory of the python script in the example.

graymauser commented 3 years ago

Hello, yes, the script does not work in python3. It is clearly stated, that it needs python2.

The docker is good idea.