The `mnemonic` library is a Python implementation of Bitcoin Improvement Proposal (BIP-0039). It provides functionality to generate mnemonic phrases (seed phrases), convert them into binary seeds for deterministic wallets, and validate existing mnemonic phrases. The current version is 0.21, released in January 2024, and it requires Python 3.8.1 or newer. The library primarily follows a stable release cadence as needed for updates to BIP-0039 or Python compatibility.
pip install mnemonicVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the `Mnemonic` class, generate a cryptographically secure mnemonic phrase, validate it, and convert it into a deterministic seed, which is crucial for hierarchical deterministic (HD) wallets.
Upgrade to Python 3.8.1+ and `mnemonic` 0.20+.
Always explicitly specify the language (e.g., `Mnemonic("english")`) to ensure consistent behavior across versions.Implement robust passphrase management, advising users to provide strong, unique passphrases, or understand the security implications of an empty passphrase.
Always specify `strength` with a cryptographically sufficient value like 256 (for 24 words) when generating new mnemonics.
For custom wordlists, use the new functionality in v0.21+. For standard wordlists, rely on the `Mnemonic(language)` constructor.
Run `pip install mnemonic` in your terminal to install the library.
Carefully check the mnemonic phrase for any typos, ensure all words are lowercase, verify the exact word count, and confirm that all words belong to the BIP-39 English wordlist (or the specified language wordlist).
Ensure the byte string passed as entropy has one of the supported lengths: 16, 20, 24, 28, or 32 bytes.
No dependency data recorded yet.