{"id":9808,"library":"hdwallet","title":"HD Wallet Generator","description":"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.","status":"active","version":"3.6.1","language":"en","source_language":"en","source_url":"https://github.com/hdwallet-io/python-hdwallet","tags":["cryptocurrency","blockchain","wallet","hdwallet","bip32","bip39","bip44","slip44"],"install":[{"cmd":"pip install hdwallet","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Used for BIP-39 mnemonic phrase generation and validation.","package":"mnemonic"},{"reason":"Provides Base58 encoding/decoding for addresses and keys.","package":"base58"},{"reason":"Required for elliptic curve digital signature algorithm operations, crucial for Bitcoin-like cryptocurrencies.","package":"ecdsa"},{"reason":"Supports HD key derivation for Ed25519 curve-based cryptocurrencies.","package":"ed25519-hd-key"},{"reason":"Implements Bech32m encoding for segwit addresses.","package":"bech32m"},{"reason":"Provides various cryptographic hash functions.","package":"py-hashes"},{"reason":"Used for data validation and settings management.","package":"pydantic"}],"imports":[{"symbol":"HDWallet","correct":"from hdwallet import HDWallet"},{"note":"Mnemonic utility functions are located in `hdwallet.utils`.","wrong":"from hdwallet import generate_mnemonic","symbol":"generate_mnemonic","correct":"from hdwallet.utils import generate_mnemonic"},{"note":"Derivation path constants are typically imported from `hdwallet.derivations`.","wrong":"from hdwallet import BIP44Derivation","symbol":"BIP44Derivation","correct":"from hdwallet.derivations import BIP44Derivation"}],"quickstart":{"code":"from hdwallet import HDWallet\nfrom hdwallet.symbols import ETH as SYMBOL\nfrom hdwallet.derivations import BIP44Derivation\nfrom hdwallet.utils import generate_mnemonic, is_mnemonic_valid\n\n# 1. Generate a new mnemonic phrase (12 words)\nmnemonic = generate_mnemonic(language=\"english\", strength=128)\n\n# 2. Optionally, validate the mnemonic\nif not is_mnemonic_valid(mnemonic, language=\"english\"):\n    raise ValueError(\"Invalid mnemonic phrase\")\n\n# 3. Create an HDWallet instance\nhdwallet = HDWallet(symbol=SYMBOL)\n\n# 4. From mnemonic, get the root key\nhdwallet.from_mnemonic(mnemonic=mnemonic, language=\"english\", passphrase=None)\n\n# 5. Derive a child key using a BIP44 path for Ethereum\n# Example: m/44'/60'/0'/0/0\nhdwallet.from_path(path=BIP44Derivation.m / BIP44Derivation.coin_types.ETH / BIP44Derivation.PURPOSE.root / BIP44Derivation.ACCOUNT.root / BIP44Derivation.CHANGE.root / BIP44Derivation.ADDRESS.root)\n\n# 6. Get wallet details\nprint(f\"Mnemonic: {hdwallet.mnemonic()}\")\nprint(f\"Base HD path: {hdwallet.base_hd_path()}\")\nprint(f\"Address: {hdwallet.address()}\")\nprint(f\"Private Key: {hdwallet.private_key()}\")\nprint(f\"Public Key: {hdwallet.public_key()}\")\n","lang":"python","description":"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`."},"warnings":[{"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.","message":"The 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.","severity":"breaking","affected_versions":">=3.5.1"},{"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.","message":"The 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.","severity":"breaking","affected_versions":">=3.1.0"},{"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.","message":"The 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.","severity":"breaking","affected_versions":">=3.2.0"},{"fix":"Update any calls from `point_object.raw` to `point_object.raw_encode()`.","message":"The `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.","severity":"gotcha","affected_versions":">=3.5.1"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"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.","cause":"Attempting to access the `ecc` attribute directly after the v3.5.1 refactor.","error":"AttributeError: 'HDWallet' object has no attribute 'ecc'"},{"fix":"Utility functions like `generate_mnemonic` are located in `hdwallet.utils`. Correct the import to `from hdwallet.utils import generate_mnemonic`.","cause":"Trying to import utility functions directly from the top-level `hdwallet` package.","error":"ImportError: cannot import name 'generate_mnemonic' from 'hdwallet'"},{"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.","cause":"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.","error":"ValueError: Invalid WIF private key: checksum mismatch"}]}