Skip to main content

bip32-descriptors

BIP32 hierarchical deterministic keys, output script descriptors and miniscript, in typed Python.

PyPI version GitHub release development status license downloads supported Python versions implementation wheel

pre-commit.ci status lint workflow status test workflow status docs workflow status documentation build vendored-vectors workflow status mutation workflow status qa-assets workflow status fuzz workflow status integration-bitcoind workflow status deps-latest workflow status pypi-install workflow status deps-oldest workflow status os-macos workflow status os-ubuntu workflow status os-windows workflow status links workflow status sdist-rebuild workflow status codeql workflow status

OpenSSF Scorecard OpenSSF Best Practices OpenSSF Baseline

It is fully annotated and ships py.typed. It is built on btclib, the protocol package, and ecc, the curve package; its secp256k1 extra adds the libsecp256k1 bindings, and without them the Python arithmetic answers instead.

What is here

  • BIP32 hierarchical deterministic keys: extended key serialization, private and public derivation, derivation paths and key origins (bip32)
  • BIP380 output script descriptors, from pk() to tr() with its script tree, musig() key expressions, and BIP388 wallet policies (descriptors)
  • BIP379 miniscript: parsing, type checking, the script it compiles to and the witness that satisfies it (descriptors.miniscript)

ARCHITECTURE.md says how these modules layer and which may import which.

Every refusal is btclib's BTClibValueError or BTClibTypeError, or ecc's class of the same kind where an argument reaches that package.

Signing, partially signed transactions and wallets are not here: they are btclib-wallet's.

The suite answers to vectors their authors publish -- the BIPs', Bitcoin Core's and bitcoin-s's -- and tests/_data/README.md pins each vendored file to the upstream commit it was copied from.

Installing

python -m pip install --upgrade bip32-descriptors

and, for the libsecp256k1 bindings,

python -m pip install --upgrade "bip32-descriptors[secp256k1]"

A key, a descriptor, an address

from bip32_descriptors.bip32 import derive, rootxprv_from_seed, xpub_from_xprv
from bip32_descriptors.descriptors import add_checksum, parse

# BIP32's test vector 1, and its m/0h/1 extended public key
xprv = rootxprv_from_seed("000102030405060708090a0b0c0d0e0f")
xpub = xpub_from_xprv(derive(xprv, "m/0h/1"))
assert xpub.startswith("xpub6ASuArnXKPbfEwhqN6e3mwBcDTgzisQN1wXN9BJcM47s")

# a ranged descriptor with its key origin, checksum included
descriptor = parse(add_checksum(f"wpkh([3442193e/0h/1]{xpub}/0/*)"))
assert descriptor.address(0) == "bc1qw47q2vtlewz7jyx970nvm8wy6p44mqepwqdj27"

# and a miniscript: the key, after 144 blocks
policy = parse(f"wsh(and_v(v:pk({xpub}/0/*),older(144)))")
assert policy.address(0).startswith("bc1q")

tests/readme_test.py runs every Python block of this file, so the example above is the one the suite checks.

Security

SECURITY.md says how to report a vulnerability, which versions are supported, and how a published file is traced back to the run that built it. ASSURANCE_CASE.md argues why what it promises holds: the threat model, the trust boundaries, and the weaknesses a package of this kind is exposed to.

Contributing

Development is LLM-based: humans are welcome, as long as they are comfortable with agentic development ;-). A contribution must have been read and understood by the person who submits it. CONTRIBUTING.md has the rules.

CONTRIBUTING.md has the commands each CI job runs, verbatim. uv sync creates the environment; uv is the only tool that has to be installed. REVIEWING.md is what a pull request is answered against.

How the organization decides, and who holds which role, is its GOVERNANCE.md; what it intends to do, and what it deliberately does not, is its ROADMAP.md.


The btclib organization and its projects are actively supported by DGI and CheckSig.

Metadata

Release files for bip32-descriptors 2026.11.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bip32-descriptors 2026.11.4
File Size Uploaded Provenance Actions
bip32_descriptors-2026.11.4.tar.gz 870.6 kB With provenance Details for bip32_descriptors-2026.11.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bip32-descriptors 2026.11.4
File Interpreter ABI Platform Actions
bip32_descriptors-2026.11.4-py3-none-any.whl Python 3 none any Details for bip32_descriptors-2026.11.4-py3-none-any.whl

Total release size: 1.0 MB

Release files / bip32_descriptors-2026.11.4.tar.gz

Download URL bip32_descriptors-2026.11.4.tar.gz
Size 870.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3b7ffce34aafdb93a3b43c0b95e483b1d5c020b9c377f128884c2694db13112b
BLAKE2b-256 checksum
How to use checksums
efb5f3a0f2572967211b1376ae2556c3e937ebbba9a2ec05466522eb1f36330d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Release files / bip32_descriptors-2026.11.4-py3-none-any.whl

Download URL bip32_descriptors-2026.11.4-py3-none-any.whl
Size 142.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc06b0ac0fec28144448589efd91423546643740336905218095ccc95f7585f1
BLAKE2b-256 checksum
How to use checksums
96fec3bd5aa0faa986df317b32acb3b16f85669a1eb6b092484e95b5c44d7b55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Security for bip32-descriptors 2026.11.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for bip32_descriptors-2026.11.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page