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
- User guide: getting-started.md
- API documentation: https://cashscript-py.readthedocs.io/
- Runnable examples: examples/ (e.g.
uv run python examples/op_return_memo.py,uv run python examples/hodl_vault.py)
Contributing
For local development setup, testing, documentation generation, and project workflow details, see:
Acknowledgements
- Original CashScript SDK: https://cashscript.org/
- AnyHedge Plugin: https://github.com/fyookball/anyhedge-ec-plugin
- Bitcash library: https://pybitcash.github.io/bitcash/
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01dd34596171550d8006a37c80e18c4509206484ad9549de48acce8afbbd01d4
|
|
| MD5 |
e2922d0255f3cabe097edf1de5e94131
|
|
| BLAKE2b-256 |
5d7026798cf474e3189f867fee70ffc1e4aed4a29733cfc093acbd9e38444ae8
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be64ebe9bddc86822e087b879cd49cd68a7b951026888edfaf94c7645e96f94a
|
|
| MD5 |
1ef42bae6d5a68ae9ad094b13171f1fc
|
|
| BLAKE2b-256 |
310448ce4efd9b1668201f7b19601ee519208850da857a18168b33b12e843e43
|