A CLI tool for reconstructing full private keys from split-key vanity generation. This tool combines your existing private key with a partial private key generated by vanity search tools to create a functional vanity address.
This tool implements the key reconstruction algorithm used in split-key vanity address generation. It takes:
- Your existing private key (read securely from stdin)
- A vanity prefix and partial private key
- Reconstructs the full private key for the vanity address
cargo install nostr-key-merge
cargo build --release
nix run github:PortalTechnologiesInc/nostr-key-merge
If you installed via crates.io or Nix:
nostr-key-merge --prefix <vanity_prefix> --partialpriv <partial_private_key>
If you built from source:
cargo run -- --prefix <vanity_prefix> --partialpriv <partial_private_key>
-p, --prefix
: Vanity prefix to match (e.g., "test" for npub1test...) - Required-s, --partialpriv
: Partial private key from vanity generation - Required
Note: Your private key is read from stdin for security (not stored in command history)
# Reconstruct a vanity key for prefix "test"
nostr-key-merge \
--prefix npub1test \
--partialpriv L4C9a6zWJa9pD2xT3DY3qQEpuyNakevJhwxqKoZNcDSWALk6tKTh
# You'll be prompted to enter your private key:
# Enter your private key (hex, WIF, or nsec format):
# nsec1abc123def456...
- Hex:
a1b2c3d4e5f6...
(64 character hex string) - WIF:
5KJvsngHeMpm884wtkJNzQGaCErckhHJBGFsvd3VyK5qMZXj3hS
(Bitcoin WIF format) - Nsec:
nsec1abc123...
(Nostr bech32 format)
Enter your private key (hex, WIF, or nsec format):
nsec1abc123def456...
Successfully reconstructed key for prefix: test
Public Key (npub): npub1testxxx...
Private Key (hex): a1b2c3d4e5f6789abcdef0123456789abcdef0123456789abcdef0123456789a
Private Key (nsec): nsec1abc123def456789abcdef0123456789abcdef0123456789abcdef0123456
Public Key (hex): 02abc123def456789...
- Stdin input: Private keys are read from stdin, not command-line arguments
- No command history: Your private key won't appear in shell history
- Memory safety: Rust's memory management helps prevent key leakage
- Multiple formats: Supports secure key formats (nsec, WIF, hex)
The tool implements the same reconstruction algorithm as VanitySearch's split-key functionality:
- Securely read your private key from stdin
- Generate target prefix pattern (npub1 + your prefix)
- Try different combinations using elliptic curve operations:
- No symmetry, no endomorphism
- No symmetry, endomorphism λ
- No symmetry, endomorphism λ²
- Symmetry, no endomorphism
- Symmetry, endomorphism λ
- Symmetry, endomorphism λ²
- Verify reconstruction by checking if the generated public key matches the prefix pattern
- Request vanity key from the bot:
npub1test
- Bot replies publicly with:
Public Key: npub1testxxx... Partial Private Key: L4C9a6zWJa9pD2xT3DY3qQEpuyNakevJhwxqKoZNcDSWALk6tKTh
- Reconstruct using this tool:
nostr-key-merge --prefix test --partialpriv L4C9a6zWJa9pD2xT3DY3qQEpuyNakevJhwxqKoZNcDSWALk6tKTh
- Use the reconstructed nsec in your Nostr client
- Keep your private keys secure: Never share your main private key
- Use stdin input: Prevents keys from appearing in command history
- Verify results: Always test reconstructed keys in a safe environment first
- Clean up: Clear terminal history after use if needed
- Backup important keys: Store reconstructed keys securely
secp256k1
: Elliptic curve operationsbitcoin
: Base58 and WIF key handlingnostr
: Nostr key format support (nsec/npub encoding/decoding)clap
: Command-line parsinganyhow
: Error handling