Transaction parsing
Legacy, SegWit v0 (BIP-143) and Taproot (BIP-341) wire formats — parsed with deterministic, well-tested code paths.
A precision Python toolkit for parsing raw transactions, extracting ECDSA and Schnorr signatures, and analysing nonce reuse on the secp256k1 curve — with zero runtime dependencies and an all-public API.
$ btx extract 0200000001... --json
"txid": "9f2c...8e44",
"inputs": [
"index": 0,
"script_type": "P2WPKH",
"r": "c8b3...4a2f",
"s": "1d6e...92bc",
"z": "7a91...05d3",
"verified": true
]
$ btx health
✓ curve ops ok
✓ sighash ok
✓ psbt ok
✓ backend: native 3.41 ms/op btx is organised as a strict dependency pyramid. Each layer is understandable and testable in isolation — no hidden behaviour, no semi-private helpers.
Legacy, SegWit v0 (BIP-143) and Taproot (BIP-341) wire formats — parsed with deterministic, well-tested code paths.
ECDSA and Schnorr from every standard script type: P2PK, P2PKH, P2SH-multisig, P2WPKH, P2WSH, nested SegWit and Taproot key & script paths.
Pure Python by default. Swap in libsecp256k1 via coincurve for production throughput — same API, no rewrites.
Linearised ECDSA (α, β) relations with both same-nonce and related-nonce recovery — the algebra behind real-world key extraction.
BIP-174 parse, edit, sign and extract. Process batches of PSBTs with ThreadPool or ProcessPool executors and graceful shutdown.
Zero runtime dependencies. Network I/O lives in an isolated services layer — the core library is import-safe offline.
From a 60-character CLI to a deeply programmable Python API. Same precision underneath, no half-implemented corners.
_foo through submodules. $ btx extract 0200000001...
txid = 9f2c…8e44
inputs = 2
sigs = 2
verified = true
[0] P2WPKH r=c8b3…4a2f s=1d6e…92bc
[1] P2TR taproot key-path z=7a91…05d3 Strict dependency rules mean each layer can be reasoned about and tested in isolation. No upward dependencies. No cross-layer leakage.
Typer-based command-line interface
Blockchain data providers + async batch
Extraction · linearisation · attacks · signing
Transaction, script and PSBT machinery
Byte-level, modular arithmetic & secp256k1 point ops
No upward refs
Higher layers never depend on lower ones — enforced by tests.
No network in core
Only the services layer touches I/O. Core is import-safe offline.
Pluggable backends
Pure-Python by default, libsecp256k1 for production throughput.
btx is built for environments where correctness is not optional. Each layer is testable in isolation, each helper has a public name, and there are no surprises buried in private modules.
Network I/O is opt-in and isolated. The core library imports cleanly in fully offline environments — perfect for forensic and hardware workflows.
Strict type hints, mypy in strict-ish mode, and 99%+ test coverage across the curve, encoding, and signature layers.
Every helper is a documented public symbol — re-exported from the package root. No _foo chase, no surprises.
Public benchmarks on every push. 99%+ coverage across the public API. A clean slate for your most demanding Bitcoin workloads.
pytest + Hypothesis
across the core stack
Typer is the only one
native backend · median
Standards implemented
From incident response to wallet R&D — btx fits in wherever Bitcoin primitives need to be reasoned about, not just called.
Parse blocks, extract every signature, and search for nonce reuse across millions of transactions — all in pure Python.
Construct, sign and broadcast transactions with immutable value semantics and a fully public, predictable API.
Read the byte-level wire format with code that mirrors the BIPs. Ideal for teaching secp256k1 from the ground up.
Batch-process PSBTs, classify scripts, and verify signatures deterministically — without touching the network.
One line of pip. Zero dependencies. A Bitcoin-grade toolkit that behaves the way cryptography should.
$ pip install btx pip install btx uv add btx poetry add btx