Skip to main content

Python SDK for Bitcoin Cash (BCH) CashScript smart contracts.

Project description

CashScript-Py

CashScript-Py is a Python SDK for Bitcoin Cash (BCH) smart contract development. It is a port of the original TypeScript CashScript SDK. The goal is to enable Python developers (e.g., those working on server-side tools, bots, and Electron Cash plugins) to construct and interact with smart contracts on the BCH blockchain without re-implementing common low-level details.

CashScript-Py builds on earlier work by Jonald Fyookball on the anyhedge-ec-plugin.

Installation

Install from PyPI:

pip install cashscript-py

If you use uv:

uv add cashscript-py

Minimal example

from cashscript_py import Contract, ElectrumNetworkProvider, SignatureTemplate, TransactionBuilder

provider = ElectrumNetworkProvider("chipnet")
contract = Contract(artifact, constructor_args, provider)

unlocker = contract.unlock["spend"](SignatureTemplate(alice_wif))
builder = TransactionBuilder(provider).add_input(contract_utxo, unlocker).add_output(...)
tx_hex = builder.build()
print(tx_hex)

Documentation

Contributing

For local development setup, testing, documentation generation, and project workflow details, see:

Acknowledgements

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

cashscript_py-1.0.2.tar.gz (36.4 MB view details)

Uploaded Source

Built Distribution

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

cashscript_py-1.0.2-py3-none-any.whl (37.5 kB view details)

Uploaded Python 3

File details

Details for the file cashscript_py-1.0.2.tar.gz.

File metadata

  • Download URL: cashscript_py-1.0.2.tar.gz
  • Upload date:
  • Size: 36.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for cashscript_py-1.0.2.tar.gz
Algorithm Hash digest
SHA256 01dd34596171550d8006a37c80e18c4509206484ad9549de48acce8afbbd01d4
MD5 e2922d0255f3cabe097edf1de5e94131
BLAKE2b-256 5d7026798cf474e3189f867fee70ffc1e4aed4a29733cfc093acbd9e38444ae8

See more details on using hashes here.

File details

Details for the file cashscript_py-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: cashscript_py-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 37.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for cashscript_py-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 be64ebe9bddc86822e087b879cd49cd68a7b951026888edfaf94c7645e96f94a
MD5 1ef42bae6d5a68ae9ad094b13171f1fc
BLAKE2b-256 310448ce4efd9b1668201f7b19601ee519208850da857a18168b33b12e843e43

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