Registry / auth-security / bip32
library5.0.0pypypi✓ verified 21d ago

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.

pip install bip32
INSTALL
IMPORT
SIG · BIP32
B
bip32
auth-securitypythonv5.0.0
Install
2.2s avg
Import
116ms
Disk
21MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v5.0.0 · pip install
no network on importno background threads
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
glibc
py 3.10
✓ —
✓ 2.2s
py 3.11
✓ —
✓ 2.1s
py 3.12
✓ —
✓ 1.9s
py 3.13
✕ build_error
✕ build_error
py 3.9
✓ —
✓ 2.7s
21MB installed
● package 21MB
Code
Verified usage

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

BIP32
from bip32 import BIP32
HARDENED_INDEX
from bip32 import HARDENED_INDEX
A constant used for specifying hardened derivation paths.

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.

from bip32 import BIP32, HARDENED_INDEX # Create a BIP32 instance from a seed seed = bytes.fromhex("000102030405060708090a0b0c0d0e0f") bip32_wallet = BIP32.from_seed(seed) # Derive a hardened private child key using a list of indices xpriv_path_list = bip32_wallet.get_xpriv_from_path([1, HARDENED_INDEX, 9998]) print(f"Derived XPRIV (list path): {xpriv_path_list}") # Derive a hardened private child key using a string path xpriv_path_str = bip32_wallet.get_xpriv_from_path("m/1/0'/9998") print(f"Derived XPRIV (string path): {xpriv_path_str}") # Derive an extended public key (xpub) from a non-hardened path xpub = bip32_wallet.get_xpub_from_path("m/0/0/0") print(f"Derived XPUB: {xpub}") # Instantiate from an existing extended public key (xpub) (can only derive unhardened children) public_wallet = BIP32.from_xpub(xpub) child_xpub = public_wallet.get_xpub_from_path("m/0/1") print(f"Derived child XPUB from XPUB: {child_xpub}")
Debug
Known issues
breakingVersion 5.0.0 introduced breaking changes. Always consult the `CHANGELOG.md` for specific migration instructions when upgrading from previous major versions.
fix
Review the official changelog (`https://github.com/darosior/python-bip32/blob/master/CHANGELOG.md`) for details on API changes and required code modifications.
affects: 5.0.0
breakingVersion 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.
fix
Ensure your Python environment meets the new requirements (e.g., Python >=3.9 for 5.x), and update your `coincurve` installation if needed.
affects: 3.0.0
breakingVersion 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.
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.
affects: 2.0.0
gotchaWhen 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.
fix
To derive hardened keys, you must initialize the `BIP32` instance using `from_seed` or `from_xpriv` (an extended private key).
affects: All versions
gotchaThe `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.
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.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'bip32'
The 'bip32' package is not installed in the current Python environment.
fix
pip install bip32
AttributeError: type object 'BIP32' has no attribute 'fromSeed'
The correct method name to create an instance from a seed is `from_seed` (snake_case), not `fromSeed` (camelCase).
fix
from bip32 import BIP32
bip32_instance = BIP32.from_seed(seed_bytes)
ValueError: Seed length must be between 16 and 64 bytes
The provided seed does not meet the length requirements (128 to 512 bits, or 16 to 64 bytes) as recommended by the BIP32 specification for a strong master seed.
fix
Ensure your seed is a `bytes` object with a length between 16 and 64 bytes (inclusive).
ValueError: Cannot derive hardened child from public key
The BIP32 standard explicitly states that hardened child keys can only be derived from a parent private key, not a parent public key.
fix
Derive hardened child keys only from `BIP32` instances that were created from a private key (e.g., `from_seed` or `from_xpriv`), or use a non-hardened index if deriving from a public key.
Upgrade
Version history
5.0.0latest on PyPI · released Nov 13, 2025
Audit
Dependencies
pythonrequiredRequired Python version.
coincurverequiredUsed as a wrapper for libsecp256k1 for efficient elliptic curve operations.
Agent activity
46 hits · last 30 days
node
40
OpenAI (training)
1
Resources