How to Use Zero Knowledge Dapp Boilerplate

Pran B.
6 min readJul 2, 2023
Photo by ThisisEngineering RAEng on Unsplash

We will be doing walk through of a simple zk-dapp for age verification, that will allow users to prove that they are below a certain age without revealing their actual age. This is a fairly trivial problem to solve and may not necessarily require zero-knowledge proofs but to keep things simple and easy to understand we will go ahead with this idea.

The overview of the architecture looks something like the below.

We will be using a nextjs app to interact with the smart contract and take user input (age) which is meant to be private and will not be published on-chain. The proof generation occurs on the frontend using snarkjs. There are two smart contracts for this dapp, AgeCheck and Verifier:

  • AgeCheck.sol takes proof inputs from the frontend app and maintains the mapping of addresses if they are verified or not.
  • Verifier.sol has one purpose i.e. to verify the proof.

There are lots of different ways to generate zero-knowledge proofs and these are continuously evolving. There is a lot of advancement going in the zero-knowledge space. For the purpose of this dapp, we will be using SNARK proofs, more…

--

--