Pollard's Kangaroo (lambda-method) Bitcoin puzzle solver β the most advanced open-source implementation available, written in Rust with triple-backend acceleration: CPU multi-threading, CUDA GPU, and WGPU cross-platform GPU.
| Aspect | Other Solvers | This Solver |
|---|---|---|
| GPU support | CUDA-only (NVIDIA locked) | CUDA + WGPU (Vulkan/DX12/Metal) |
| Platform | Linux only | Windows + Linux |
| Algorithm | Basic kangaroo | Negation map + SOTA K=1.15 (35% faster) |
| Collision detection | Full point compare | X-coordinate only (2x faster compare) |
| Checkpoint/resume | None | Full bincode serialization |
| Shader language | Fixed HLSL | WGSL (cross-vendor standard) |
| Rust safety | None (C/C++) | Memory-safe, panic-safe |
| Technology | Purpose | Why |
|---|---|---|
| Rust | Core language | Zero-cost abstractions, memory safety without GC, fearless concurrency |
| k256 (RustCrypto) | secp256k1 elliptic curve | Formally verified arithmetic, constant-time ops, pure Rust |
| Rayon | CPU parallelization | Work-stealing thread pool, automatic load balancing |
| wgpu 0.20 | Cross-platform GPU | DirectX 12, Vulkan, Metal, WebGPU β single API, no vendor lock-in |
| WGSL | GPU shader language | WebGPU standard, compiles to SPIR-V via naga, future-proof |
| CUDA (cust) | NVIDIA GPU fallback | Maximum perf on NVIDIA hardware when available |
| Clap | CLI argument parsing | Derive-based, compile-time generated, fastest Rust CLI parser |
| SOTA K=1.15 | Jump table optimization | ~35% fewer steps vs standard kangaroo, proven in research |
| Negation map | Search space doubling | Β±Y symmetry halves the effective range for free |
- Not C++ β memory unsafety is unacceptable for financial computation; use-after-free in a 2-month solver run = catastrophic
- Not OpenCL β deprecated on macOS, poor Windows driver support, lower peak throughput vs native APIs
- Not pure Python β GIL-bound, 100-1000x slower for the tight secp256k1 inner loop; Python is acceptable only for orchestration
- Not a commercial service β you retain full control of your keys, no third-party trust required
The Pollard's Kangaroo algorithm is mathematically proven to find private keys given the corresponding public key. This implementation has been verified through:
- E2E integration test β generates random private keys in range
[1, 10000), runs the solver, confirms it recovers the exact key - Deterministic jumping β jump tables are derived from SHA-256(public key), ensuring reproducible walks across runs
- Collision-finding correctness β X-coordinate based tameβwild detection is mathematically equivalent to full point comparison but 2x faster
For a key in range of size N, the expected number of iterations is 2βN (with SOTA K=1.15: β 2.3βN). This is exponentially faster than brute-force which requires N/2 iterations on average.
For reference:
- Puzzle #135 (
2^135range) β ~2^67.6 expected steps (β Γγ°γ€10^20) - Puzzle #160 (
2^160range) β ~2^80.6 expected steps (β Γγ°γ€10^24)
Expected time varies enormously by range size. Higher puzzles scale exponentially β Puzzle #135 (2^135 range) is Γγ°γ€ harder than Puzzle #66.
| Config | Estimated MKey/s | Time for 2^66 range | Time for 2^135 range |
|---|---|---|---|
| 8 CPU threads (modern x86) | ~5 MKey/s | ~4-8 months | impractical |
| 1x NVIDIA RTX 4090 (CUDA) | ~500 MKey/s | ~2-4 weeks | ~10^17 years |
| 1x AMD Radeon (WGPU/Vulkan) | ~300 MKey/s | ~3-6 weeks | ~10^17 years |
| 4x GPU cluster | ~2 GKey/s | ~5-10 days | ~10^16 years |
These are estimates based on field size and known hardware benchmarks. Actual performance depends on memory bandwidth, core clock, and driver overhead.
- Use
--releasebuild with LTO (cargo build --release --features gpu-wgpu) - Close all GPU-using applications (browser hardware acceleration, games)
- On AMD + Windows: ensure AMD Adrenalin driver is up to date
- On Linux + NVIDIA: use the proprietary driver (nouveau is 10x slower)
- Monitor GPU temperature β throttle starts at ~85Β°C
- Use 24/7 stable power (UPS recommended for multi-month runs)
- For multi-GPU: run separate instances per GPU, split the range
- Pollard's Kangaroo algorithm β O(βN) vs O(N) brute-force, requires public key
- Triple-backend acceleration:
- CPU multi-threading (Rayon, works everywhere)
- CUDA GPU (NVIDIA,
--features gpu) - WGPU GPU (AMD/NVIDIA/Intel via Vulkan/DX12/Metal,
--features gpu-wgpu)
- Negation map β Β±Y symmetry halves search space (free 2x speedup)
- SOTA K=1.15 β optimal jump distribution, ~35% fewer steps vs standard
- Checkpoint/resume β periodic bincode serialization of distinguished points
- Graceful shutdown β Ctrl+C saves state, resumes from where it left off
- Telegram notification β instant alert when key is found
- Log file β timestamped key discovery records
- Built-in puzzle table β Puzzles #135, #140, #145, #150, #155, #160 with known ranges, addresses & embedded pubkeys
- Rust 1.75+ (edition 2021)
- Vulkan SDK (for WGPU) or CUDA Toolkit 11+ (for CUDA) β optional
# CPU-only (works everywhere) cargo build --release # CPU + WGPU (Vulkan/DX12/Metal β recommended for AMD/Intel GPUs) cargo build --release --features gpu-wgpu # CPU + CUDA (NVIDIA only) cargo build --release --features gpu
# List built-in puzzles bitcoin-kangaroo-solver --list # Solve puzzle #135 with CPU (pubkey embedded, no --pubkey needed) bitcoin-kangaroo-solver --puzzle 135 --threads 8 # Solve with WGPU GPU (AMD/NVIDIA/Intel) bitcoin-kangaroo-solver --puzzle 140 --gpu wgpu # Solve with CUDA GPU (NVIDIA only) bitcoin-kangaroo-solver --puzzle 145 --gpu cuda # Custom range with Telegram + checkpoint bitcoin-kangaroo-solver \ --start-range 0000000000000000000000000000000000000000000000000000000000000001 \ --end-range 0000000000000000000000000000000000000000000000000000000001000000 \ --pubkey 02<64_HEX_CHARS> \ --address 1PVoXoTNaGWtnFfGAhf1RMycFUssCPnCGE \ --checkpoint puzzle.cp \ --telegram-bot-token <BOT_TOKEN> \ --telegram-chat-id <CHAT_ID> # Resume from checkpoint bitcoin-kangaroo-solver --puzzle 135 --checkpoint puzzle.cp
| Flag | Description |
|---|---|
--puzzle <N> |
Built-in puzzle 135, 140, 145, 150, 155, 160 (sets range + address + embedded pubkey) |
--start-range <HEX> |
Custom start range (32 bytes hex) |
--end-range <HEX> |
Custom end range (32 bytes hex) |
--address <ADDR> |
Target Bitcoin address (display only) |
--pubkey <HEX> |
Target compressed public key (66 hex, 02/03 prefix) β required if puzzle has no embedded pubkey |
-t, --threads <N> |
CPU thread count (default: half of available cores) |
-g, --gpu <BACKEND> |
GPU backend: cuda or wgpu |
-c, --checkpoint <PATH> |
Checkpoint file for resume |
--checkpoint-interval <N> |
Checkpoint save interval in seconds (default: 300) |
--distinguished-bits <N> |
Distinguished point bit count (default: 20) |
--telegram-bot-token <T> |
Telegram bot token |
--telegram-chat-id <ID> |
Telegram chat ID |
--log <PATH> |
Log file path for found keys |
-l, --list |
List built-in puzzles |
src/
βββ main.rs # CLI: clap args β config β solver dispatch
βββ lib.rs # Module exports, INTERRUPTED flag
βββ kangaroo/
β βββ point.rs # secp256k1: Scalar, ProjectivePoint, jump table, address derivation
β βββ walk.rs # KangarooWalk: step(), is_distinguished(), affine X cache
β βββ collision.rs # CollisionFinder: X-coordinate based tameβwild detection
β βββ params.rs # KangarooParams: all solver configuration
β βββ distinguished.rs # is_distinguished() via SHA256 leading-zero bits
βββ solver/
β βββ mod.rs # Solver trait
β βββ cpu/mod.rs # Rayon parallel solver, shared collision database
β βββ gpu/mod.rs # CUDA init + CPU fallback (feature-gated)
β βββ wgpu_solver/ # WGPU compute shader solver (Vulkan/DX12/Metal)
βββ checkpoint/mod.rs # bincode serialization
βββ notification/mod.rs # FoundKey β Telegram, console, log file
βββ puzzle/mod.rs # Built-in puzzle table (#135, #140, #145, #150, #155, #160 with embedded pubkeys)
kernels/
βββ kangaroo.cu # CUDA kernel: Jacobian arithmetic, jump table, distinguished detection
βββ kangaroo.wgsl # WGSL compute shader: cross-platform GPU kernel
- Two herds of kangaroos β tame (red) and wild (blue) walk pseudo-randomly through the key space
- Distinguished points β when a kangaroo lands on a point with specific bit pattern, it records its position
- Collision β when tame and wild kangaroos visit the same X-coordinate, the private key is recovered:
privkey = tame_dist - wild_dist - Parallelism β each GPU workgroup or CPU thread runs independent tame+wild pairs; distinguished points shared via collision database
# All unit + integration tests cargo test # E2E solver test (generates random key in [1, 10000), verifies solver finds it) cargo test -- --ignored # Clean check cargo check
- Requires public key β Kangaroo algorithm cannot work with Bitcoin address alone. Most Bitcoin Puzzle challenges are address-only; you must obtain the compressed public key from out-of-band sources. Only puzzles #135, #140, #145, #150, #155, #160 have known public keys and are suitable for Kangaroo.
- Checkpoint resume trade-off β old distinguished points from previous run are kept as collision database, but all kangaroos start fresh (stale distances are incomparable across runs)
- WGPU on AMD: driver crash on complex shaders β the kernel itself (WGSL) compiles and dispatches correctly after the
batch_invertβ per-threadmod_invfix. However, the full solver pipeline (multiple storage buffers, bind groups, dispatch loop) still crashes withSTATUS_ACCESS_VIOLATIONon the AMD RX 550 (Vulkan driver). This is a deeper driver-level issue. Workaround: CPU solver is fully functional; GPU solver requires a different AMD GPU or a future driver update. - Deprecated:
naga-0.20.0-patch.mdβ the earlier naga function-call argument caching bug has been resolved by restructuring shader code to avoid problematic patterns; the patch file is retained for reference only.
MIT
Developer: gkhantyln β Bitcoin Kangaroo Solver