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
Or, with uv:
uv add cashscript-py
Example
from cashscript_py import Contract, ElectrumNetworkProvider, Output, SignatureTemplate, TransactionBuilder
from .artifact import p2pkh_artifact
from .somewhere import contract_arguments, alice_wif, send_amount, recipient_address
provider = ElectrumNetworkProvider("chipnet")
contract = Contract(p2pkh_artifact, contract_arguments, provider)
alice_signature_template = SignatureTemplate(alice_wif)
unlocker = contract.unlock["transfer"](alice_signature_template)
contract_utxos = await contract.get_utxos()
contract_utxo = contract_utxos[0]
transaction_builder = TransactionBuilder(provider)
transaction_builder.add_input(contract_utxo, unlocker)
transaction_builder.add_output(Output(amount=send_amount, to=recipient_address))
tx_details = await transaction_builder.send()
Documentation
- SDK 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/
Metadata
Release files for cashscript-py 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cashscript_py-1.0.3.tar.gz | 36.4 MB | Without provenance | Details for cashscript_py-1.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cashscript_py-1.0.3-py3-none-any.whl | Python 3 | none | any | Details for cashscript_py-1.0.3-py3-none-any.whl |
Total release size: 36.4 MB
Release files / cashscript_py-1.0.3.tar.gz
| Download URL | cashscript_py-1.0.3.tar.gz |
|---|---|
| Size | 36.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cee26b372d2a4c12112c04ae3bf30ed9a309f962616e5a8ff8b8bef3a3778543
|
|
BLAKE2b-256 checksum How to use checksums |
d27b1259de5162858d68ab3a6c2107eb20ed1778934a8526effc19e3122d4138
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / cashscript_py-1.0.3-py3-none-any.whl
| Download URL | cashscript_py-1.0.3-py3-none-any.whl |
|---|---|
| Size | 37.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3fd2f2be7f5e99038e682091cd0dc09a970159b0fac4efbfb38cf0b2ef545592
|
|
BLAKE2b-256 checksum How to use checksums |
9491f1878fd9a711812ac9b01407f3f2c1fc36f802a9a0c717e635958bc53bcf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Security for cashscript-py 1.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.