Registry / auth-security / hdwallet

hdwallet

JSON →
library3.6.1pypypi✓ verified 85d ago

hdwallet is a Python library that implements a Hierarchical Deterministic (HD) Wallet generator, supporting over 200 cryptocurrencies. It is currently at version 3.6.1 and sees active development with minor releases every few weeks to months, typically adding new cryptocurrencies, enhancements, and bug fixes.

pip install hdwallet
INSTALL
IMPORT
SIG · HDWALLET
H
hdwallet
auth-securitypythonv3.6.1
Install
Import
Disk
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
build_error
glibc
py 3.103.910 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

HDWallet
from hdwallet import HDWallet
generate_mnemonic
from hdwallet.utils import generate_mnemonic
from hdwallet import generate_mnemonic
Mnemonic utility functions are located in `hdwallet.utils`.
BIP44Derivation
from hdwallet.derivations import BIP44Derivation
from hdwallet import BIP44Derivation
Derivation path constants are typically imported from `hdwallet.derivations`.

This quickstart demonstrates how to generate a new 12-word BIP-39 mnemonic, derive an Ethereum address using a standard BIP-44 path, and retrieve its associated private and public keys. It highlights the use of `generate_mnemonic`, `is_mnemonic_valid`, `HDWallet`, `from_mnemonic`, and `from_path`.

from hdwallet import HDWallet from hdwallet.symbols import ETH as SYMBOL from hdwallet.derivations import BIP44Derivation from hdwallet.utils import generate_mnemonic, is_mnemonic_valid # 1. Generate a new mnemonic phrase (12 words) mnemonic = generate_mnemonic(language="english", strength=128) # 2. Optionally, validate the mnemonic if not is_mnemonic_valid(mnemonic, language="english"): raise ValueError("Invalid mnemonic phrase") # 3. Create an HDWallet instance hdwallet = HDWallet(symbol=SYMBOL) # 4. From mnemonic, get the root key hdwallet.from_mnemonic(mnemonic=mnemonic, language="english", passphrase=None) # 5. Derive a child key using a BIP44 path for Ethereum # Example: m/44'/60'/0'/0/0 hdwallet.from_path(path=BIP44Derivation.m / BIP44Derivation.coin_types.ETH / BIP44Derivation.PURPOSE.root / BIP44Derivation.ACCOUNT.root / BIP44Derivation.CHANGE.root / BIP44Derivation.ADDRESS.root) # 6. Get wallet details print(f"Mnemonic: {hdwallet.mnemonic()}") print(f"Base HD path: {hdwallet.base_hd_path()}") print(f"Address: {hdwallet.address()}") print(f"Private Key: {hdwallet.private_key()}") print(f"Public Key: {hdwallet.public_key()}")
hdwallet --version
Debug
Known issues
breakingThe internal `ecc` attribute was renamed to `eccs` and the `const` module was refactored in v3.5.1. Direct access to these internal components might break existing code.
fix
Review any code directly accessing `hdwallet_instance.ecc` or `hdwallet.const` and update to use `hdwallet_instance.eccs` or the new module structure/constants.
affects: >=3.5.1
breakingThe Wallet Import Format (WIF) implementations were significantly upgraded across v3.1.0 and v3.2.0. This can affect how WIF keys are generated, validated, and converted, potentially leading to incorrect keys if old logic is relied upon.
fix
Ensure all WIF-related operations (generation, import, export) are tested with the new library version. Old WIF validation logic might fail or produce different results.
affects: >=3.1.0
breakingThe default address assignment logic was modified in v3.2.0 to align with standard HD wallet configurations. This means addresses generated by identical input (mnemonic, path) might differ from those generated by older `hdwallet` versions.
fix
Always re-verify generated addresses against known good values or other wallet implementations when upgrading, especially if deterministic address generation is critical. Do not rely on previously generated addresses being identical.
affects: >=3.2.0
gotchaThe `raw` property of Point objects (used in ECC operations) was changed to `raw_encode` in v3.5.1. If you were accessing raw point data, this will change the method name.
fix
Update any calls from `point_object.raw` to `point_object.raw_encode()`.
affects: >=3.5.1
Errors
Common errors & fixes
AttributeError: 'HDWallet' object has no attribute 'ecc'
Attempting to access the `ecc` attribute directly after the v3.5.1 refactor.
fix
The attribute was renamed to `eccs`. Update your code to use `hdwallet_instance.eccs` if you need to access it, though direct access to internal attributes is generally discouraged.
ImportError: cannot import name 'generate_mnemonic' from 'hdwallet'
Trying to import utility functions directly from the top-level `hdwallet` package.
fix
Utility functions like `generate_mnemonic` are located in `hdwallet.utils`. Correct the import to `from hdwallet.utils import generate_mnemonic`.
ValueError: Invalid WIF private key: checksum mismatch
Attempting to import or use a WIF (Wallet Import Format) private key that was either generated incorrectly by an older version of `hdwallet` or is simply malformed according to the updated WIF standards in v3.1.0/v3.2.0.
fix
Ensure the WIF string is correctly formatted according to current standards. If it was generated by an older `hdwallet` version, verify if the new library can still process it, or re-generate/re-export from a reliable source.
Upgrade
Version history
3.6.1latest on PyPI · released Aug 4, 2025
Audit
Dependencies
mnemonicrequiredUsed for BIP-39 mnemonic phrase generation and validation.
base58requiredProvides Base58 encoding/decoding for addresses and keys.
ecdsarequiredRequired for elliptic curve digital signature algorithm operations, crucial for Bitcoin-like cryptocurrencies.
ed25519-hd-keyrequiredSupports HD key derivation for Ed25519 curve-based cryptocurrencies.
bech32mrequiredImplements Bech32m encoding for segwit addresses.
py-hashesrequiredProvides various cryptographic hash functions.
pydanticrequiredUsed for data validation and settings management.
Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources