Pure Python BIP39 mnemonic code library
Project description
bip39lib
Pure Python BIP39 mnemonic code library for generating deterministic wallet seeds.
Install
pip install bip39lib
Usage
from bip39lib import generate_mnemonic, mnemonic_to_seed, validate_mnemonic
# Generate a 12-word mnemonic (128 bits of entropy)
mnemonic = generate_mnemonic()
print(mnemonic) # abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about
# Validate the mnemonic
is_valid = validate_mnemonic(mnemonic)
print(is_valid) # True
# Convert mnemonic to seed (for HD wallet derivation)
seed = mnemonic_to_seed(mnemonic, passphrase="")
print(seed.hex()) # 64-byte seed
API
generate_mnemonic(entropy_bits: int = 128, wordlist: list[str] | None = None) -> str- Generate mnemonic from entropymnemonic_to_seed(mnemonic: str, passphrase: str = "") -> bytes- Convert mnemonic to seedvalidate_mnemonic(mnemonic: str, wordlist: list[str] | None = None) -> bool- Validate mnemonic checksumentropy_to_mnemonic(entropy: bytes, wordlist: list[str] | None = None) -> str- Convert entropy to mnemonicmnemonic_to_entropy(mnemonic: str, wordlist: list[str] | None = None) -> bytes- Convert mnemonic to entropyget_wordlist(lang: str = "en") -> list[str]- Get BIP39 wordlist by language
Development
git clone https://github.com/daedalus/bip39lib.git
cd bip39lib
pip install -e ".[test]"
# run tests
pytest
# format
ruff format src/ tests/
# lint
ruff check src/ tests/
# type check
mypy src/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bip39lib-0.1.0.tar.gz.
File metadata
- Download URL: bip39lib-0.1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47352ad962f42fd7587bc357fe1a98989748dd0e88652c74e3e78c8c5ace0eaf
|
|
| MD5 |
c9b4cfbd19d681eb3d0dad0d94ca1158
|
|
| BLAKE2b-256 |
56d3c7baf0152ab921c0be644498456099b0eb14bc4e612a768435b46d1c13aa
|
Provenance
The following attestation bundles were made for bip39lib-0.1.0.tar.gz:
Publisher:
pypi-publish.yml on daedalus/bip39lib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bip39lib-0.1.0.tar.gz -
Subject digest:
47352ad962f42fd7587bc357fe1a98989748dd0e88652c74e3e78c8c5ace0eaf - Sigstore transparency entry: 1227908620
- Sigstore integration time:
-
Permalink:
daedalus/bip39lib@1c8a2cba0599ae41e7f766a5688198fd102e68ed -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/daedalus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@1c8a2cba0599ae41e7f766a5688198fd102e68ed -
Trigger Event:
release
-
Statement type:
File details
Details for the file bip39lib-0.1.0-py3-none-any.whl.
File metadata
- Download URL: bip39lib-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c002cea3f6d452637b29ce76ff5145a1860304f5bee8569456cf4e48c10fd25
|
|
| MD5 |
f913976ca030cd51a48729f368a55f44
|
|
| BLAKE2b-256 |
10d1851c78480c3cf9cbb490fb184f0878b5d3fc33b9045400e024497b9d8bea
|
Provenance
The following attestation bundles were made for bip39lib-0.1.0-py3-none-any.whl:
Publisher:
pypi-publish.yml on daedalus/bip39lib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bip39lib-0.1.0-py3-none-any.whl -
Subject digest:
3c002cea3f6d452637b29ce76ff5145a1860304f5bee8569456cf4e48c10fd25 - Sigstore transparency entry: 1227908671
- Sigstore integration time:
-
Permalink:
daedalus/bip39lib@1c8a2cba0599ae41e7f766a5688198fd102e68ed -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/daedalus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@1c8a2cba0599ae41e7f766a5688198fd102e68ed -
Trigger Event:
release
-
Statement type: