[Final Report] ZeroStyl — Privacy Toolkit for Arbitrum Stylus
Program: Domain Allocators for Developer Tooling
Repository: GitHub - kazai777/zerostyl: ZeroStyl is an open-source Rust-based toolkit to streamline privacy-preserving smart contract development on Arbitrum Stylus. · GitHub
License: MIT (fully open-source)
Executive summary
ZeroStyl is an open-source Rust toolkit that makes privacy-preserving smart contracts practical to build on Arbitrum Stylus, using halo2 zk-SNARKs (KZG polynomial commitment on the BN254 curve).
Over the grant, ZeroStyl grew from a design into a complete local zero-knowledge development workflow: developers can build and debug halo2 circuits, generate and verify proofs off-chain, export privacy-safe contract ABIs from annotated Stylus functions, and generate typed client SDKs in three languages — all without an external proving service. The toolkit also ships an Orbit deployability adapter for per-chain analysis and a runtime + technical dashboard providing the standardized on-chain event and fingerprinting primitives.
All source code is public and MIT-licensed. The reusable library crates and the client SDKs are published on crates.io, npm, and PyPI.
Milestone 1 — zk-Compiler & reference circuits
A Rust library that turns halo2 zk-SNARK circuits into WASM-targetable components for the Stylus runtime, together with a set of reference circuits.
Delivered:
- Circuit-building library (
zerostyl-compiler) on the halo2 PSE fork (KZG/BN254), plus a dedicatedno_std/wasm32gadget crate (zerostyl-gadgets) providing Poseidon, range-check, comparison and Merkle-membership gadgets — the building blocks for privacy circuits that must eventually run in a WASM verifier. - Three reference circuits (the proposal targeted two —
private_votewas added as a bonus):state_mask— proves a hiddencollateral_ratiolies within[150, 300]and thathidden_balance > threshold, while committing to the secret values with a Poseidon hash. (Private solvency / eligibility.)tx_privacy— validates a private token transfer through balance conservation, Merkle membership of the spent note, and an unlinkable nullifier, without revealing balances or the amount.private_vote— casts a boolean vote proving eligibility (balance ≥ threshold), committing to both the balance and the vote with Poseidon.
- Local Stylus tests and a comprehensive automated test suite, with CI running build, tests,
clippy, formatting and awasm32build across Linux, macOS and Windows, plus a dedicated coverage job. - 5-minute demo video: https://youtu.be/OTnLZRm5Ww8
Proof: crates/zerostyl-compiler · crates/zerostyl-gadgets · examples/ (circuits) · CI workflows
Milestone 2 — Privacy Debugger & on-chain integration
A command-line debugger built around zk-mocking, plus off-chain proving/verification and reference verifier contracts on testnet.
Delivered:
zerostyl-debug— the privacy debugger. Uses halo2’s MockProver (zk-mocking: constraint checking without generating a full proof) to run a witness against a circuit and report exactly which gate and region fails, with readable diagnostics. Sub-commands:inspect(columns/gates/constraints/degree),schema(expected witness JSON),witness(assignments + derived public inputs),debug(failure diagnostics).zerostyl-prove— off-chain proving/verification. Generates a compact halo2-KZG proof from a witness (measured proof size ~2.7 KB) and verifies it against the circuit’s public inputs. Proving parameters are cached after first use.zerostyl-verifier— ano_stdverifier library implementing halo2-KZG verification for the Arbitrum Stylus runtime, with the verifying key and parameters embedded at build time (no runtime keygen). Compiles towasm32-unknown-unknown.
Proof: crates/zerostyl-debugger · crates/zerostyl-cli · crates/zerostyl-verifier · docs/DEPLOYMENTS.md
Milestone 3 — Toolkit launch, Orbit adapter & STARK study
The privacy-safe ABI exporter, multi-language SDKs, documentation, published packages, the Orbit adapter module, and the zk-STARKs feasibility study.
Delivered:
zerostyl-export— the zk-safe ABI exporter. Scans a Stylus contract for parameters annotated with#[zk_private]and generates, for each circuit: a halo2 circuit, a backend-agnostic descriptor, a privacy-safe ABI (abi.json, replacing private parameters with a commitment + proof), and a transformed contract module.- Typed client SDKs in three languages, all reading the same
abi.json:- Rust —
zerostyl-sdk: registry, prove/verify helpers, witness builder, proof envelope. - TypeScript —
@zerostyl/sdk-ts:abi.json→ typed TypeScript module. - Python —
zerostyl-sdk:abi.json→ typed dataclasses, pure Python.
- Rust —
- Package publication: SDKs on npm and PyPI, and the reusable library crates (
zerostyl-sdk,zerostyl-orbit,zerostyl-circuits,zerostyl-runtime) on crates.io. - Documentation & tutorials at docs.zerostyl.dev (installation, quick start, CLI reference, circuit reference, end-to-end tutorials, and an events/fingerprinting reference).
- Mock DeFi integration: reference verifier contracts on Arbitrum Sepolia covering private lending (solvency), private swaps and voting patterns.
- zk-STARKs feasibility study:
docs/STARK_FEASIBILITY.md— analyzes FRI-based transparent/post-quantum proving against the project’s measured constraints and outlines when a STARK backend would make sense behind the toolkit’s backend-agnostic circuit interface. - Orbit zk-Adapter Module (
zerostyl-orbit): per-chain configuration profiles (size caps, ink/gas model, required precompiles) as TOML, built-in profiles for Arbitrum One / Nova / Sepolia and a customizable Orbit template, deployability analysis (Brotli-compressed sizing against a chain’s on-chain budget), a precompile-requirement mapping per proving system, and a multi-chain analysis CLI (list/show/check/matrix/init). zerostyl-runtime+ technical dashboard. The runtime crate provides the standardizedZeroStylPrivacyTransactionevent (with its canonical signature andtopic0) and theBytecodeFingerprintprimitive — a single source of truth for on-chain tracking. The technical dashboard exposes the event schema, its exacttopic0, a live client-side keccak256 fingerprint tool, and the deployed-contract registry.
Proof: crates/zerostyl-exporter · crates/zerostyl-sdk · packages/sdk-ts · packages/sdk-py · crates/zerostyl-orbit · crates/zerostyl-runtime · Dashboard: Dashboard | ZeroStyl
Technical architecture
- Proof system: halo2 (PSE fork) with a KZG polynomial commitment on BN254, SHPLONK, Keccak transcript.
- Workspace (Rust, MIT):
zerostyl-circuits Backend-agnostic circuit descriptors, registry & ABI schema (published)
zerostyl-gadgets no_std/wasm32 halo2 gadgets — Poseidon, range, comparison, Merkle
zerostyl-compiler halo2 circuit construction for the reference circuits
zerostyl-runtime On-chain primitives — privacy event & bytecode fingerprint (published)
zerostyl-verifier no_std halo2-KZG verifier for the Stylus runtime
zerostyl-sdk Rust client SDK (published)
zerostyl-orbit Per-chain deployability analysis + CLI (published)
zerostyl-debugger `zerostyl-debug` — circuit inspection & witness diagnostics
zerostyl-cli `zerostyl-prove` — off-chain proving & verification
zerostyl-exporter `zerostyl-export` — #[zk_private] → circuit + ABI + bindings
packages/sdk-ts TypeScript SDK (@zerostyl/sdk-ts, npm)
packages/sdk-py Python SDK (zerostyl-sdk, PyPI)
- Command-line tools:
zerostyl-debug,zerostyl-prove,zerostyl-export,zerostyl-orbit. - On-chain path: the verifier and gadget crates compile to
wasm32-unknown-unknownfor the Stylus runtime.
Project resources
- GitHub: GitHub - kazai777/zerostyl: ZeroStyl is an open-source Rust-based toolkit to streamline privacy-preserving smart contract development on Arbitrum Stylus. · GitHub
- Documentation: https://docs.zerostyl.dev
- Technical dashboard: Dashboard | ZeroStyl
- crates.io: zerostyl-sdk · zerostyl-orbit · zerostyl-circuits · zerostyl-runtime
- npm: @zerostyl/sdk-ts
- PyPI: zerostyl-sdk
- zk-STARKs study:
docs/STARK_FEASIBILITY.md
Closing
ZeroStyl delivers an end-to-end, open-source zero-knowledge development workflow for Arbitrum Stylus — from circuit building and debugging to proving, verification, privacy-safe ABI export, typed SDKs, and per-chain deployability analysis.
The work does not stop at the close of the grant. The focus going forward is to improve the toolkit as far as it can go, to have it professionally audited, and to grow awareness so that more developers adopt privacy tooling on Stylus.