Getting started
Use an isolated virtual environment, install the repository in editable mode, and keep the optional acceleration backend separate from the reliable pure-Python default.
Requirements
- Python 3.12 or newer.
- Git for the source checkout.
uvis recommended for development; standardvenvandpipare supported.
Install from source
git clone https://github.com/sachncs/btx.git
cd btx
python -m venv .venv
.venv/bin/python -m pip install -e . The editable install keeps the checkout and importable package in sync while you explore the code.
Direct Git install
python -m pip install "btx @ git+https://github.com/sachncs/btx.git" Not PyPI yet. Do not use
pip install btx; the public release is intentionally gated until the package publication checklist is complete.Run the CLI
.venv/bin/btx --help
.venv/bin/btx health
.venv/bin/btx decode <transaction-hex>
.venv/bin/btx extract <transaction-hex> --json Use the Python API
from btx import extract_signatures, parse_tx
from btx.transaction import txid
tx, consumed = parse_tx(bytes.fromhex(raw_hex))
print(consumed, txid(tx).hex())
records = extract_signatures(tx) Optional extras
# Development, tests, typing, linting, and audits
.venv/bin/python -m pip install -e ".[dev]"
# Optional C-backed secp256k1 operations
.venv/bin/python -m pip install -e ".[coincurve]" The pure-Python backend is the compatibility baseline. The optional coincurve backend is validated in CI on Python 3.12 and 3.13.
Configure the backend
BTX_DEFAULT_BACKEND=native .venv/bin/btx health
BTX_DEFAULT_BACKEND=libsecp .venv/bin/btx health The environment variable is read when btx is imported. The backend selection is a process configuration, not a mutable settings field.