Skip to main content

btcaaronbtcaaron mark

A pragmatic Bitcoin toolkit for Taproot engineering — Legacy, SegWit, and Taproot flows, PSBT, and optional Signet / Bitcoin Inquisition opcode templates (OP_CAT, OP_CHECKSIGFROMSTACK, OP_CHECKTEMPLATEVERIFY, OP_INTERNALKEY, BIP118 ANYPREVOUT (APO)).

Designed for reproducible testnet and signet experiments, educational workflows, and script-path development.

If you find btcaaron useful, a GitHub star is appreciated.

👉 Looking for Bitcoin Inquisition experimental opcode templates (OP_CAT / OP_CHECKSIGFROMSTACK / OP_CHECKTEMPLATEVERIFY / OP_INTERNALKEY / BIP118 ANYPREVOUT (APO))? See INQUISITION.md.

Current Status

v0.3.0 (alpha) — Core Taproot spend-path workflows are implemented and testnet/regtest-verified.
Current focus is release hardening: broader validation coverage, documentation alignment, and contributor testing feedback.

Features

Available Now (v0.1.x)

Production-tested on testnet with real transactions:

  • Generate Legacy / SegWit / Taproot addresses from WIF
  • UTXO scanning and balance lookup via public APIs
  • Build and sign standard transactions
  • Broadcast to Blockstream / Mempool endpoints
  • Developer helpers (WIFKey, quick_transfer)

Available Now (v0.2.x–0.3.0)

Testnet-verified with real transactions (244 automated tests, including BIP 341 and Bitcoin Inquisition reference vectors; CI runs them on Python 3.10–3.12):

  • Declarative Taproot tree builder (.hashlock(), .multisig(), .timelock(), .checksig())
  • Script-path and key-path spend constructors
  • Automatic witness construction and signature ordering
  • All 5 spend paths verified: hashlock, multisig, checksig, CSV timelock, keypath
  • Real transaction TXID reproduction tests

Future (v0.3.x+)

  • PSBT v2 hardening and broader interoperability validation
  • Custom script templates
  • Multi-input/output transactions

Positioning (Quick Comparison)

High-level developer-experience comparison only (not a full feature matrix).

Library Typical Use Case Script-Path UX
python-bitcoin-utils Low-level transaction/script construction and protocol experiments Manual (build tree/witness/control-block flow yourself)
btcaaron Fast Taproot prototyping, teaching workflows, and reproducible test scaffolds Declarative (e.g., .hashlock(), .multisig(), .timelock())
BitcoinLib Wallet-oriented workflows, account management, and persistence layers Mostly automated for common wallet flows
embit Descriptor/PSBT flows and hardware-wallet-oriented integrations Descriptor-oriented, standard-policy paths

Optional note: btcaaron is designed as a pragmatic Taproot engineering layer on top of low-level primitives, prioritizing readability and reproducible testing workflows.

Documentation

Requirements

  • Python >=3.10,<3.13
  • Dependencies:
    • requests>=2.25.0,<3.0.0
    • bitcoin-utils>=0.7.3,<0.8.0

Installation

python -m pip install btcaaron

Or from source:

git clone https://github.com/aaron-recompile/btcaaron.git
cd btcaaron
python -m pip install -e .

IDE environment tip (important)

Most IDE terminals run python/python3 from the currently selected interpreter. Install and run with the same interpreter to avoid mismatched environments:

python -m pip install -e .
btcaaron-doctor

Quick Start (v0.3.0)

Taproot-native API — core features available now.

from btcaaron import Key, TapTree

alice = Key.from_wif("cRxebG...")
bob = Key.from_wif("cSNdLF...")

program = (TapTree(internal_key=alice)
    .hashlock("secret", label="hash")
    .multisig(2, [alice, bob], label="2of2")
    .timelock(blocks=144, then=bob, label="csv")
    .checksig(bob, label="backup")
).build()

print(program.address)  # tb1p...

# Fund commit address without leaving IDE (auto UTXO selection)
from btcaaron import fund_program
# txid = fund_program(wif, program, 10_000)  # 打币到 program.address

tx = (program.spend("hash")
    .from_utxo("abc123...", 0, sats=1200)
    .to("tb1p...", 666)
    .unlock(preimage="secret")
    .build())

tx.broadcast()

Legacy Quick Start (v0.1.x)

For backward compatibility with the v0.1.x API:

from btcaaron import WIFKey, quick_transfer

wif = "your_testnet_wif"

key = WIFKey(wif)
print("Taproot:", key.get_taproot().address)

balance = key.get_taproot().get_balance()
print("Balance:", balance, "sats")

if balance > 1000:
    txid = quick_transfer(wif, "taproot", "tb1q...", amount=500, fee=300)
    print("Broadcasted:", txid)

Descriptor Wallet Quick Start (tprv/xpriv)

For descriptor-style HD wallet flows (RGB-friendly), derive directly from tprv:

from btcaaron import taproot_balance_from_tprv, quick_transfer_tprv, taproot_descriptor_from_tprv

tprv = "tprv8ZgxMBicQKs..."
print(taproot_descriptor_from_tprv(tprv, branch=0))  # tr(tprv.../86h/1h/0h/0/*)

balance = taproot_balance_from_tprv(tprv, branch=0, index=0)
print("Balance:", balance, "sats")

txid = quick_transfer_tprv(
    tprv,
    "tb1p...",
    amount=10_000,
    fee=800,
    branch=0,
    index=0,
    debug=True,
)
print("Broadcasted:", txid)

Full specification in DESIGN.md.

Testing

Run the test suite:

python -m pytest tests/

Run specific test suites:

# v0.2+ comprehensive tests (pytest)
python -m pytest tests/test_btcaaron_v02.py -v

# v0.1.x example-based tests
python tests/test_btcaaron_v01.py

Environment Doctor

Use doctor before reporting install/runtime issues:

btcaaron-doctor

If doctor fails, re-install with the same interpreter:

python -m pip install -e .
btcaaron-doctor

Project Structure

btcaaron/
├── btcaaron/         # Core library
├── tests/            # Test suite
├── DESIGN.md         # Architecture & roadmap
├── README.md
├── setup.py
└── LICENSE

Development

See DESIGN.md for architecture details and development roadmap.

Notes

  • Default safety posture: testnet/regtest-first for everyday development and experiments.
  • Mainnet (experimental): available behind explicit guardrails in Transaction.broadcast(...).
  • Mainnet guardrails:
    • default call blocks mainnet broadcast unless allow_mainnet=True
    • dry_run=True is available for no-side-effect routing checks
    • recommended smoke script: python3 examples/core_test/scenarios/mainnet_readiness_smoke.py
  • v0.3.0 Status: Core Taproot spend-path flows are implemented and testnet-verified; ongoing work focuses on hardening, PSBT, and documentation.

Acknowledgments

btcaaron received early-stage support from an OpenSats grant.

Author

Aaron Zhang
Reproducible Taproot experiments · Script engineering · Educational tooling
https://x.com/aaron_recompile

License

MIT License

Metadata

Release files for btcaaron 0.3.0

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

Source distribution (sdist)

Source distribution for btcaaron 0.3.0
File Size Uploaded Provenance Actions
btcaaron-0.3.0.tar.gz 73.0 kB Without provenance Details for btcaaron-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for btcaaron 0.3.0
File Interpreter ABI Platform Actions
btcaaron-0.3.0-py3-none-any.whl Python 3 none any Details for btcaaron-0.3.0-py3-none-any.whl

Total release size: 134.2 kB

Release files / btcaaron-0.3.0.tar.gz

Download URL btcaaron-0.3.0.tar.gz
Size 73.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cd9070d15c6197155d2b7d8e412d4fda69a9666c73fe51dac2af78cac0ad37cc
BLAKE2b-256 checksum
How to use checksums
99c632b6a2f31474dd8cc4f0bebd52e6b929a7bb3ec8171777c4e29fd423cd80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / btcaaron-0.3.0-py3-none-any.whl

Download URL btcaaron-0.3.0-py3-none-any.whl
Size 61.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6c5a8d4e8152a496b4b646e6728466d2defa050fe6ac13b57e7dd3f5338fb467
BLAKE2b-256 checksum
How to use checksums
c7ebb68f0a64ee66811800f9dc04af5918d7e619a7906bc7cd959a9c2479876f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Security for btcaaron 0.3.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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