Skip to main content

TX Engine

Python interface for building Bitcoin SV scripts and transactions. The native core is the Rust chain-gang library.

Requires Python 3.11+. Install from PyPI:

pip install tx-engine

Documentation

Topic Link
Documentation index docs/README.md
Python class reference docs/Python-API.md
HD wallets (mnemonic, BIP-44) docs/BIP-32-Python.md
Chronicle (Python examples) docs/Chronicle-Python.md
Chronicle (full spec) docs/Chronicle.md
Local development python/README.md

Quick example

from tx_engine import Tx

src_tx = (
    "0100000001c7151ebaf14dbfe922bd90700a7580f6db7d5a1b898ce79cb9ce459e17f1290900000000"
    "6b4830450221008b001e8d8110804ac66e467cd2452f468cba4a2a1d90d59679fe5075d24e5f530220"
    "6eb04e79214c09913fad1e3c0c2498be7f457ed63323ac6f2d9a38d53586a58d41210395deb00349c0ae7"
    "3412a55bec70a7793fc6860a193d29dd61d73c6271ffcbd4cffffffff0103000000000000001976a914"
    "96795fb99fd6c0f214f7a0e96019f642225f52d288ac00000000"
)

tx = Tx.parse_hexstr(src_tx)
print(tx)

Chronicle upgrade

Bitcoin SV Chronicle is supported in both the Rust library and Python bindings. Guide: docs/Chronicle-Python.md.

Chronicle script rules apply when tx.version > 1. Use version: 2 (or higher) on spending transactions to opt in.

Check Python API
Version-only (offline / mempool-style) Tx.validate(utxos)
Consensus at a known block height Tx.validate_at_height(utxos, block_height, network) — network is BSV_Mainnet, BSV_Testnet, or BSV_STN
Script debugger / partial eval Context(tx_version=2, lock_script=...)

See docs/Chronicle.md for sighash routing, opcodes, two-phase evaluation, malleability rules, and script number limits.

HD wallets

BIP-32 / BIP-39 / BIP-44 support via HdWallet and watch-only HdWatchWallet. Guide: docs/BIP-32-Python.md.

from tx_engine import HdWallet, bsv_coin_type

hd = HdWallet.from_mnemonic("BSV_Mainnet", "abandon abandon ... about")
print(hd.address_at_bip44(bsv_coin_type(), 0, True, 0))

Metadata

Release files for tx-engine 0.11.6

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

Source distribution (sdist)

Source distribution for tx-engine 0.11.6
File Size Uploaded
tx_engine-0.11.6.tar.gz 529.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for tx-engine 0.11.6
File
tx_engine-0.11.6-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details
tx_engine-0.11.6-cp311-abi3-win32.whl CPython 3.11 abi3 Windows x86-32 Details
tx_engine-0.11.6-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details
tx_engine-0.11.6-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details
tx_engine-0.11.6-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details

Total release size: 5.6 MB

Release files / tx_engine-0.11.6.tar.gz

Download URL tx_engine-0.11.6.tar.gz
Size 529.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e6a8f02193f76e64c88225aabde07b9021959a72dde0dcd3148daf3b1ec76de2
BLAKE2b-256 checksum
How to use checksums
8d5759ee952e7e2bddd4ea515b4cbb988402a87dd31dbccaa2416cfb29b4647f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / tx_engine-0.11.6-cp311-abi3-win_amd64.whl

Download URL tx_engine-0.11.6-cp311-abi3-win_amd64.whl
Size 983.6 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
aabc060ae37dc32a058bc445d9f36b274937c139592531c1a21e14360f0e7ee1
BLAKE2b-256 checksum
How to use checksums
526cf0d47fe46a24dbacb602a7ccf6c5a383d355999db0f10fa2d19b7db64f35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / tx_engine-0.11.6-cp311-abi3-win32.whl

Download URL tx_engine-0.11.6-cp311-abi3-win32.whl
Size 892.7 kB
Tags CPython 3.11 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
6dea783a8d53eb4c211b0699fba362cd2178fccd3c45a7d8e62fdbc4f83ac566
BLAKE2b-256 checksum
How to use checksums
bc2f2ffd7152e95f01421fe5d76a5fae5b36983a681f1dddf47bc69d4110235e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / tx_engine-0.11.6-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL tx_engine-0.11.6-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.1 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
c9ccf8066354c9d9541aa16bd232baa1ef5de526236b86517d1109909a1b3d3d
BLAKE2b-256 checksum
How to use checksums
7a50ca1a60aad34b41cee0a6423552e4642b07a31afaafc2cef1a933f297e5b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / tx_engine-0.11.6-cp311-abi3-macosx_11_0_arm64.whl

Download URL tx_engine-0.11.6-cp311-abi3-macosx_11_0_arm64.whl
Size 1.0 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
cf0fdff44c562b0333ab85f9a8426ad12050335882c5a570ae2a3c7db2d4128a
BLAKE2b-256 checksum
How to use checksums
58a2f98cb7866ac1c082dbd7221b329d23372979d54b84e57b7e3fbcf9a37f1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / tx_engine-0.11.6-cp311-abi3-macosx_10_12_x86_64.whl

Download URL tx_engine-0.11.6-cp311-abi3-macosx_10_12_x86_64.whl
Size 1.1 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
0e0378eb91336bb1f3d5dfa906f6064af0f8a790da1de9634141ad716ebba130
BLAKE2b-256 checksum
How to use checksums
2c0cb1fcf70c64174d84d4b0a5ecfbfd13880d613e0981224df2e89fabe1db49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release history Release notifications | RSS feed

0.13.1

6 release files

This release

0.11.6 This release

6 release files

0.11.5

6 release files

0.11.4

6 release files

0.11.3

6 release files

0.11.2

6 release files

0.10.1

6 release files

0.10.0

6 release files

0.9.1

6 release files

0.9.0

22 release files

0.8.0

19 release files

0.7.4

19 release files

0.7.3

17 release files

0.7.2

17 release files

0.7.1

16 release files

0.7.0

16 release files

0.6.8

63 release files

0.6.7

65 release files

0.6.6

65 release files

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