Transaction parsing
Legacy, SegWit v0 (BIP-143) and Taproot (BIP-341) wire formats — parsed with deterministic, well-tested code paths.
btx turns raw Bitcoin bytes into inspectable, scriptable facts — from wire format and signatures to PSBT state and secp256k1 behavior.
transaction surface
raw bytes → useful facts
txid
9f2c…8e44
format
segwit v0
inputs
02
outputs
02
verified
yes
Use the smallest surface that solves the problem: parse a transaction, inspect its signatures, work with a PSBT, or drop into the curve math.
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. Add libsecp256k1 through coincurve when you need a faster curve backend — the API stays the same.
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.
The core stays usable offline. Network access is isolated behind the optional services layer, so parsing does not require a blockchain connection.
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 matters. Each layer is testable in isolation, network access is explicit, and the public surface is designed to be inspected rather than guessed.
Network I/O is isolated behind the services layer. Parsing and cryptographic operations can be imported and exercised without a blockchain connection.
The project uses type checking, property-based tests, vectors, coverage checks, and dependency auditing in its development workflow.
Public helpers, domain errors, CLI formats, and backend selection are documented so callers can reason about failures and fallbacks.
The project keeps deterministic parsing and cryptographic primitives separate from network services, optional acceleration, and development tooling.
Compatibility
The supported interpreter range is declared in the package metadata and exercised in CI.
Runtime boundary
The CLI uses Typer; parsing and curve code stay free of network clients.
Optional speed
Install the optional extra when native libsecp256k1 throughput is appropriate.
Standards
Transaction, sighash, PSBT, Schnorr, and Taproot paths follow documented Bitcoin standards.
Standards represented in the codebase
Use btx when Bitcoin primitives need to be reasoned about, tested, and made visible — not just called.
Parse raw transactions, extract signatures, and investigate nonce reuse with a transparent Python workflow.
Construct, sign, and broadcast transactions with immutable value semantics and a predictable public 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.
btx is not published to PyPI yet. Use an isolated environment and install directly from GitHub while the release workflow is being finalized.
git clone https://github.com/sachncs/btx.git && cd btx && python -m venv .venv && .venv/bin/python -m pip install -e . python -m pip install 'btx @ git+https://github.com/sachncs/btx.git'