dnalob / ETHNYC

hacking 2022

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Semaphore icon. Semaphore Boilerplate

A simple Next.js/Hardhat privacy application with Semaphore.

Github license Next.js Hardhat

The code can be divided into contracts, frontend and backend.

  • Greeters.sol contains the root of an offchain Merkle tree to represent the greeters (tree leaves), i.e. the identity commitments generated using the first 3 Ethereum accounts of the Hardhat testing wallet. It also contains a simple function to allow greeters to greet, only once and only if they create a valid Semaphore proof.
  • The frontend code allows greeters to create a Semaphore identity with a signed Metamask message (using one of the first 3 Hardhat accounts) and a valid zero-knowledge proof.
  • The backend code is an API that sends a greet transaction signed by the contract owner with the zero-knowledge proof of a greeter.

๐Ÿ›  Install

Clone this repository and install the dependencies:

git clone https://github.com/cedoor/semaphore-boilerplate.git
cd semaphore-boilerplate
yarn

๐Ÿ“œ Usage

1. Compile & test the contract

yarn compile
yarn test

2. Run Next.js server & Hardhat network

yarn dev

3. Deploy the contract

yarn deploy --network localhost

4. Open the app

You can open the web app on http://localhost:3000.

5. Install Metamask and connect the Hardhat wallet

You can find the mnemonic phrase here.

6. Create your proof

You must use one of the first 3 Hardhat accounts.

About

hacking 2022

License:MIT License


Languages

Language:TypeScript 55.6%Language:Solidity 35.7%Language:CSS 5.1%Language:JavaScript 3.1%Language:Shell 0.6%