Academic security research tool demonstrating brain wallet vulnerabilities on Bitcoin testnet.
- Testnet only - Never use on mainnet
- Educational purpose - For academic research only
- No real funds - Demonstrates vulnerabilities without theft
- Multiple safety controls - Mainnet operations blocked at every level
A brain wallet is a Bitcoin wallet where the private key is derived directly from a passphrase using:
private_key = SHA256(passphrase)
This makes them:
- β Easy to remember (just memorize a phrase)
- β Extremely insecure (attackable by anyone with a wordlist)
This tool demonstrates how vulnerable brain wallets are by scanning for them on Bitcoin testnet.
brain-wallet-scanner/
βββ src/
β βββ password_generator.py # Component 1: Password generation
β βββ address_generator.py # Component 2: Address derivation
β βββ blockchain_checker.py # Component 3: Blockchain scanning
β βββ logger.py # Component 5: Logging & reporting
β βββ main.py # Main orchestrator
βββ tests/ # Unit and integration tests
βββ config/ # Configuration files
βββ data/
β βββ wordlists/ # Password dictionaries (download separately)
βββ logs/ # Execution logs
βββ results/ # Scan reports (JSON)
βββ requirements.txt # Python dependencies
pip install -r requirements.txtFor dictionary-based scanning, download the RockYou password list:
# Create directory
mkdir -p data/wordlists
# Download RockYou wordlist
# Option 1: From SecLists repository
cd data/wordlists
curl -LO https://github.com/danielmiessler/SecLists/raw/master/Passwords/Leaked-Databases/rockyou.txt.tar.gz
tar -xzf rockyou.txt.tar.gz
# Option 2: Download from Kaggle or other source
# See data/wordlists/README.md for alternative sourcesThe default configuration works out of the box. To customize:
cp config/config.example.yaml config/config.yaml
# Edit config.yaml if neededcd src
python main.py --passwords 5000 --strategy bitcoin_specificThis will test 5,000 cryptocurrency-themed passwords like "bitcoin2024", "satoshi123", etc.
python main.py --passwords 10000 --strategy dictionary --wordlist ../data/wordlists/rockyou.txtpython main.py --passwords 5000 --strategy patternspython main.py --passwords 20000 --strategy hybridOptions:
--config PATH Path to config file (default: config/config.yaml)
--passwords N Number of passwords to try (default: 10000)
--strategy STRATEGY Password strategy (default: bitcoin_specific)
Choices: dictionary, patterns, bitcoin_specific, hybrid
--wordlist PATH Override wordlist path from config
# Quick test with 1,000 passwords
python main.py --passwords 1000 --strategy bitcoin_specific
# Full scan with 50,000 passwords (takes several hours)
python main.py --passwords 50000 --strategy hybrid
# Dictionary scan with custom wordlist
python main.py --passwords 100000 --strategy dictionary --wordlist /path/to/wordlist.txtDetailed logs are saved to ./logs/scan_YYYYMMDD_HHMMSS.log
Example log output:
INFO: Progress: 1,000 passwords tried
WARNING: π― VULNERABLE BRAIN WALLET FOUND #1
WARNING: Address: mohjSavDdQYHRYXcS3uS6ttaHP8amyvX78
WARNING: Balance: 50000 satoshis
WARNING: Transactions: 3
JSON reports are saved to ./results/scan_report_YYYYMMDD_HHMMSS.json
Example report structure:
{
"summary": {
"passwords_tried": 10000,
"addresses_checked": 10000,
"vulnerable_addresses_found": 12,
"duration_seconds": 7234.5
},
"performance": {
"passwords_per_second": 1.38,
"addresses_per_second": 1.38
},
"vulnerable_addresses": [
{
"address": "mohjSavDdQYHRYXcS3uS6ttaHP8amyvX78",
"balance": 50000,
"tx_count": 3,
"discovery_time": "2024-10-19T14:23:45"
}
],
"success_criteria": {
"target_vulnerables": 10,
"found_vulnerables": 12,
"criteria_met": true
}
}Run unit tests:
cd tests
pytest -vRun with coverage:
pytest --cov=../src --cov-report=htmlRun integration tests (requires internet):
pytest -v -m integrationExpected performance:
- Password generation: 10,000+ per second (dictionary mode)
- Address derivation: 1,000+ per second (pure Python)
- Blockchain checking: 10-100 per second (API rate limited)
- Memory usage: < 1GB RAM
The tool is considered successful if it finds β₯10 vulnerable brain wallet addresses on testnet.
This demonstrates that:
- Brain wallets are actively used (or were used)
- They can be cracked with simple dictionary attacks
- Implementation flaws (weak passphrases) break Bitcoin security today
This tool has multiple layers of safety enforcement:
if config['bitcoin_network'] != 'testnet':
raise ValueError("MAINNET BLOCKED")if not address.startswith(('m', 'n', 'tb1')):
raise ValueError("NOT A TESTNET ADDRESS")def __init__(self, testnet: bool = True):
if not testnet:
raise ValueError("MAINNET GENERATION BLOCKED")# Hardcoded testnet endpoints
self.base_url = "https://blockstream.info/testnet/api"Mainnet operations are impossible - the tool will crash before executing any mainnet operation.
The scanner consists of 5 core components:
-
Password Generator - Generates candidate passphrases using:
- Dictionary attacks (RockYou, etc.)
- Pattern-based generation (word+year, word+123)
- Bitcoin-specific phrases ("satoshi2009", "hodlbitcoin")
- AI generation (optional, Phase 4B)
-
Address Generator - Converts passphrases to Bitcoin addresses:
private_key = SHA256(passphrase)- ECDSA secp256k1 public key generation
- Bitcoin address derivation (P2PKH)
- Testnet-only enforcement
-
Blockchain Checker - Scans Bitcoin testnet blockchain:
- Blockstream.info API (recommended)
- BlockCypher API (alternative)
- Detects transaction history
- Rate limiting & caching
-
Fund Sweeper - (Optional, not implemented in Phase 4A)
- Would transfer found funds to research wallet
- Not needed for academic demonstration
-
Logger & Reporter - Comprehensive logging:
- Real-time progress tracking
- Detailed evidence collection
- JSON report generation
- Statistics tracking
This tool is part of a research project demonstrating that:
Implementation flaws (not quantum computers) are breaking Bitcoin TODAY.
Key insights:
- Brain wallets are fundamentally insecure
- Dictionary attacks work on real-world passphrases
- Users choose predictable passwords
- This is a current, exploitable vulnerability
- β Testnet only - No real funds at risk
- β Educational purpose - Demonstrates security flaws
- β Open source - Transparent research methodology
- β Safety controls - Multiple mainnet prevention layers
Potential improvements:
- AI-based password generation (GPT-2/DistilGPT-2)
- Multi-threading for parallel address generation
- GPU acceleration for address derivation
- Support for P2SH and Bech32 addresses
- Fund sweeping functionality (testnet only)
- Web dashboard for real-time monitoring
Download RockYou or other wordlist to data/wordlists/
Reduce [REDACTED_PRIVATE_KEY] in config or add delays between requests
Check internet connection and API status:
- Blockstream: https://blockstream.info/testnet/
- BlockCypher: https://www.blockcypher.com/dev/bitcoin/
This is expected if scanning random passwords. Try:
- Increase password count
- Use Bitcoin-specific strategy
- Try different wordlists
- Bitcoin Brain Wallets: https://en.bitcoin.it/wiki/Brainwallet
- Brain Wallet Cracking: https://rya.nc/cracking-cryptocurrency-brainwallets.html
- Testnet Faucet: https://testnet-faucet.mempool.co/
MIT License - For academic research only
Security Research Team - Phase 4A Implementation
This tool is for educational and research purposes only. Do not use brain wallets for real funds. The authors are not responsible for any misuse of this software.
Remember: Brain wallets are insecure. Never use them with real Bitcoin.