zerostyl-verifier
zerostyl-verifier is a no_std Rust library crate (no CLI binary) that implements halo2-KZG
proof verification for the Arbitrum Stylus runtime. It embeds the KZG parameters and a serialized
verifying key at build time, so verification needs no runtime keygen.
zerostyl-verifier is a dependency you add to a Stylus contract project, not a command you run. It
is not installed alongside the CLI tools.
Adding it to a project
zerostyl-verifier is not published to crates.io — depend on the repository via git. The workspace
also patches halo2_proofs to the PSE fork, which a consumer must replicate:
[dependencies]
zerostyl-verifier = { git = "https://github.com/kazai777/zerostyl", default-features = false }
stylus-sdk = "0.9.0"
[patch.crates-io]
halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v0.3.0" }
The crate is no_std and requires an allocator; the Stylus SDK provides one when building for
wasm32-unknown-unknown.
Features
| Feature | Effect |
|---|---|
std (default) | Host build; embeds the reference verifying key |
stylus | Pulls stylus-sdk + alloy-primitives for a Stylus target |
embedded_vk | Embed the KZG params + serialized VK at build time |
state_mask_vk | Additionally embed the state_mask circuit's VK and expose verify_state_mask_bytes |
API
// Reference verifier (embedded VK + params).
pub fn verify(proof: &[u8], public_inputs: &[u8]) -> Result<bool, Vec<u8>>;
// With the `state_mask_vk` feature: verify a state_mask proof.
// `public_inputs` are 32-byte little-endian field representations (Fr::to_repr()).
#[cfg(feature = "state_mask_vk")]
pub fn verify_state_mask_bytes(
proof: &[u8],
public_inputs: &[[u8; 32]],
) -> Result<bool, Vec<u8>>;
Each returns Ok(true) when the proof verifies, Ok(false) when it does not, and Err(_) when an
input is malformed (for example a non-canonical field element).
On-chain size
The crate compiles for wasm32-unknown-unknown, but a full halo2-KZG verifier exceeds Arbitrum
Stylus's 24 KB Brotli-compressed contract limit (the state_mask verifier is ~240 KB compressed).
It is a correct, tested reference verifier, not a deployable contract. The deployed demo
contracts record a proof hash instead. Use zerostyl-orbit
to check an artifact's size against a given chain, and see
Verifier Integration for the honest on-chain model and
the paths (BN254-precompile / Groth16 wrap) that would fit the budget.