KeyForge is a simple command-line tool written in Go for generating BIP32 master keys (xprv and xpub) from either:
- a secure random seed (64 bytes), or
- a BIP39 mnemonic phrase (24 words)
This project is educational and meant to help developers understand how hierarchical deterministic wallets work at the base level.
- 🔐 Generate a secure 64-byte seed
- 🧠 Generate a 24-word BIP39 mnemonic (optional)
- 🧬 Derive BIP32 master keys (
xprvandxpub) - 🛠️ Compatible with Bitcoin Mainnet
Make sure you have Go installed (go1.20 or newer).
Clone the repo and install dependencies:
git clone https://github.com/caarloshenriq/keyforge.git
cd keyforge
go mod tidygo run .This will:
- Generate 24-word mnemonic (BIP39)
- Derive seed from it
- Derive BIP32 master key (
xprv) and its public version (xpub)
go run . --mnemonic=falseThis will:
- Generate a 64-byte random seed
- Derive BIP32 master key from it
keyforge/
├── main.go # Entry point with CLI logic
├── bip39.go # Handles mnemonic and seed generation
├── bip32.go # Handles xprv/xpub derivation
├── network.go # Defines Bitcoin MainNet key prefixes
├── go.mod- BIP32 – HD wallet key derivation
- BIP39 – Mnemonic generation
- Uses
hdkeychain/v3(Decred fork) for robust BIP32 support
🔐 Generated Mnemonic:
banana sport nominee harbor foster bulb ...
🧬 Generated Seed (hex):
54d2f1c3f7...
🔑 xprv:
xprv9s21ZrQ...
🔓 xpub:
xpub661MyMw...This tool is for educational and development purposes only. Do not use the generated keys to store real funds without proper auditing and secure entropy sources.
MIT License