This repository demonstrates a theoretical brute-force approach to finding a BIP39 mnemonic that corresponds to a given Bitcoin address. It is intended for educational and illustrative purposes only.
Important
- This code is not meant to be a practical tool for recovering lost mnemonics or hacking addresses.
- BIP39 Mnemonic Generation
- Converts a big-integer counter (attempts) into a 32-byte entropy, producing a 24-word BIP39 mnemonic.
- Address Derivation (BIP84)
- For each generated mnemonic, the code derives 24 addresses at path m/84'/0'/0'/0/i and checks if any match the target address.
- Progress Display
- Command-Line Interface
- Uses clap to parse a --address parameter from the user.
- Setup
- The code reads a --address parameter (or -a) from the command line.
- Creates a BtcWalletCracker with that address.
- Brute-Force Loop
- Starts at 0, counting upward in BigUint (up to 2^{256}-1). • For each value of “attempts,” it:
- Creates a 32-byte entropy array from that counter.
- Builds a BIP39 mnemonic.
- Derives addresses for indices 0..24 at path m/84'/0'/0'/0/.
- Compares each address to the target address.
- Progress Updates
- Every chunk_size attempts (default 100), it displays how many seeds have been checked and the approximate seeds per second.
- Early Termination
- The loop terminates if a match is found or if it exhausts the entire space (which is practically impossible) or you stop the program manually (ctrl + c).
- Clone & Build
git clone https://github.com/yourusername/btc-cracker-demo.git
cd btc-cracker
cargo build --release
- Run
./target/release/btc-wallet-cracker --address 34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo
Note: The code is set to run forever until it finds a match or enumerates the entire space. You can stop it early (e.g., pressing Ctrl + C).
- Not Feasible
- 2^{256} possible 24-word seeds is beyond any realistic computation. This code demonstrates structure and libraries, not a workable brute force.
- Address Type
- Currently checks BIP84 (native SegWit) paths only. If your address is a legacy (1xxx...) or P2SH (3xxx...) address, the derived addresses might never match. Adjust the derivation path accordingly if needed.
- Educational Use
- This tool is provided as a learning resource for Rust, BIP39, and address derivation.