{"id":5134,"library":"bip32","title":"BIP32 (Bitcoin HD Wallets)","description":"BIP32 is a minimalistic Python implementation of the Bitcoin HD wallet (Hierarchical Deterministic Wallet) specification. The current version is 5.0.0, released in November 2025. The library maintains an active development cycle, with occasional major releases that often introduce breaking changes, typically driven by updates to Python versions or the implementation of stricter sanity checks.","status":"active","version":"5.0.0","language":"en","source_language":"en","source_url":"https://github.com/darosior/python-bip32","tags":["bitcoin","cryptography","wallet","bip32","hd-wallet","blockchain","keys"],"install":[{"cmd":"pip install bip32","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required Python version.","package":"python","version":">=3.9"},{"reason":"Used as a wrapper for libsecp256k1 for efficient elliptic curve operations.","package":"coincurve","optional":false}],"imports":[{"symbol":"BIP32","correct":"from bip32 import BIP32"},{"note":"A constant used for specifying hardened derivation paths.","symbol":"HARDENED_INDEX","correct":"from bip32 import HARDENED_INDEX"}],"quickstart":{"code":"from bip32 import BIP32, HARDENED_INDEX\n\n# Create a BIP32 instance from a seed\nseed = bytes.fromhex(\"000102030405060708090a0b0c0d0e0f\")\nbip32_wallet = BIP32.from_seed(seed)\n\n# Derive a hardened private child key using a list of indices\nxpriv_path_list = bip32_wallet.get_xpriv_from_path([1, HARDENED_INDEX, 9998])\nprint(f\"Derived XPRIV (list path): {xpriv_path_list}\")\n\n# Derive a hardened private child key using a string path\nxpriv_path_str = bip32_wallet.get_xpriv_from_path(\"m/1/0'/9998\")\nprint(f\"Derived XPRIV (string path): {xpriv_path_str}\")\n\n# Derive an extended public key (xpub) from a non-hardened path\nxpub = bip32_wallet.get_xpub_from_path(\"m/0/0/0\")\nprint(f\"Derived XPUB: {xpub}\")\n\n# Instantiate from an existing extended public key (xpub) (can only derive unhardened children)\npublic_wallet = BIP32.from_xpub(xpub)\nchild_xpub = public_wallet.get_xpub_from_path(\"m/0/1\")\nprint(f\"Derived child XPUB from XPUB: {child_xpub}\")","lang":"python","description":"Initializes a BIP32 wallet from a seed and demonstrates deriving extended private and public keys using both list and string-based derivation paths. It also shows how to instantiate from an extended public key for public-only derivation."},"warnings":[{"fix":"Review the official changelog (`https://github.com/darosior/python-bip32/blob/master/CHANGELOG.md`) for details on API changes and required code modifications.","message":"Version 5.0.0 introduced breaking changes. Always consult the `CHANGELOG.md` for specific migration instructions when upgrading from previous major versions.","severity":"breaking","affected_versions":"5.0.0"},{"fix":"Ensure your Python environment meets the new requirements (e.g., Python >=3.9 for 5.x), and update your `coincurve` installation if needed.","message":"Version 3.0.0 was a breaking release due to updates in Python and Coincurve version requirements. This may necessitate updating your Python environment or `coincurve` dependency.","severity":"breaking","affected_versions":"3.0.0"},{"fix":"Update method calls to the new names and ensure all inputs conform to the stricter validation rules. Refer to the `CHANGELOG.md` for exact renames.","message":"Version 2.0.0 introduced stricter sanity checks and renamed methods within the `BIP32` class. Code relying on older method names or less stringent input validation will break.","severity":"breaking","affected_versions":"2.0.0"},{"fix":"To derive hardened keys, you must initialize the `BIP32` instance using `from_seed` or `from_xpriv` (an extended private key).","message":"When initializing `BIP32` from an extended public key (`from_xpub`), you can only derive unhardened child public keys. Attempting to derive hardened public keys will result in an error, as this operation requires the private key.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Before installing `bip32`, ensure `libsecp256k1` and its development headers are installed on your system. Consult `coincurve`'s documentation for platform-specific installation instructions if `pip install bip32` fails.","message":"The `bip32` library depends on `coincurve`, which is a Python wrapper for the `libsecp256k1` C library. This means that system-level dependencies for `libsecp256k1` might be required for successful installation, particularly on certain operating systems or custom environments.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}