Skip to content

andrzejSulkowski/btc-cracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BTC Cracker: A Demo BIP39 Brute-Force CLI in Rust

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.

Features

  1. BIP39 Mnemonic Generation
    • Converts a big-integer counter (attempts) into a 32-byte entropy, producing a 24-word BIP39 mnemonic.
  2. 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.
  3. Progress Display
    • Uses indicatif to show a spinner and regularly update the total attempts and attempt rate.
    • Uses console for console styling and emoji support.
  4. Command-Line Interface
    • Uses clap to parse a --address parameter from the user.

How It Works

  1. Setup
    • The code reads a --address parameter (or -a) from the command line.
    • Creates a BtcWalletCracker with that address.
  2. Brute-Force Loop
    • Starts at 0, counting upward in BigUint (up to 2^{256}-1). • For each value of “attempts,” it:
    1. Creates a 32-byte entropy array from that counter.
    2. Builds a BIP39 mnemonic.
    3. Derives addresses for indices 0..24 at path m/84'/0'/0'/0/.
    4. Compares each address to the target address.
  3. Progress Updates
    • Every chunk_size attempts (default 100), it displays how many seeds have been checked and the approximate seeds per second.
  4. 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).

Usage

  1. Clone & Build
git clone https://github.com/yourusername/btc-cracker-demo.git
cd btc-cracker
cargo build --release
  1. 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).

Limitations / Warnings

  1. Not Feasible
  • 2^{256} possible 24-word seeds is beyond any realistic computation. This code demonstrates structure and libraries, not a workable brute force.
  1. 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.
  1. Educational Use
  • This tool is provided as a learning resource for Rust, BIP39, and address derivation.

About

Brute-Force Bitcoin Wallets (BIP39)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages