Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

bip39lib

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bip39lib

Pure Python BIP39 mnemonic code library

pipPyPI
Version
0.1.0
Weekly downloads
50
Maintainers
1

bip39lib

Pure Python BIP39 mnemonic code library for generating deterministic wallet seeds.

PyPI Python

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 entropy
  • mnemonic_to_seed(mnemonic: str, passphrase: str = "") -> bytes - Convert mnemonic to seed
  • validate_mnemonic(mnemonic: str, wordlist: list[str] | None = None) -> bool - Validate mnemonic checksum
  • entropy_to_mnemonic(entropy: bytes, wordlist: list[str] | None = None) -> str - Convert entropy to mnemonic
  • mnemonic_to_entropy(mnemonic: str, wordlist: list[str] | None = None) -> bytes - Convert mnemonic to entropy
  • get_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/

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts