Skip to main content

zerostyl-sdk (Python)

Python SDK for the ZeroStyl zk toolkit on Arbitrum Stylus. Parses the exporter's abi.json documents into typed dataclasses and generates typed Python bindings — the same scope as @zerostyl/sdk-ts, in Python.

Pure Python, zero runtime dependencies, Python ≥ 3.10.

Install

pip install zerostyl-sdk

Or from a clone of the repository, for development:

cd packages/sdk-py
python -m pip install ".[dev]"

Usage

from pathlib import Path
from zerostyl_sdk import parse_abi_schema, generate_bindings

abi = parse_abi_schema(Path("abi.json").read_text())
print(abi.circuit.name, abi.circuit.num_public_inputs)

bindings = generate_bindings(abi)   # a Python module as a string
Path("deposit_bindings.py").write_text(bindings)

CLI (equivalent of the TS SDK's zerostyl-sdk generate):

zerostyl-sdk-py generate --abi abi.json --out bindings.py
python -m zerostyl_sdk generate --abi abi.json

Generated output for the demo circuit:

DEPOSIT_CIRCUIT: Final = {
    "name": "deposit",
    ...
}

@dataclass(frozen=True)
class DepositWitness:
    collateral: str
    collateral_nonce: str
    threshold: str

@dataclass(frozen=True)
class DepositPublicInputs:
    collateral_commitment: str

Type mapping: u64/u128 → int, bool → bool, fp/bytes32/address → str (0x-prefixed hex), arrays → tuple[..., ...].

Tests

python -m pytest
ruff check src tests

The snapshot test locks the generated bindings for examples/zk_private_demo/abi.json; regenerate with REGEN_SDK_PY_SNAPSHOTS=1 python -m pytest.

Scope and future work

Codegen only — proof generation from Python (bindings to the Rust prover) and on-chain submission helpers are future work, mirroring the TypeScript SDK's roadmap.

License

MIT — see the repository's LICENSE.

Metadata

Release files for zerostyl-sdk 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zerostyl-sdk 0.1.1
File Size Uploaded
zerostyl_sdk-0.1.1.tar.gz 9.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for zerostyl-sdk 0.1.1
File Interpreter ABI Platform
zerostyl_sdk-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 18.2 kB

Release files / zerostyl_sdk-0.1.1.tar.gz

Download URL zerostyl_sdk-0.1.1.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
bbbd54068c25d24054466c78906a9a709187730df53e157bba25dbf76b93634b
BLAKE2b-256 checksum
How to use checksums
574bc1165ba569533b61166f50f563a4a78a6c7b618bf8324243953569cc8626
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release files / zerostyl_sdk-0.1.1-py3-none-any.whl

Download URL zerostyl_sdk-0.1.1-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a5117eff5fa27c18cad03e3147e897ca59a592a43845a4696e7287b60352d396
BLAKE2b-256 checksum
How to use checksums
57aa95eb0298bd0a519bb2a487cd21fdbb472b900560f354ef3c1d8976da86d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page