python-mnemonic
Reference implementation of BIP-0039: Mnemonic code for generating deterministic keys
Abstract
This BIP describes the implementation of a mnemonic code or mnemonic sentence – a group of easy to remember words – for the generation of deterministic wallets.
It consists of two parts: generating the mnenomic, and converting it into a binary seed. This seed can be later used to generate deterministic wallets using BIP-0032 or similar methods.
BIP Paper
See https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki for full specification
Installation
To install this library and its dependencies use:
pip install mnemonic
Usage examples
Import library into python project via:
from mnemonic import Mnemonic
Initialize class instance, picking from available dictionaries:
english
chinese_simplified
chinese_traditional
french
italian
japanese
korean
spanish
turkish
czech
portuguese
mnemo = Mnemonic(language)
mnemo = Mnemonic("english")
Generate word list given the strength (128 - 256):
words = mnemo.generate(strength=256)
Given the word list and custom passphrase (empty in example), generate seed:
seed = mnemo.to_seed(words, passphrase="")
Given the word list, calculate original entropy:
entropy = mnemo.to_entropy(words)
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
0.21 - 2024-01-05
Added
Czech and Portuguese wordlists
Option to provide custom list of words instead of loading from built-in file
Changed
Use
secretsmodule for randomnessUse English as a default language if none is provided
Language detection is unambiguous even if some words are ambiguous
Build system switched to Poetry
Removed
Support for Python below 3.8 was dropped
0.20 - 2021-07-27
Added
Type annotations
Support for testnet private keys
Changed
Project directory structure was cleaned up
Language on the
Mnemonicobject is remembered instead of repeatedly detecting
Removed
Support for Python 2.7 and 3.4 was dropped
0.19 - 2019-10-01
Added
Start of changelog
Metadata
Release files for mnemonic 0.21
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mnemonic-0.21.tar.gz | 152.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mnemonic-0.21-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 245.2 kB
Release files / mnemonic-0.21.tar.gz
| Download URL | mnemonic-0.21.tar.gz |
|---|---|
| Size | 152.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1fe496356820984f45559b1540c80ff10de448368929b9c60a2b55744cc88acf
|
|
BLAKE2b-256 checksum How to use checksums |
ff77e6232ed59fbd7b90208bb8d4f89ed5aabcf30a524bc2fb8f0dafbe8e7df9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.12 Linux/6.0.19-060019-generic
|
Release files / mnemonic-0.21-py3-none-any.whl
| Download URL | mnemonic-0.21-py3-none-any.whl |
|---|---|
| Size | 92.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
72dc9de16ec5ef47287237b9b6943da11647a03fe7cf1f139fc3d7c4a7439288
|
|
BLAKE2b-256 checksum How to use checksums |
57485abb16ce7f9d97b728e6b97c704ceaa614362e0847651f379ed0511942a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.12 Linux/6.0.19-060019-generic
|
Security for mnemonic 0.21
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.