Sponsored Content
Skip to content

Latest commit

Β 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⚑ zk verifier β€” egold

zero-knowledge proof verification on ethereum sepolia testnet
groth16 Β· circom Β· snarkjs Β· solidity Β· foundry


overview

a minimal zk-snark verifier dapp that demonstrates groth16 proof verification on-chain. the circuit proves knowledge of two factors a and b such that a Γ— b = c, verified trustlessly on ethereum.

live contract β€” sepolia testnet

component address
groth16 verifier 0x29DD4CC005bEa9969a3120fb930F2a59fAEDB15D

how it works

1.circuit β†’ multiplier.circom (a Γ— b = c) 2.setup β†’ groth16 trusted setup (pot12 ptau) 3.witness β†’ snarkjs witness generation 4.proof β†’ groth16.fullProve() 5.verify β†’ on-chain via solidity verifier the public signal 0x21 (decimal 33 = 3 Γ— 11) is committed on-chain.
the verifier checks the groth16 pairing equations using the bn128 elliptic curve.


stack

layer tool
zk circuit circom 2.0
proof system groth16 (snarkjs)
smart contract solidity 0.8.x
deployment foundry forge
frontend react + vite + ethers.js v6
network ethereum sepolia

project structure

zkphase2/ β”œβ”€β”€ multiplier.circom # zk circuit β”œβ”€β”€ multiplier_final.zkey # groth16 proving key β”œβ”€β”€ verification_key.json # verification key β”œβ”€β”€ Verifier.sol # on-chain groth16 verifier β”œβ”€β”€ proof.json # sample proof β”œβ”€β”€ public.json # public signals β”œβ”€β”€ zk-deploy/ # foundry deployment β”‚ β”œβ”€β”€ src/Verifier.sol β”‚ └── .env.example └── zk-frontend/ # react dapp └── src/App.jsx

run locally

git clone https://github.com/ar1as1/zk-verifier-egold
cd zkphase2/zk-frontend
npm install
npm run dev

open http://localhost:5173 β€” click verify zk proof


generate your own proof

# install deps
npm install -g snarkjs circom

# compile circuit
circom multiplier.circom --r1cs --wasm --sym

# generate witness
node multiplier_js/generate_witness.js multiplier_js/multiplier.wasm input.json witness.wtns

# generate proof
snarkjs groth16 prove multiplier_final.zkey witness.wtns proof.json public.json

# verify locally
snarkjs groth16 verify verification_key.json public.json proof.json

deploy verifier

cd zk-deploy
cp .env.example .env
# add PRIVATE_KEY and SEPOLIA_RPC to .env

forge create src/Verifier.sol:Groth16Verifier \
  --rpc-url $SEPOLIA_RPC \
  --private-key $PRIVATE_KEY \
  --broadcast

zk circuit

pragma circom 2.0.0;

template Multiplier2() {
    signal input a;
    signal input b;
    signal output c;
    c <== a * b;
}

component main = Multiplier2();

constraint: c === a Γ— b β€” proven without revealing a or b


environment

tested on:

  • circom 2.2.3
  • snarkjs 0.7.6
  • node v25.9.0
  • forge 1.5.1
  • blackarch linux / kernel 6.12

license

mit β€” built by egold

About

ZK-SNARK proof verifier on Ethereum β€” Groth16 Β· Circom Β· Sepolia testnet

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages