Privacy ZK toolkit · Arbitrum Stylus

Privacy-preserving
contracts on Arbitrum Stylus

A Rust toolchain for building, proving, and verifying halo2 zk-SNARK circuits — then shipping privacy-safe contract ABIs and typed TypeScript, Python, and Rust SDKs.

$git clone https://github.com/kazai777/zerostyl
Published oncrates.ionpmPyPI
zerostyl — terminal
4CLI tools
3ZK circuits
3Client SDKs
~2.7 KBProof size
Why ZeroStyl

Everything you need for private contracts

From circuit debugging to proof verification and privacy-safe ABIs — ZeroStyl handles the ZK workflow so you can focus on building.

Zero-Knowledge Proofs

halo2

Leverage halo2 zk-SNARKs to prove computational integrity without revealing private inputs. Your data stays private, always.

Arbitrum Stylus Native

no-std

Built from the ground up for Arbitrum Stylus. Your Rust smart contracts compile to optimized WASM with minimal binary footprint.

Complete CLI Toolchain

CLI

Specialized tools for every step — debug circuits, prove and verify, export privacy-safe ABIs, and analyze per-chain deployability. A clean DX end to end.

Built for On-Chain Verification

verifier

A no_std halo2-KZG verifier targeting the Arbitrum Stylus runtime. The zerostyl-orbit adapter reports, per chain, whether a verifier fits the on-chain size budget.

Ready-Made Circuits

circuits

Three reference circuits for state masking, transaction privacy, and private voting. Use them as-is or as a template for your own.

Rich Debug Output

debug

Cleaner diagnostics than bare halo2. Inspect witnesses, trace constraint failures, and understand your circuit with detailed output.

CLI Toolchain

One toolchain, end to end

Debug circuits, generate and verify proofs, and export privacy-safe ABIs and SDKs — a complete developer experience in Rust.

zerostyl-debug

Inspect & diagnose circuits

Rich constraint diagnostics for halo2 circuits. Run the MockProver against a witness and see exactly which constraint fails, in which region — before spending time on a real proof.

zerostyl-debug
command
zerostyl-debug debug --circuit state_mask \
  --witnesses state_mask.json
output
=== Debug Report: state_mask ===
Circuit: state_mask k=10
Result: ALL CONSTRAINTS SATISFIED

zerostyl-prove

Generate & verify proofs

Off-chain halo2 KZG proving and verification. Generate a compact proof from a witness, then verify it against the circuit's public inputs.

zerostyl-prove
command
zerostyl-prove generate --circuit state_mask \
  --witnesses state_mask.json --output proof.bin
output
ZeroStyl Prover — circuit: state_mask k: 10
Proof: 2720 bytes → proof.bin
Public inputs → public_inputs.json
Done.

zerostyl-export

Circuits, ABIs & SDKs

Turn an annotated Stylus function into a halo2 circuit, a descriptor, a privacy-safe ABI, and a transformed contract — then generate typed TypeScript, Python, and Rust bindings from the ABI.

zerostyl-export
command
zerostyl-export transform \
  --contract contract.rs --output-dir generated
output
transformed circuit 'deposit' -> generated
generated/circuit.rs
generated/descriptor.rs
generated/contract_transformed.rs
generated/abi.json
ZK Circuits

A reference circuit library

Three reference circuits covering common privacy patterns — use them as-is or as a template for your own.

k=10

State Mask

Range + Comparison
examples/state_mask

Prove hidden state satisfies bounds — a collateral ratio within a range and a balance above a threshold — while committing to the secret values with a Poseidon hash.

INPUTS
collateral_ratiohidden_balancethresholdnonce
OUTPUTS
commitment
Private solvency & eligibility
k=14

Tx Privacy

Transfer Shield
examples/tx_privacy

Validate a private token transfer through balance conservation, Merkle membership of the spent note, and an unlinkable nullifier — without revealing balances or the amount.

INPUTS
balanceamountmerkle_path
OUTPUTS
nullifiercommitmentmerkle_root
Private token transfers
k=11

Private Vote

Anonymous Voting
examples/private_vote

Cast a boolean vote proving eligibility (balance ≥ threshold), committing to both the balance and the vote with Poseidon — without revealing the balance or linking the vote to an identity.

INPUTS
balancevotethreshold
OUTPUTS
balance_commitmentvote_commitment
On-chain governance privacy
How It Works

From witness to verified proof

01

Prepare your witness

Create a JSON witness file with the private inputs for the circuit you want to use. ZeroStyl ships three ready-made circuits: state_mask, tx_privacy, and private_vote.

rust
// witnesses/state_mask_valid.json
{
  "state_value":      "42",
  "nonce":            "123",
  "collateral_ratio": "200",
  "hidden_balance":   "500",
  "threshold":        "100"
}
02

Debug & validate

Run zerostyl-debug to check your witness against the circuit constraints. When something fails, it names the exact constraint and region — before you spend time on a real proof.

bash
$ zerostyl-debug debug --circuit state_mask \
    --witnesses state_mask.json

=== Debug Report: state_mask ===

Circuit: state_mask  k=10

Result: ALL CONSTRAINTS SATISFIED
03

Generate a proof

Use zerostyl-prove to generate a compact halo2 KZG proof from your witness. The proof and its public inputs are written to disk.

bash
$ zerostyl-prove generate --circuit state_mask \
    --witnesses state_mask.json --output proof.bin

ZeroStyl Prover — circuit: state_mask  k: 10
  Proof: 2720 bytes  →  proof.bin
  Public inputs  →  public_inputs.json
Done.
04

Verify the proof

Verify any proof off-chain with zerostyl-prove verify. The no_std zerostyl-verifier crate implements the same halo2-KZG verification for Arbitrum Stylus; the zerostyl-orbit adapter reports whether it fits a given chain's size budget.

bash
$ zerostyl-prove verify --circuit state_mask \
    --proof proof.bin --inputs public_inputs.json

ZeroStyl Verifier — circuit: state_mask  k: 10
  Proof is VALID
Done.
Packages

Published and ready to install

The client SDKs ship on the public registries. Add the one your stack speaks — each reads the exact same circuit schema.

zerostyl-sdk

Witness builder, proving and verification helpers, and typed-bindings codegen for Rust projects.

$ cargo add zerostyl-sdk
TypeScript
npm
@zerostyl/sdk-ts

Generate typed TypeScript bindings from a circuit's abi.json — keep your dApp in lock-step with the circuit.

$ npm install @zerostyl/sdk-ts
Python
PyPI
zerostyl-sdk

Generate typed Python bindings from the same abi.json. Pure Python, zero runtime dependencies.

$ pip install zerostyl-sdk

Command-line tools

zerostyl-debug, zerostyl-prove, zerostyl-export and zerostyl-orbit are built from source with Cargo.

Installation guide
Open source · MIT License

Start building private contracts

ZeroStyl is free, open source, and MIT licensed. Read the docs to get set up in minutes, or dive straight into the source.

$git clone https://github.com/kazai777/zerostyl