Skip to main content

Implementation of Bitcoin BIP-0039

Project description

python-mnemonic

https://badge.fury.io/py/mnemonic.svg

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

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.20 - 2021-07-27

Added

  • Type annotations

  • Support for testnet private keys

Changed

  • Project directory structure was cleaned up

  • Language on the Mnemonic object 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mnemonic-0.20.tar.gz (67.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mnemonic-0.20-py3-none-any.whl (62.0 kB view details)

Uploaded Python 3

File details

Details for the file mnemonic-0.20.tar.gz.

File metadata

  • Download URL: mnemonic-0.20.tar.gz
  • Upload date:
  • Size: 67.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.10

File hashes

Hashes for mnemonic-0.20.tar.gz
Algorithm Hash digest
SHA256 7c6fb5639d779388027a77944680aee4870f0fcd09b1e42a5525ee2ce4c625f6
MD5 6846906ee827d43cbf1d7bba648e35b3
BLAKE2b-256 f88dd4dc2b2bddfeb57cab4404a41749b577f578f71140ab754da9afa8f5c599

See more details on using hashes here.

File details

Details for the file mnemonic-0.20-py3-none-any.whl.

File metadata

  • Download URL: mnemonic-0.20-py3-none-any.whl
  • Upload date:
  • Size: 62.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.10

File hashes

Hashes for mnemonic-0.20-py3-none-any.whl
Algorithm Hash digest
SHA256 acd2168872d0379e7a10873bb3e12bf6c91b35de758135c4fbd1015ef18fafc5
MD5 0333136a3f4488e90f028ec5291d0c14
BLAKE2b-256 ae953e07c33ffb26f5823b45a1c30db8acea44763198c2bd393e07e884f3295f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page