Derive legacy Bitcoin (P2PKH) addresses & private keys from UTF-8 word lists (100K+ words), audit balances in fast 80-address batches with automatic API failover, and export compressed WIF keys locally.
📝 Your Word List (.txt)
│
▼ Step 2: Run word_to_btc_key.py (offline)
🔑 Generated Address + Private Key File (<name>_YYYY-MM-DD_HH-MM-SS.txt)
│
▼ Step 3: Run btc_batch_audit.py (80 addresses per API call)
💰 Active & Funded Results (audit_results_<name>_YYYY-MM-DD_HH-MM-SS.txt)
| Order | Script | What It Does | Output File |
|---|---|---|---|
| 1️⃣ | 🔑 word_to_btc_key.py |
Derives compressed secp256k1 P2PKH (1...) addresses & hex private keys from a .txt word list (offline) |
<input_stem>_YYYY-MM-DD_HH-MM-SS.txt |
| 2️⃣ | ⚡ btc_batch_audit.py |
Audits the generated address file in fast batches (80 at a time) for received & current BTC + derives compressed WIF |
audit_results_<input_stem>_YYYY-MM-DD_HH-MM-SS.txt |
| Alt | 🐢 btc_single_audit.py |
Slower sequential 1-by-1 address auditor using mempool.space and blockstream.info |
address_balance_check_YYYY-MM-DD_HH-MM-SS.txt |
| Check | 🩺 api_health_check.py |
Tests reachability, latency (ms), and JSON structure of all 3 Bitcoin balance APIs | Terminal status summary (3/3 healthy) |
| Sample | 📝 my word.txt |
Ready-to-test sample dictionary (98 sample words + 1 leading blank line) | Input sample for Step 2 |
⚠️ Security Note: Deriving private keys from single words or low-entropy passphrases (brainwallets) is unsafe for storing funds. Use these utilities strictly for learning Bitcoin cryptography, auditing weak passphrases, or recovering your own keys. Never share or commit your word lists, key files, or audit outputs.
- 🐍 Python 3.10 or newer (python.org) — during Windows installation, check "Add Python to PATH".
- 🖥️ Tkinter (included automatically with standard Windows/macOS Python; on Ubuntu/Debian Linux, run
sudo apt install python3-tk).
Open PowerShell / Terminal and run:
# 1. Download this repository and enter the folder
git clone https://github.com/linux2z/btc-batch-balance-auditor.git
cd btc-batch-balance-auditor
# 2. (Recommended) Create and activate a virtual environment
python -m venv .venv
# On Windows (PowerShell):
.venv\Scripts\Activate.ps1
# On macOS / Linux:
# source .venv/bin/activate
# 3. Install the required libraries (base58, ecdsa, requests)
pip install -r requirements.txt💡 Quick check: If
pip install -r requirements.txtfinishes without errors, you are ready to run the scripts!
A sample dictionary file (my word.txt, containing 98 sample words and 1 blank line) is included so you can test right away—or prepare any .txt word list with one word or passphrase per line (works smoothly with small lists or large dictionaries like 100,000+ words).
python word_to_btc_key.py- 📂 Pick your word list: A file picker window opens—select
my word.txt(or your own.txtdictionary file). - 🧹 Automatic cleanup: It reads the file, removes blank lines and duplicate words, and prints how many raw, blank, duplicate, and unique words were found (for
my word.txt:99raw lines,1blank skipped,98unique words). - ⚙️ Generates keys & addresses offline: For every unique word, it computes:
- A legacy Bitcoin address (
1...) - Its matching 64-character hex private key
- A legacy Bitcoin address (
- 💾 Saves & verifies: Writes each pair on two lines into a timestamped file in the same folder as your word list (e.g.
my word_2026-12-03_21-10-00.txt):After finishing, it automatically checks that1xm4vFerV3pSgvBFkyzLgT1Ew3HQYrS1V ...64-char hex private key...Output Lines Written == Converted Pairs × 2.
🚀 Tip for 100K+ Word Dictionaries: In
word_to_btc_key.py,VERBOSEis set toTrueby default (prints every single word in the terminal). For very large lists (e.g., 100,000 words), openword_to_btc_key.pyand change:VERBOSE = False PROGRESS_EVERY = 1000 # prints a milestone every 1,000 words for much faster console output
Once word_to_btc_key.py finishes creating your timestamped address file, run the fast batch auditor:
python btc_batch_audit.py- 📂 Select the generated BTC address file:
- Choose the timestamped file created in Step 2 (for example
my word_YYYY-MM-DD_HH-MM-SS.txt, not the rawmy word.txtword list). - Built-in validation:
inspect_address_file()checks that at least 80% (MIN_VALID_ADDRESS_RATIO = 0.8) of address lines are real Bitcoin addresses (1...,3..., orbc1...). If you accidentally select a word list, it rejects it and lets you pick again. - Private keys stay local: When an address line is followed by its 64-character hex (or WIF) private key on the next line, the script pairs them in memory and skips the private key during API calls—your private keys are never sent over the network.
- Choose the timestamped file created in Step 2 (for example
- 🌐 Queries balances via two API layers:
- Primary fast batch endpoint (
https://blockchain.info/balance): Sends 80 addresses in a single request (BATCH_SIZE = 80, pausingBATCH_DELAY = 1.0s between batches) to fetch total received coins (total_received), current coins (final_balance), and transaction count (n_tx), calculatingtotal_sent = max(0, total_received - final_balance). - Automatic single-address failover (
https://mempool.space/api➡️https://blockstream.info/api): Ifblockchain.inforate-limits (429), returns a server error (5xx), or omits an address, it automatically switches tomempool.spaceandblockstream.info(/address/<address>), summingchain_stats+mempool_stats(funded_txo_sumfor received coins,spent_txo_sumfor sent coins, andcurrent_balance = total_received - total_sent).
- Primary fast batch endpoint (
- 🔎 Filters & saves matches:
- Addresses that have never received BTC (
total_received <= 0) are skipped. - Whenever an address has received BTC (
total_received > 0), the script:- Converts the paired 64-char hex private key locally into a compressed WIF private key (
K...orL...) ready for wallet import. - Prints the match in the terminal (highlighting Current Balance in red if
> 0BTC). - Appends the full record immediately to
audit_results_<input_stem>_YYYY-MM-DD_HH-MM-SS.txtin the same folder so progress is saved even if you stop early.
- Converts the paired 64-char hex private key locally into a compressed WIF private key (
- Addresses that have never received BTC (
| Setting | Default | What It Controls |
|---|---|---|
START_FROM_ADDRESS |
1 |
Address number to start from (set to None to be asked in the terminal so you can resume a large file) |
BATCH_SIZE |
80 |
Number of addresses checked per blockchain.info request |
BATCH_DELAY |
1.0 |
Pause in seconds between batch requests to respect rate limits |
FALLBACK_REQUEST_DELAY |
0.5 |
Pause in seconds between single-address fallback requests |
VERBOSE |
True |
Set to False to hide "Never received BTC (skipped)" lines and only show hits |
If you prefer checking addresses slowly one at a time directly against mempool.space/api (with automatic failover to blockstream.info/api) without using blockchain.info, run:
python btc_single_audit.py- Uses the exact same address-file validation, local private-key pairing, compressed WIF conversion, and red balance highlighting.
- Pauses
REQUEST_DELAY = 0.6seconds between requests and saves hits toaddress_balance_check_YYYY-MM-DD_HH-MM-SS.txt.
Before running a long balance audit, you can run this quick diagnostic script (requires only requests) to verify that all three Bitcoin APIs are reachable, responsive, and returning the expected JSON fields:
python api_health_check.py- Queries the genesis address (
TEST_ADDRESS = "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa") using a singlerequests.Session(). - Checks the primary batch endpoint (
https://blockchain.info/balance) forfinal_balance,total_received, andn_tx. - Checks both Esplora fallback endpoints (
https://mempool.space/apiandhttps://blockstream.info/api) forchain_statsandmempool_stats(funded_txo_sum,spent_txo_sum,tx_count). - Prints per-endpoint latency (ms), HTTP status, BTC stats, and a final
working_count/total_apissummary with troubleshooting notes if any endpoint fails.
Click to expand the step-by-step math used by both scripts
- Word ➡️ Private Key (
word_to_btc_key.py):- Encode the word as UTF-8 bytes and take
SHA-256➡️ 32-byte private key. - Verify
1 <= int(private_key) < SECP256k1.order.
- Encode the word as UTF-8 bytes and take
- Private Key ➡️ Legacy
1...P2PKH Address (word_to_btc_key.py):- Multiply the
secp256k1generator point by the private key to get(X, Y). - Build compressed public key:
"02" + XifYis even, or"03" + XifYis odd. - Compute
HASH160 = RIPEMD-160(SHA-256(compressed_public_key)). - Prepend mainnet version byte
0x00, append the first 4 bytes ofSHA-256(SHA-256(payload)), and Base58-encode.
- Multiply the
- Hex Private Key ➡️ Compressed WIF (
btc_batch_audit.py&btc_single_audit.py):- Take the 32-byte raw private key, prepend
0x80(mainnet) and append0x01(compressed flag). - Append the first 4 bytes of
SHA-256(SHA-256(extended)), then Base58-encode to get aK...orL...WIF key.
- Take the 32-byte raw private key, prepend