Skip to content

An example of aggregating multiple onchain proofs into one to reduce verification fee.

Notifications You must be signed in to change notification settings

aoraki-labs/proof-aggregation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Proof Aggregator Demo

This repo demonstrates a basic proof aggregator use case: put multiple proofs into one to reduce onchain verification fee. The idea is from vitalik's article. It comes with an aggregator and two zkevm rollups. Below is a step by step tutorial.

Preparation

  1. compile circuits
# in circuit folder
cargo build --profile release --package proof-aggregation --bin proof-aggregation
cp ./target/release/proof-aggregation .
  1. compile contract
# in contract folder
npm install
npx hardhat compile
  1. config contract/.env to your own key and get some test matic from mumbai faucet
# in contract folder
mv .env.example .env

Going Through the Process

  1. deploy the aggregator
# in contract folder
npx hardhat run ./scripts/1_deploy_aggregator.ts --network mumbai
  1. register rollup1 & rollup2 onchain
# in contract folder
npx hardhat run ./scripts/2_deploy_and_register_rollups.ts --network mumbai
  1. export aggregation verifier from circuit
# in circuit folder
./proof-aggregation export-verifier AggregationVerifier.yul
  1. set verifier
# in contract folder
npx hardhat run ./scripts/3_deploy_verifier.ts --network mumbai
  1. gen proof for rollup1 & rollup2
# in circuit folder
# gen proof for rollup1
./proof-aggregation gen-circuit1-proof proof1.json
# gen proof for rollup2
./proof-aggregation gen-circuit2-proof proof2.json
  1. submit proof1 & proof2 onchain
npx hardhat run ./scripts/4_submit_proofs.ts --network mumbai
  1. get proof1 and proof2 then gen aggregate proof
# in circuit folder
./proof-aggregation gen-aggregated-proof proof1.json proof2.json agg.json
  1. submit aggregated proof
# in contract folder
npx hardhat run ./scripts/5_submit_batch_proof.ts --network mumbai

About

An example of aggregating multiple onchain proofs into one to reduce verification fee.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published