The Project Template allows the developer to create an end-to-end zkMIPS project and the on-chain Solidity verifier.
Two provers have been provided:
- Local Prover: Use your machine to run the prover and generate the proof by your end.
- Network Prover: Use ZKM proof network to generate the proof via our Restful API.
First to install zkm toolchain run the following command and follow the instructions:
curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/zkMIPS/toolchain/refs/heads/main/setup.sh | sh
source ~/.zkm-toolchain/env
- Hardware: X86_64 CPU, 32 cores, 13GB memory (minimum)
- OS: Linux
- Rust: 1.81.0-nightly
- Go : 1.22.1
- Set up a local node for some blockchain(eg, sepolia)
- Hardware: X86_64 CPU, 8 cores, 8G memory
- OS: Linux
- Rust: 1.81.0-nightly
- Go : 1.22.1
- CA certificate: ca.pem, ca.key
- Register your address to use
- RPC for a blockchain (eg, sepolia)
Note
All actions are assumed to be from the base directory zkm-project-template
There are four main ways to run this project:
- Execute a program.
- Generate a core proof.
- Generate a compressed proof.
- Generate an EVM-compatible proof.
The program is automatically built through ./host/build.rs
whenever the host is built.
To run the guest program without generating a proof:
cd host
cargo run --release -- --execute
This will execute the guest program and display the output.
To generate a zkMIPS core proof for your guest program:
cd host
cargo run --release -- --core
To generate a zkMIPS compressed proof for your guest program:
cd host
cargo run --release -- --compressed
Producing a proof that’s cheap to verify on Ethereum (e.g., Groth16 or PLONK) is more computationally intensive than generating a core or compressed proof.
- To generate a Groth16 proof:
cd host
cargo run --release --bin evm -- --system groth16
- To generate a PLONK proof:
cargo run --release --bin evm -- --system plonk
These commands will also generate fixtures that can be used to test verification of zkMIPS proofs in Solidity.
Note
Do not set ZKM_PROVER=network
when generating a core, compressed or PLONK proof — the network prover only supports Groth16.
To retrieve your programVKey
for your on-chain contract, run the following command in host
:
cargo run --release --bin vkey
Refer to this document.
The proving workflow involves several stages—queuing, splitting, proving, aggregating, and finalizing—
each of which can take varying amounts of time. Before running the prover, ensure that you have set up the following environment variables in your .env
:
ZKM_PROVER=network
ZKM_PRIVATE_KEY=
SSL_CERT_PATH=
SSL_KEY_PATH=
If your system does not have Foundry, please install it:
curl -L https://foundry.paradigm.xyz | bash
cd zkm-project-template/contracts
forge test
Please edit the following parameters according your aim blockchain.
forge script script/verifier.s.sol:VerifierScript --rpc-url https://eth-sepolia.g.alchemy.com/v2/RH793ZL_pQkZb7KttcWcTlOjPrN0BjOW --private-key df4bc5647fdb9600ceb4943d4adff3749956a8512e5707716357b13d5ee687d9
For more details, please refer to this guide.