Skip to content

BIP 39 Mnemonics Reference

By default, Minsc ships with the BIP 39 wordlist for English only. To support other languages, enable the bip39-all-languages feature.

bip39()

bip39(word_count: Int = 12) -> String

Generate a random BIP 39 mnemonic phrase.

Shorthand for bip39::rand() when called with no arguments or an integer argument.

bip39(mnemonic: String, network: Network = testnet, passphrase: String = "") -> SecKey<Xpriv>

Convert the mnemonic into an Xpriv.

Shorthand for bip39::to_xpriv() when the first argument is a string.

Note: bip39() assumes the English wordlist. Use bip39::rand()/bip39::to_xpriv() directly for other languages.

bip39::rand()

bip39::rand(word_count: Int = 12, language: String = "english") -> String

Generate a random BIP 39 mnemonic phrase.

word_count must be one of 12 (the default), 15, 18, 21 or 24.

For example:

"long amount wheel reduce shadow candy round cruise judge dog beach label"

Also possible using bip39().

bip39::to_seed()

bip39::to_seed(mnemonic: String, passphrase: String = "", language: String = "english") -> Bytes<64>

Convert the mnemonic into a 512-bit seed.

For example:

>>> bip39::to_seed("pill canvas solve muscle orchard brave miracle liberty vehicle broccoli canal above")
0xc95bab31d1be0c482e04ffe856c82e2a3df5f5d981d7764bd124b4b82df55557d9958303a517017ddb9b12b2a4f3228c43789bc0c3e949e21db4dc08fb6299c8

bip39::to_xpriv()

bip39::to_xpriv(mnemonic: String, network: Network = testnet, passphrase: String = "", language: String = "english") -> SecKey<Xpriv>

Convert the mnemonic into a seed, then convert the seed into an Xpriv.

For example:

>>> bip39::to_xpriv("pill canvas solve muscle orchard brave miracle liberty vehicle broccoli canal above")
tprv8ZgxMBicQKsPfEwe5imujQ5xDg4mG563pLJ9xQjS3ieeKcHgLxpvRePVmECQ3CJMDkE8uSytUwx78XWCionEFLoL1nWzjnNsp9oKeAU4pnL

Aliased as xpriv::from_mnemonic() and also possible using bip39().

bip39::to_entropy()

bip39::to_entropy(mnemonic: String, language: String = "english") -> Bytes

Convert the mnemonic back to the entropy used to generate it.

For example:

>>> bip39::to_entropy("pill canvas solve muscle orchard brave miracle liberty vehicle broccoli canal above")
0xa4c4373bc8c9c036a35c07f1e38c8400

bip39::from_entropy()

bip39::from_entropy(entropy: Bytes, language: String = "english") -> String

Create the mnemonic phrase from the given entropy.

Entropy must be a multiple of 32 bits (4 bytes) and 128-256 bits in length.

For example:

>>> bip39::from_entropy(0xa4c4373bc8c9c036a35c07f1e38c8400)
"pill canvas solve muscle orchard brave miracle liberty vehicle broccoli canal above"