Post
Topic
Board Project Development
Merits 11 from 3 users
Re: List of all Bitcoin addresses with a balance
by
pbies
on 31/08/2023, 13:23:12 UTC
⭐ Merited by LoyceV (8) ,vapourminer (2) ,JayJuanGee (1)
For all of you, a script which downloads and converts LoyceV addresses to brainflayer bloom filter.
Taken are all >1 mBTC addresses.

Code:
#!/usr/bin/env bash
set -e
echo "### Public addresses downloader and converter to bloom filter ###"

echo [01/12] Download the addresses
wget http://addresses.loyce.club/blockchair_bitcoin_addresses_and_balance_LATEST.tsv.gz

echo [02/12] Unpack the archive
pv blockchair_bitcoin_addresses_and_balance_LATEST.tsv.gz | gunzip > blockchair_bitcoin_addresses_and_balance_LATEST.tsv

echo [03/12] Check lowest balance line
line=$(grep -m 1 -bne $'\t99999$' blockchair_bitcoin_addresses_and_balance_LATEST.tsv | cut -d ":" -f 2)

echo [04/12] Get only with proper balance
head -c $line blockchair_bitcoin_addresses_and_balance_LATEST.tsv > int1.txt

echo [05/12] Get rid of first line
tail -n +2 int1.txt > int2.txt

echo [06/12] Get only addresses, sort and write to file
pv int2.txt | cut -f 1 | sort > gte1mBTC.txt

echo [07/12] Search for incompatible addresses
line=$(grep -m 1 -bne $'^bc1p' "gte1mBTC.txt" | cut -d ":" -f 2)

echo [08/12] Get only compatible addresses
head -c $line "gte1mBTC.txt" > int3.txt

echo "[09/12] Convert addresses to hash160 ($(wc -l < int3.txt) lines)"
pv int3.txt | ~/brainflayer/brainflayer -o int4.txt

echo [10/12] Sort and uniq hashes
pv -c int4.txt | sort -u | pv -c > hash160.txt

echo [11/12] Convert hex to bloom filter
~/brainflayer/hex2blf "hash160.txt" bloom.blf

echo [12/12] Finished!
>&2 echo -ne "\x7"