Skip to main content

ZeroStyl

ZeroStyl is a Rust toolkit for building privacy-preserving smart contracts on Arbitrum Stylus using halo2 zk-SNARKs (KZG commitment on BN254). It provides a complete local development workflow — debug circuits, generate and verify proofs, and export privacy-safe contract ABIs and typed SDKs — without requiring external proving services or trusted third parties.

Not production ready

ZeroStyl is under active development. APIs, proof formats, and circuit implementations may change without notice. Do not deploy to mainnet until a stable release is announced.

What is ZeroStyl?

ZeroStyl bridges the gap between zk-SNARK circuit development and EVM-compatible smart contracts. Developers write privacy-preserving logic as halo2 circuits, generate and verify proofs locally with the CLI, and ship privacy-safe contract ABIs and typed client SDKs. A no-std zerostyl-verifier crate implements the same verification for the Stylus runtime; how it fits a chain's on-chain size budget is analyzed by the zerostyl-orbit adapter.

The project targets three privacy primitives that cover a wide range of DeFi and governance use cases:

  • Confidential state assertions — prove a value satisfies a constraint without revealing it
  • Private token transfers — transfer tokens without exposing sender balances or amounts
  • Anonymous on-chain voting — cast verifiable votes that cannot be linked to a voter identity

Who Is It For?

ZeroStyl is designed for:

  • Rust developers building on Arbitrum Stylus who want to add ZK-based privacy to their contracts
  • ZK researchers exploring halo2 circuit design in a practical on-chain context
  • Protocol engineers evaluating privacy primitives for DeFi, governance, or identity applications

You should be comfortable with Rust and have a basic understanding of zero-knowledge proofs. Familiarity with halo2 is helpful but not required to get started.

Tools

ZeroStyl ships four command-line tools plus a verifier library:

ToolPurpose
zerostyl-debugInspect circuit constraints, trace witness assignments, and catch bugs before generating proofs
zerostyl-proveGenerate and verify halo2 proofs from a witness file
zerostyl-exportTurn an annotated Stylus function into a circuit, descriptor, privacy-safe ABI, and typed SDK bindings
zerostyl-orbitAnalyze per-chain deployability (size limits, gas, precompiles) for Arbitrum and Orbit chains
zerostyl-verifierA no-std library crate implementing halo2-KZG verification for the Stylus runtime

Each tool operates independently. You can use zerostyl-debug during circuit development without ever touching zerostyl-prove, or integrate zerostyl-verifier into a Stylus project on its own.

Included Circuits

Three circuits are bundled with the toolkit:

state_mask

Proves that a hidden collateral_ratio lies within a required range and that a hidden_balance exceeds a threshold, while committing to the secret values with a Poseidon hash — without disclosing any of them. Useful for private solvency, credit-scoring, and eligibility checks.

tx_privacy

Enables private token transfers using Merkle tree membership proofs. The circuit produces a nullifier (to prevent double-spending) and a commitment (to register the new note on-chain) without revealing the sender's balance or the transfer amount.

private_vote

Allows a token holder to cast a verifiable anonymous vote in an on-chain governance process. The circuit ensures one-vote-per-account via nullifier hashing while keeping the vote itself unlinkable to any specific address.

How It Fits Together

Developer writes witness.json


zerostyl-debug ──── validates constraints, prints assignment trace


zerostyl-prove ──── generates and verifies proof.bin from witness + circuit


zerostyl-verifier ──── halo2-KZG verification library for Stylus contracts