Skip to content

top1st/zk_plonk_dapp

Repository files navigation

Summary

Circuit

  1. Write circom circuit

  2. Compile the circuit:

circom circuit.circom --r1cs --wasm --sym
  1. Download a powers of tau trusted setup file

  2. Run Plonk setup to get the proving key:

snarkjs plonk setup circuit.r1cs ptau_file.ptau proving_key.zkey

Contract

  1. Export verifier smart contract
snarkjs zkey export solidityverifier proving_key.zkey verifier.sol
  1. Integrate verifier into your Solidity project

Frontend

  1. Take user inputs

  2. Calculate witness & generate proof in one step

await snarkjs.plonk.fullProve({ inputs }, wasmPath, provingKeyPath);
  1. Submit transaction with proof to Verifier contract