| Crates.io | kangaroo |
| lib.rs | kangaroo |
| version | 0.5.0 |
| created_at | 2025-12-12 16:28:09.755872+00 |
| updated_at | 2026-01-16 19:57:31.558512+00 |
| description | Pollard's Kangaroo ECDLP solver for secp256k1 using Vulkan/Metal/DX12 compute |
| homepage | |
| repository | https://github.com/oritwoen/kangaroo |
| max_upload_size | |
| id | 1981809 |
| size | 266,787 |
GPU-accelerated Pollard's Kangaroo algorithm for solving the Elliptic Curve Discrete Logarithm Problem (ECDLP) on secp256k1.
Most existing Kangaroo implementations (JeanLucPons/Kangaroo, RCKangaroo, etc.) only support NVIDIA GPUs via CUDA. This implementation uses WebGPU/wgpu which provides cross-platform GPU compute through Vulkan, Metal, and DX12.
paru -S kangaroo
cargo install kangaroo
git clone https://github.com/oritwoen/kangaroo
cd kangaroo
cargo build --release
cargo build --release --features boha
kangaroo --pubkey <PUBKEY> --start <START> --range <BITS>
| Argument | Default | Description |
|---|---|---|
-t, --target |
- | Data provider target (e.g., boha:b1000/135) |
-p, --pubkey |
- | Target public key (compressed hex, 33 bytes) |
-s, --start |
0 | Start of search range (hex, without 0x prefix) |
-r, --range |
32 | Search range in bits (key is in [start, start + 2^range]) |
-d, --dp-bits |
auto | Distinguished point bits |
-k, --kangaroos |
auto | Number of parallel kangaroos |
--gpu |
0 | GPU device index |
-o, --output |
- | Output file for result |
-q, --quiet |
false | Minimal output, just print found key |
--max-ops |
0 | Max operations (0 = unlimited) |
--cpu |
false | Use CPU solver instead of GPU |
--json |
false | Output benchmark results in JSON format |
--list-providers |
false | List available puzzles from providers |
Either --target or --pubkey is required.
Using data provider (boha):
# Solve puzzle using boha data (auto: pubkey, start, range)
kangaroo --target boha:b1000/66
# Override range (search smaller subset)
kangaroo --target boha:b1000/66 --range 60
# List available puzzles
kangaroo --list-providers
Manual parameters:
kangaroo \
--pubkey 03a2efa402fd5268400c77c20e574ba86409ededee7c4020e4b9f0edbee53de0d4 \
--start 8000000000 \
--range 40
The Pollard's Kangaroo algorithm solves the discrete logarithm problem in O(√n) time where n is the search range. It works by:
Distinguished Points (DP) optimization: Instead of storing all visited points, we only store points whose x-coordinate has a specific number of leading zero bits. This dramatically reduces memory usage while still allowing collision detection.
Expected operations: ~2^(range_bits/2)
Run kangaroo --benchmark to test your hardware. See BENCHMARKS.md for results on various GPUs.
| Use Case | Example |
|---|---|
| Partial key decoded | Puzzle gives ~240 bits, need to find remaining ~16 |
| Key in known range | Know key is between X and Y |
| Verify near-solution | Have candidate, search ±N bits around it |
NOT useful for:
use kangaroo::{KangarooSolver, GpuContext, parse_pubkey, parse_hex_u256, verify_key};
fn main() -> anyhow::Result<()> {
let pubkey = parse_pubkey("03...")?;
let start = parse_hex_u256("8000000000")?;
let ctx = pollster::block_on(GpuContext::new(0))?;
let mut solver = KangarooSolver::new(
ctx,
pubkey.clone(),
start,
40, // range_bits
12, // dp_bits
1024, // num_kangaroos
)?;
loop {
if let Some(key) = solver.step()? {
if verify_key(&key, &pubkey) {
println!("Found: {}", hex::encode(&key));
break;
}
}
}
Ok(())
}
Kangaroo supports external data providers for puzzle sources. Providers supply pubkey, key range, and other puzzle metadata.
boha provides crypto puzzle data including Bitcoin Puzzle Transaction (b1000).
Build with boha support:
cargo build --release --features boha
Usage:
# Solve specific puzzle
kangaroo --target boha:b1000/66
# List solvable puzzles (unsolved with known pubkey)
kangaroo --list-providers
Provider validates range overrides - you cannot search outside the puzzle's key range.
src/
├── main.rs # CLI entry point
├── lib.rs # Library entry + Args + run()
├── solver.rs # GPU solver coordination
├── cli.rs # CLI utilities (tracing, progress bar)
├── provider/
│ ├── mod.rs # Provider system interface
│ └── boha.rs # boha provider (feature-gated)
├── cpu/
│ ├── cpu_solver.rs # Pure CPU solver (testing/comparison)
│ ├── dp_table.rs # Distinguished Points collision detection
│ └── init.rs # Kangaroo initialization + jump tables
├── crypto/
│ └── mod.rs # k256/secp256k1 wrappers
├── gpu/
│ ├── pipeline.rs # Compute pipeline setup
│ └── buffers.rs # GPU buffer management
├── gpu_crypto/
│ ├── context.rs # GPU context abstraction
│ └── shaders/ # WGSL shader library
│ ├── field.wgsl # secp256k1 field arithmetic
│ └── curve.wgsl # Jacobian point operations
└── shaders/
└── kangaroo_affine.wgsl # Main Kangaroo compute shader
MIT License - see LICENSE for details.