Vanity stealth key grinder for ERC-5564 stealth addresses. Brute-forces secp256k1 key generation until the compressed public key's X coordinate starts with your chosen hex prefix.
Uses Web Workers in browsers for parallel grinding. Falls back to a single-threaded loop in Node.js.
npm install nahualli @noble/curves@noble/curves is a peer dependency.
import { createGrindingSession } from "nahualli";
const session = createGrindingSession({ pattern: "dead" });
session.subscribe((state) => {
if (state.status === "running") {
console.log(`${state.totalAttempts} attempts, ${state.attemptsPerSecond | 0} keys/s`);
}
if (state.status === "found") {
console.log(`match: ${state.result.spendingKey.publicKeyHex}`);
}
});
await session.start();
const { result } = session.getState();
// result.spendingKey -- vanity-matched key pair
// result.viewingKey -- independent random key pairimport { estimateGrindTime } from "nahualli";
const est = estimateGrindTime(4); // 4 hex chars
// { expectedAttempts: 65536, expectedSeconds: 1.6, difficulty: "seconds" }import { generateRandomKeys } from "nahualli";
const keys = generateRandomKeys();
// keys.spendingKey, keys.viewingKey| Option | Type | Default | Description |
|---|---|---|---|
pattern |
string |
-- | Hex prefix to match (with or without 0x) |
workers |
number |
navigator.hardwareConcurrency or 4 |
Worker thread count |
Returns a GrindingSession:
start()-- begins grinding, resolves when a match is found or the session is stoppedstop()-- signals all workers to stopgetState()-- returns currentGrindingSessionStatesubscribe(listener)-- observe state changes, returns an unsubscribe function
Returns { expectedAttempts, expectedSeconds, difficulty } where difficulty is "instant", "seconds", "minutes", "hours", or "impractical".
Returns a spending/viewing key pair with no vanity matching.
Each hex character multiplies the search space by 16x.
| Prefix length | Expected attempts | Time (4 workers) |
|---|---|---|
| 1 | 16 | instant |
| 2 | 256 | instant |
| 3 | 4,096 | instant |
| 4 | 65,536 | ~2s |
| 5 | 1,048,576 | ~26s |
| 6 | 16,777,216 | ~7min |
| 7 | 268,435,456 | ~2hr |
| 8+ | 4,294,967,296+ | impractical |
- erc-xochi-zkp -- ZK compliance proofs for stealth transactions
- ERC-5564 -- stealth addresses
- ERC-6538 -- stealth meta-address registry
MIT