API reference
The package root exposes the workflows most callers need. Import lower-level helpers from their named modules when you need finer control.
Transactions
| Symbol | Purpose |
|---|---|
parse_tx(data) | Parse raw transaction bytes and return (Tx, consumed_bytes). |
serialize_tx(tx) | Serialize a transaction in its canonical wire format. |
txid(tx) / wtxid(tx) | Compute legacy and witness transaction identifiers. |
TransactionBuilder | Construct immutable transaction models fluently. |
Signatures and keys
| Symbol | Purpose |
|---|---|
extract_signatures(tx) | Extract ECDSA and Schnorr records from supported input types. |
verify_signature(...) | Verify an ECDSA signature against a message hash and public key. |
verify_schnorr_signature(...) | Verify a BIP-340 Schnorr signature. |
linearize_signatures(records) | Derive deterministic linear relations for signature analysis. |
detect_nonce_reuse(...) | Find same-nonce and related-nonce candidates. |
Sighashes, scripts, and PSBTs
Sighashes
sighash_legacy, sighash_segwit, and sighash_taproot implement the Bitcoin signing rules.
Scripts
parse_script, classify_script_pubkey, and the build_p2* helpers handle standard output forms.
PSBT
parse_psbt, serialize_psbt, PsbtEditor, and extraction helpers cover BIP-174 workflows.
Services
blockstream_provider, mempool_space_provider, and GenericHttpProvider provide bounded network access.
Errors and contracts
Malformed data raises deterministic ValueError-compatible domain errors. Provider calls validate transaction IDs, enforce timeouts and response limits, and distinguish transport failures from invalid responses. Batch functions preserve input order and propagate worker failures.
help(btx). The site documents supported behavior without requiring a repository Markdown file.