Skip to main content

This library provides a Python interface for building BitcoinSV scripts and transactions.

Project description

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))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tx_engine-0.9.1.tar.gz (478.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tx_engine-0.9.1-cp311-abi3-win_amd64.whl (965.3 kB view details)

Uploaded CPython 3.11+Windows x86-64

tx_engine-0.9.1-cp311-abi3-win32.whl (871.5 kB view details)

Uploaded CPython 3.11+Windows x86

tx_engine-0.9.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ x86-64

tx_engine-0.9.1-cp311-abi3-macosx_11_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

tx_engine-0.9.1-cp311-abi3-macosx_10_12_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

Details for the file tx_engine-0.9.1.tar.gz.

File metadata

  • Download URL: tx_engine-0.9.1.tar.gz
  • Upload date:
  • Size: 478.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for tx_engine-0.9.1.tar.gz
Algorithm Hash digest
SHA256 41750b6f2fcfd8f16fabd5c48d6329aae54db50050a46b30d31d3ed5e1b4c446
MD5 7ade7cf2595eb9f26ce41b572e6a0f97
BLAKE2b-256 870f8e6348e31dc23f89a36cf1afcc53e8307381ca2f2d690e53635e3f4d398f

See more details on using hashes here.

File details

Details for the file tx_engine-0.9.1-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: tx_engine-0.9.1-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 965.3 kB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for tx_engine-0.9.1-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 a6bc4b55e349f27d70c3097e84848a50cf76c8e37960efbc6bdb5b8d41322e4f
MD5 5d2ef9899894108318bd450da1012a2e
BLAKE2b-256 ddeb58db6cd099301dd9df7bf04dc1e23d8c79a5fe3394ca4ba0dedfee67ee1b

See more details on using hashes here.

File details

Details for the file tx_engine-0.9.1-cp311-abi3-win32.whl.

File metadata

  • Download URL: tx_engine-0.9.1-cp311-abi3-win32.whl
  • Upload date:
  • Size: 871.5 kB
  • Tags: CPython 3.11+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for tx_engine-0.9.1-cp311-abi3-win32.whl
Algorithm Hash digest
SHA256 9e21404dc86ac7b5efa279049aa2db48dace525710959c4198168fdae16bea7d
MD5 0c3a936f749dcf6ed23643bdaa45f672
BLAKE2b-256 51ffe06722d3b7b0714c6eeb2e64fcf860211b0bc2aca648ebe9d4c140929a29

See more details on using hashes here.

File details

Details for the file tx_engine-0.9.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tx_engine-0.9.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 253c6da688eae7f4150586e821b83ec83eb3fc3187dff9613df5165de52557f5
MD5 4f8ec2389f78632555a638f343599e48
BLAKE2b-256 638b01552d23f7d7bd93e44d196446ce299273d30cc69a433bb0248cc68d24b0

See more details on using hashes here.

File details

Details for the file tx_engine-0.9.1-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tx_engine-0.9.1-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fdba1c13d4e86cb1e754f4363af690a0e638bd5ae9959f5685d5fd44a608fc57
MD5 52299ebc8affc1429303aa71537dd7de
BLAKE2b-256 4a466010f61445eaf5e31915c3ae267f6f34f75b4938e6f973349af18c872cf0

See more details on using hashes here.

File details

Details for the file tx_engine-0.9.1-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for tx_engine-0.9.1-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 81defe10f807e0f9a670e24a0860ca973ef73605f0eabce34173d3d5f7c7a358
MD5 90b632e229664c2853819f69c457b6e6
BLAKE2b-256 149944051f771b27d8eb2e2742a99ed75fdd8feda272bf2a243f5d5057c640b1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page