/nycfrontend

nonsense

Primary LanguageTypeScriptMIT LicenseMIT

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.