Skip to main content

A tool to efficiently check if a Bitcoin Address has ever been used before

Project description

used_addr_check (Python)

A tool to efficiently check if a Bitcoin Address has ever been used before

Description

Based on loyce.club's "all bitcoin addresses ever used" list, this library and CLI tool can search the list very, very fast and efficiently.

Features

  • Lookup either a single address, or a long list of potential addresses.
  • CLI and library options
  • Generates a binary search tree index from the text file, and then uses that to search for the address.

Getting Started

This project depends on the large address list being downloaded and extracted.

# Download the zipped text file of used addresses, where each line is a used Bitcoin address.
wget http://alladdresses.loyce.club/all_Bitcoin_addresses_ever_used_sorted.txt.gz

# Extract the file
gunzip -d ./all_Bitcoin_addresses_ever_used_sorted.txt.gz --stdout | pv > all_Bitcoin_addresses_ever_used_sorted.txt

Optionally, if you intend to use the scan_file subcommand, install ripgrep from optimal performance:

# first, install cargo/rust
# then, run:
cargo install ripgrep

Usage - CLI

pip install used_addr_check

# download and extract the required file:
wget http://alladdresses.loyce.club/all_Bitcoin_addresses_ever_used_sorted.txt.gz
gunzip -d ./all_Bitcoin_addresses_ever_used_sorted.txt.gz --stdout | pv > addr_list.txt

# generate the index file (optional):
used_addr_check index -f ./addr_list.txt
# the index file is now at: ./addr_list.index.parquet

# search a couple of addresses:
used_addr_check search -f ./addr_list.txt -s moW9o415jNfgyuzytEMZD84Kovri5DJ64e -s mncqTEYTidNdbqGZnXTd1JFYRrruuh5StV

# search for a long list of addresses (extracted by regex):
used_addr_check scan_file -f ./addr_list.txt -n file_with_addresses_to_lookup.txt

Usage - Library

This example will generate the index file, if required.

from used_addr_check import search_multiple_in_file

needles = [
    'moW9o415jNfgyuzytEMZD84Kovri5DJ64e',
    'mncqTEYTidNdbqGZnXTd1JFYRrruuh5StV'
]
haystack_file_path = './addr_list.txt'

addresses_found_list: List[str] = search_multiple_in_file(
    haystack_file_path=haystack_file_path,
    needles=needled,
)
print(f"{addresses_found_list=}")

Performance Notes

  • With the default indexing size of one index entry per 1000 addresses in the "haystack" file, the index is a 140MB Parquet file.
  • On a 2023 mid-range laptop with an SSD:
    • Indexing takes 4 minutes.
    • Addresses can be searched at 20 query addresses ("needles") per sec.

There are certainly opportunities for further improvement, but this performance is adequate.

Contributing

Please Star this repo if it's helpful.

Please open GitHub Issues and Pull Requests with features/bugs/fixes.

Future Features

  • Optionally disable loguru logging in subfunctions
  • Convert "found address" result to an iterator.
  • Test cases.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

used_addr_check-0.1.2.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

used_addr_check-0.1.2-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file used_addr_check-0.1.2.tar.gz.

File metadata

  • Download URL: used_addr_check-0.1.2.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for used_addr_check-0.1.2.tar.gz
Algorithm Hash digest
SHA256 0c5fad0cc0e7d2d6f88edb54cd5f94f025195c18d9f96492372b54afa11dfadd
MD5 aa57ca4608700c89e8c416dfcf7d926f
BLAKE2b-256 2485e6318ad4024960f08a9b9a9f38f12b809f78414e8a0d532b6dfb9b95fbe0

See more details on using hashes here.

File details

Details for the file used_addr_check-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for used_addr_check-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 61340087d1d7cd6f483a744a20be01bb5ed9f0260acf7e2adccf98c43dfab7bc
MD5 f18153419438ee7a0aa064a528e60e5a
BLAKE2b-256 0d401f52bf998db05877d2087c88f0f33b49f8ffe0fae66ec25aa25fd401024b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page