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/u128int, boolbool, fp/bytes32/addressstr (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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zerostyl_sdk-0.1.1.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

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

zerostyl_sdk-0.1.1-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file zerostyl_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: zerostyl_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.15

File hashes

Hashes for zerostyl_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bbbd54068c25d24054466c78906a9a709187730df53e157bba25dbf76b93634b
MD5 875f0903747b41a0cea8a597240886d7
BLAKE2b-256 574bc1165ba569533b61166f50f563a4a78a6c7b618bf8324243953569cc8626

See more details on using hashes here.

File details

Details for the file zerostyl_sdk-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: zerostyl_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.15

File hashes

Hashes for zerostyl_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a5117eff5fa27c18cad03e3147e897ca59a592a43845a4696e7287b60352d396
MD5 f759e9fa5fe6ce5edc57c4c657747631
BLAKE2b-256 57aa95eb0298bd0a519bb2a487cd21fdbb472b900560f354ef3c1d8976da86d0

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 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