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/zerostylEverything 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
halo2Leverage halo2 zk-SNARKs to prove computational integrity without revealing private inputs. Your data stays private, always.
Arbitrum Stylus Native
no-stdBuilt from the ground up for Arbitrum Stylus. Your Rust smart contracts compile to optimized WASM with minimal binary footprint.
Complete CLI Toolchain
CLISpecialized 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
verifierA 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
circuitsThree reference circuits for state masking, transaction privacy, and private voting. Use them as-is or as a template for your own.
Rich Debug Output
debugCleaner diagnostics than bare halo2. Inspect witnesses, trace constraint failures, and understand your circuit with detailed output.
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 debug --circuit state_mask \ --witnesses state_mask.json
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 generate --circuit state_mask \ --witnesses state_mask.json --output proof.bin
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 transform \ --contract contract.rs --output-dir generated
A reference circuit library
Three reference circuits covering common privacy patterns — use them as-is or as a template for your own.
State Mask
Range + Comparisonexamples/state_maskProve 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.
Tx Privacy
Transfer Shieldexamples/tx_privacyValidate 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
Anonymous Votingexamples/private_voteCast 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.
From witness to verified proof
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.
// witnesses/state_mask_valid.json { "state_value": "42", "nonce": "123", "collateral_ratio": "200", "hidden_balance": "500", "threshold": "100" }
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.
$ zerostyl-debug debug --circuit state_mask \ --witnesses state_mask.json === Debug Report: state_mask === Circuit: state_mask k=10 Result: ALL CONSTRAINTS SATISFIED
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.
$ 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.
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.
$ zerostyl-prove verify --circuit state_mask \ --proof proof.bin --inputs public_inputs.json ZeroStyl Verifier — circuit: state_mask k: 10 Proof is VALID Done.
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-sdkWitness builder, proving and verification helpers, and typed-bindings codegen for Rust projects.
$ cargo add zerostyl-sdk@zerostyl/sdk-tsGenerate typed TypeScript bindings from a circuit's abi.json — keep your dApp in lock-step with the circuit.
$ npm install @zerostyl/sdk-tszerostyl-sdkGenerate typed Python bindings from the same abi.json. Pure Python, zero runtime dependencies.
$ pip install zerostyl-sdkCommand-line tools
zerostyl-debug, zerostyl-prove, zerostyl-export and zerostyl-orbit are built from source with Cargo.
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