bip39
Generate new or validate existing BIP-39 mnemonics, and convert them to 64-byte seeds for BIP-32 key derivation.
Instructions
Generate, validate, or convert a BIP-39 mnemonic to a seed.
action=generate -> {action, mnemonic, word_count, strength}. With entropy the
mnemonic is deterministic; without it, fresh CSPRNG entropy of strength bits.
action=validate -> {action, valid, word_count} plus a reason when invalid — a
bad mnemonic is a soft result, not an error (§2.0.5).
action=to_seed -> {action, seed, word_count}: the 64-byte seed as 0x-hex, ready
for bip32_derive. PBKDF2-HMAC-SHA512(mnemonic, "mnemonic"+passphrase, 2048).
An invalid mnemonic raises here; use action=validate to inspect it first.
Neither the mnemonic, the entropy, nor the passphrase is ever echoed back.
Example: bip39("to_seed", mnemonic="abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about") -> seed="0x5eb00bbd..."
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | 'generate' builds a mnemonic (from `entropy`, or fresh CSPRNG entropy of `strength` bits); 'validate' checks a mnemonic's wordlist membership and checksum; 'to_seed' derives the 64-byte BIP-32 seed from a mnemonic and optional `passphrase`. | |
| entropy | No | Entropy as hex (0x optional) for action=generate: 16, 20, 24, 28, or 32 bytes, giving 12..24 words. Omit to draw fresh CSPRNG entropy of `strength` bits. Never echoed back. | |
| mnemonic | No | The mnemonic sentence (required for validate/to_seed). Casing and extra whitespace are forgiven; it is never echoed back. | |
| strength | No | Entropy bits for action=generate when `entropy` is omitted (128 -> 12 words, 256 -> 24 words). Ignored when `entropy` is given. | |
| passphrase | No | The optional BIP-39 passphrase (the "25th word") for action=to_seed. Any passphrase is valid and yields a DIFFERENT seed, so a wrong one silently opens a different wallet. Never echoed back. |