Git Product home page Git Product logo

semaphore's Introduction

Semaphore icon. Semaphore

Github license GitHub Workflow test GitHub Workflow style 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 to make the steps for offchain proof creation and onchain verification easier. To learn more about Semaphore visit semaphore.appliedzkp.org.

You can find Semaphore V1 on version/1.0.0.


🛠 Install

Clone this repository:

git clone https://github.com/semaphore-protocol/semaphore.git

and install the dependencies:

cd semaphore && yarn

📜 Usage

Copy the .env.example file as .env:

cp .env.example .env

and add your environment variables.

Code quality and formatting

Run ESLint to analyze the code and catch bugs:

yarn lint

Run Prettier to check formatting rules:

yarn prettier

or to automatically format the code:

yarn prettier:write

Conventional commits

Semaphore uses conventional commits. A command line utility to commit using the correct syntax can be used by running:

yarn commit

It will also automatically check that the modified files comply with ESLint and Prettier rules.

Snark artifacts

Download the Semaphore snark artifacts needed to generate and verify proofs:

yarn download:snark-artifacts

Compile contracts

Compile the smart contracts with Hardhat:

yarn compile

Testing

Run Mocha to test the contracts:

yarn test

You can also generate a test coverage report:

yarn test:coverage

or a test gas report:

yarn test:report-gas

Deploy contracts

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 contracts on Goerli, Kovan or Arbitrum, remember to provide a valid private key and an Infura API in your .env file.

semaphore's People

Contributors

cedoor avatar kobigurk avatar recmo avatar 0xorbus avatar weijiekoh avatar akinovak avatar cddelta avatar tomoima525 avatar vplasencia avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.