project screenshot 1
project screenshot 2
project screenshot 3

ZK-Dapp-Templates

I created two repos that can be used by developers as scaffolding templates to get their zk-dapp up an running very fast.

ZK-Dapp-Templates

Created At

Circuit Breaker

Project Description

My goal was to create a zk-demo dapp that is well integrated into modern development frameworks (such as hardhat and has important scaffolding elements already set up (such as connections to metamask/walletConnect/wagmi).

The repo (https://github.com/DOBEN/Hardhat-with-Circom) uses the ```hardhat-circom plugin. This combines the multiple steps of the circom and snarkJS workflows into your hardhat workflow and simplifies development of the circuits. There are several example circuits in the repo and everything is set up to easily switch between development/production using the commandyarn circom:dev or yarncircom:prod`. The Read.me explains how you can add your own circuits, how to compile them and how to deploy the verifier smart contract on chain, or verify proofs locally.

The repo (https://github.com/DOBEN/SnarkJS-Front-End) is a zk-dApp front end to showcase how to generate ZK-SNARK proofs (groth16 algorithm) in the browser and verify the proof in the deployed verification smart contract. The front-end interacts with the ``average.circom circuit from the first repo. It calculates and proves that the average of 5 numbers was computed correctly. TheRead.me includes a gif showing the front-end flow. The project is anext.js` dapp that has the components to connect to metamask/walletConnect/wagmi already integrated.

How it's Made

https://github.com/DOBEN/Hardhat-with-Circom It uses the hardhat-circom plugin. This combines the multiple steps of the circom and snarkJS workflows into your hardhat workflow and simplifies development of the circuit. Hardhat deployment scripts are set up to deploy the verifier smart contract on-chain. The repo is set up to switch between development/production using the command yarn circom:dev or yarn circom:prod.

https://github.com/DOBEN/SnarkJS-Front-End The project is a next.js dapp that has the components to connect to metamask/walletConnect/wagmi already integrated. It uses snarkjs to generate a zk proof. The folder ./public includes the verification key/proving key (average.vkey.json, average.wasm, average.zkey) from the first project as generated from the average.circom circuit. The average.wasm file is used together with the proving key in the snarkjs library to generate a zk proof that given the witness input, the average of 5 numbers was calculated correctly. The generated proof and the public inputs are displayed at the front end. The user can submit the proof on chain and verify that the proof is valid. The return value (valid/notValid) of the smart contract is displayed at the front end.

background image mobile

Join the mailing list

Get the latest news and updates