BitcoinKeyScanner is a fun Python project designed for devices such as a Raspberry Pi. It randomly generates Bitcoin keys, computes the corresponding addresses, and checks them against a locally maintained snapshot (TSV file) of Bitcoin addresses with balances. When a match ("hit") is found, the project sends an email alert and logs the hit to a file. So far, no hits have been found (and chances are extremely slim), so we can only say it’s an experiment to see if randomness ever meets reality. In any case, it’s a great way to learn about Bitcoin key generation and Python scripting!
BitcoinKeyScanner/
├── .gitignore # Git ignore patterns for temporary files and logs
├── LICENSE # MIT license file
├── README.md # Project overview and documentation (this file)
├── config.py # Configuration settings (SMTP, snapshot file path, logging, etc.)
├── requirements.txt # Python dependencies
├── scanner.py # Main scanning script that generates keys, sends alerts, and logs any hits
├── snapshot.py # Functions for loading snapshot data from a TSV file
└── data/ # Folder containing data files (ensure your TSV file is placed here)
└── blockchair_bitcoin_addresses_and_balance_LATEST.tsv
-
Clone the repository:
git clone https://github.com/yourusername/BitcoinKeyScanner.git cd BitcoinKeyScanner
-
(Optional) Create and activate a Python virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install the dependencies:
pip install -r requirements.txt
-
Update config.py with:
• Your SMTP email settings.
• The correct path for your snapshot TSV file.
• (Optional) Change the hit log filename if desired. -
Place your snapshot file (for example, data/blockchair_bitcoin_addresses_and_balance_LATEST.tsv) in the data folder.
The TSV file should have a header row with "address" and "balance" columns.
Run the scanner script:
python scanner.py
The script will:
• Generate random Bitcoin keys in batches.
• Derive their addresses.
• Compare the generated address against the local snapshot data.
• On a hit, send an email alert and also log the hit details to a file (hits.log), ensuring that no hit is lost even if there is an internet or email server issue.
• Chances are astronomically slim that any randomly generated key will match an address with funds. So far, no hits have been found!
• This project is intended as a fun experiment and a learning tool. We honestly don't know if it really works in practice – but it's a great conversation starter about Bitcoin, randomness, and key generation.
• Always take great care when handling private keys, even if they are randomly generated.
• Feel free to contribute ideas or improvements!
This project is licensed under the MIT License. See the LICENSE file for details.