The Project Template creates an end-to-end Ziren project: a guest program proved by the Ziren zkVM, a host that executes it and generates proofs, and the on-chain Solidity verifier for the proofs.
It targets Ziren V2.0: the Ziren crates come from the main branch of
ProjectZKM/Ziren, and the verifier contracts are the v2.0.0
ones in contracts/src/v2.0.0.
Two provers are available:
- Local prover: generate proofs on your own machine.
- Network prover: generate proofs on the ZKM proof network.
Install the Ziren toolchain (release 20260917 or later) and follow the instructions:
curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/ProjectZKM/toolchain/refs/heads/main/setup.sh | sh
source ~/.zkm-toolchain/envAfter source ~/.zkm-toolchain/env the host builds with the Ziren toolchain's cargo; without it,
rustup builds the host with the nightly pinned in rust-toolchain.toml, the one Ziren itself is
built with. The guest is always built with the Ziren toolchain.
- Local proving: x86_64 Linux. Core and compressed proofs of this example need a few GB of memory;
Groth16 and PLONK proofs need about 80 GB, and Go 1.23 or later for the gnark prover (Ziren's
go.moddeclaresgo 1.23.0). - Network proving: x86_64 Linux, a registered address (apply here) and the network's client certificates.
Note
All commands below run from the repository root unless they cd first.
There are four ways to run this project:
- Execute the program.
- Generate a core proof.
- Generate a compressed proof.
- Generate an EVM-compatible (Groth16 or PLONK) proof.
The guest program is built automatically by host/build.rs whenever the host is built.
cd host
cargo run --release -- --executeThis executes the guest program without proving it, checks its output and prints the cycle count.
cd host
cargo run --release -- --corecd host
cargo run --release -- --compressedSee proof types for the difference between core and compressed proofs.
Groth16 and PLONK proofs are cheap to verify on Ethereum but take longer to generate than core or
compressed proofs. The first run downloads the v2.0.0 circuit artifacts to ~/.zkm/circuits.
cd host
cargo run --release --bin evm -- --system groth16
cargo run --release --bin evm -- --system plonkEach command verifies the proof and writes a fixture to contracts/src/fixtures/ that the Solidity
tests verify.
The programVKey your on-chain contract checks proofs against:
cd host
cargo run --release --bin vkeySet the prover in .env (see .env.example):
ZKM_PROVER=network
ZKM_PRIVATE_KEY=
SSL_CERT_PATH=
SSL_KEY_PATH=
CA_CERT_PATH=The network prover generates compressed and Groth16 proofs. See the network prover documentation for the endpoint and certificate settings.
Install Foundry if you do not have it:
curl -L https://foundry.paradigm.xyz | bashcd contracts
forge testThe tests verify the Groth16 and PLONK fixtures against the v2.0.0 verifiers, and check that a
changed proof or changed public values are rejected.
cd contracts
forge script script/ZKMVerifierGroth16.s.sol:ZKMVerifierGroth16Script --rpc-url <RPC_URL> --private-key <PRIVATE_KEY> --broadcastUse script/ZKMVerifierPlonk.s.sol:ZKMVerifierPlonkScript for the PLONK verifier. For more details,
see the contracts guide.
