Xian Network Python Contracting Engine
Project description
xian-contracting
xian-contracting is the Python contract runtime for Xian. It owns contract
compilation, secure execution, storage semantics, metering, and the runtime
rules that contracts must obey.
Quick Start
Install the runtime:
pip install xian-tech-contracting
If you want contract-side zk proof verification, install the optional zk backend too:
pip install 'xian-tech-contracting[zk]'
The published PyPI package name is xian-tech-contracting. The repo name
remains xian-contracting, and the import surface remains contracting.
Submit and call a contract:
from contracting.client import ContractingClient
client = ContractingClient()
client.submit(name="con_token", code=contract_source)
token = client.get_contract("con_token")
token.transfer(amount=100, to="bob")
Access storage directly:
from contracting.storage.driver import Driver
driver = Driver()
driver.set("example.key", "value")
print(driver.get("example.key"))
Principles
- Contracts use Python syntax, but execution rules are consensus-sensitive and intentionally narrower than general Python.
- Metering, storage encoding, import restrictions, and runtime helpers must stay version-aligned across validators.
- Optional native tracing is an implementation detail. The contract model and runtime rules should remain understandable without it.
- Built-in helpers should serve the execution model, not grow into a general convenience framework.
Key Directories
src/contracting/: runtime, storage, compilation, and stdlib bridge codepackages/: shared packages such asxian-runtime-types,xian-accounts, the native tracer, andxian-zktests/: unit, integration, and security coveragedocs/: architecture, backlog, and execution notes
What It Covers
- compilation and linting
- runtime execution and metering
- storage drivers and encoding
- contract-side runtime helpers
- optional native tracing backend
- native zero-knowledge verifier building blocks
Validation
uv sync --group dev
uv run ruff check .
uv run ruff format --check .
uv run pytest
If you change the zk runtime surface or the native verifier package, run:
uv sync --group dev --extra zk
uv run --extra zk pytest -q tests/unit/test_zk_stdlib.py tests/integration/test_zk_bridge.py
cd packages/xian-zk && uv sync --group dev && uv run maturin develop && uv run pytest -q
If you change metering, tracing, storage encoding, or import restrictions, run
the relevant tests/security/ and tests/integration/ paths explicitly too.
Related Docs
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 xian_tech_contracting-1.0.1.tar.gz.
File metadata
- Download URL: xian_tech_contracting-1.0.1.tar.gz
- Upload date:
- Size: 40.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fa8193ee7fe939e0b9f8e4077d70c3be88c702d17509a8b74243cd91ad85fe5
|
|
| MD5 |
6522ea317b9be333430fb3566e643572
|
|
| BLAKE2b-256 |
bf27d567b74a0fd9bb8f70e9ba362b42a42fa5d21f7e154de21890ffae71a8ac
|
Provenance
The following attestation bundles were made for xian_tech_contracting-1.0.1.tar.gz:
Publisher:
release.yml on xian-technology/xian-contracting
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xian_tech_contracting-1.0.1.tar.gz -
Subject digest:
5fa8193ee7fe939e0b9f8e4077d70c3be88c702d17509a8b74243cd91ad85fe5 - Sigstore transparency entry: 1194650006
- Sigstore integration time:
-
Permalink:
xian-technology/xian-contracting@38d956b42f933602c386b376877d5104936e936e -
Branch / Tag:
refs/tags/contracting-v1.0.1 - Owner: https://github.com/xian-technology
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@38d956b42f933602c386b376877d5104936e936e -
Trigger Event:
push
-
Statement type:
File details
Details for the file xian_tech_contracting-1.0.1-py3-none-any.whl.
File metadata
- Download URL: xian_tech_contracting-1.0.1-py3-none-any.whl
- Upload date:
- Size: 48.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a0fa27d9fc6e47c89f2fa27b38e86e463adbd2d7701bf07cf8ae6e56a216df5
|
|
| MD5 |
04c6f12de677e70ed1d4372b80db74d2
|
|
| BLAKE2b-256 |
96b7e7402320e7e0fbac72a9ba1b0fb7e0cc03a685b2fac44a5b9ce09caf53b2
|
Provenance
The following attestation bundles were made for xian_tech_contracting-1.0.1-py3-none-any.whl:
Publisher:
release.yml on xian-technology/xian-contracting
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xian_tech_contracting-1.0.1-py3-none-any.whl -
Subject digest:
6a0fa27d9fc6e47c89f2fa27b38e86e463adbd2d7701bf07cf8ae6e56a216df5 - Sigstore transparency entry: 1194650012
- Sigstore integration time:
-
Permalink:
xian-technology/xian-contracting@38d956b42f933602c386b376877d5104936e936e -
Branch / Tag:
refs/tags/contracting-v1.0.1 - Owner: https://github.com/xian-technology
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@38d956b42f933602c386b376877d5104936e936e -
Trigger Event:
push
-
Statement type: