Skip to main content

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 code
  • packages/: shared packages such as xian-runtime-types, xian-accounts, the native tracer, and xian-zk
  • tests/: unit, integration, and security coverage
  • docs/: 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

xian_tech_contracting-1.0.6.tar.gz (74.7 kB view details)

Uploaded Source

Built Distribution

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

xian_tech_contracting-1.0.6-py3-none-any.whl (87.5 kB view details)

Uploaded Python 3

File details

Details for the file xian_tech_contracting-1.0.6.tar.gz.

File metadata

  • Download URL: xian_tech_contracting-1.0.6.tar.gz
  • Upload date:
  • Size: 74.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for xian_tech_contracting-1.0.6.tar.gz
Algorithm Hash digest
SHA256 f31e27dde9b1d4a0b326cd9bd90988cccccb41216d3e2c878f9ea004020a7458
MD5 a4e518a2545fd75f4b4b76ff7ac143a9
BLAKE2b-256 c90bd19fecb31d3b7c14cf18148f8e88d320c682477ab8a4649b44e6e91ce5b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for xian_tech_contracting-1.0.6.tar.gz:

Publisher: release.yml on xian-technology/xian-contracting

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xian_tech_contracting-1.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for xian_tech_contracting-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 7d7217624bd044d013ddf9d02515419372817e921e128ed17460d3579ca1346c
MD5 becd138aedda722016eb288954124c0a
BLAKE2b-256 84ff88d5e4023262e5b7eb2018a3d3d82ae0418a0b4bea912468cfacf5bd2d3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for xian_tech_contracting-1.0.6-py3-none-any.whl:

Publisher: release.yml on xian-technology/xian-contracting

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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