2022-06-06 12:00:27 +02:00
2022-05-31 18:22:30 +02:00
2022-05-31 18:22:30 +02:00
2022-05-31 18:22:30 +02:00
2022-01-27 11:24:48 +01:00
2022-05-31 18:22:30 +02:00
2022-05-31 18:22:30 +02:00
2022-05-19 11:31:54 +02:00
2022-05-31 19:01:21 +02:00
2022-05-31 23:24:08 +02:00
2022-05-31 18:22:30 +02:00

Semaphore

Github license GitHub Workflow test Coveralls Linter eslint Code style prettier Repository top language

Semaphore is a protocol, designed to be a simple and generic privacy layer for Ethereum DApps. Using zero knowledge, Ethereum users can prove their membership of a group and send signals such as votes or endorsements without revealing their original identity.

The core of the Semaphore protocol is in the circuit logic. However Semaphore also provides Solidity contracts (NPM: @semaphore-protocol/contracts) and JavaScript libraries (NPM: @zk-kit/identity, @zk-kit/protocols) to make the steps for offchain proof creation and onchain verification easier. To learn more about Semaphore visit https://semaphore.appliedzkp.org.

⚠️ Semaphore V2 has not yet been audited. Please do not use it in production. You can find Semaphore V1 on version/1.0.0.


Install

Clone this repository and install the dependencies:

git clone https://github.com/semaphore-protocol/semaphore.git
cd semaphore
yarn # or `npm i`

Usage

Copy the .env.example file and rename it .env.

ZK files

Download the Semaphore zero-knowledge files needed to generate proofs:

yarn download:zk-files

Compile

Compile the smart contracts with Hardhat:

yarn compile

Lint

Lint the Solidity or the TypeScript code:

yarn lint:sol
yarn lint:ts
# or yarn lint to lint both.

And check if the code is well formatted:

yarn prettier

Test

Run the Mocha tests:

yarn test

Coverage

Generate the code coverage report:

yarn test:coverage

Report Gas

See the gas usage per unit test and average gas per method call:

yarn test:report-gas

Deploy

Deploy a verifier contract with depth = 20:

yarn deploy:verifier --depth 20

Deploy the Semaphore.sol contract with one verifier:

yarn deploy:semaphore --verifiers '[{"merkleTreeDepth": 20, "contractAddress": "0x06bcD633988c1CE7Bd134DbE2C12119b6f3E4bD1"}]'

Deploy all verifiers and Semaphore contract:

yarn deploy:all

If you want to deploy contracts in a specific network you can set up the DEFAULT_NETWORK variable in your .env file with the name of one of our supported networks (hardhat, localhost, goerli, kovan, arbitrum). Or you can specify it as option:

yarn deploy:all --network kovan
yarn deploy:all --network localhost

If you want to deploy the contracts on Goerli, Kovan or Arbitrum remember to provide a valid private key and an Infura API in your .env file.

Description
No description provided
Readme MIT 26 MiB
Languages
TypeScript 72.2%
Solidity 21.4%
EJS 2.6%
CSS 1.8%
Circom 1.1%
Other 0.9%