semaphore-protocol / semaphore

A zero-knowledge protocol for anonymous interactions.
https://semaphore.pse.dev
MIT License
925 stars 207 forks source link
circom ethereum hacktoberfest javascript monorepo proof-of-membership semaphore solidity typescript zero-knowledge zero-knowledge-proofs zk-snarks

Semaphore icon

Github license GitHub Workflow test Coveralls DeepScan grade Linter eslint Code style prettier Repository top language Commitizen friendly

👥 Contributing   |   🤝 Code of conduct   |   🔎 Issues   |   🗣️ Chat & Support   |   💻 API Reference

| Semaphore is a generic privacy layer. Leveraging zero-knowledge technology, users can prove their membership in groups and send messages (extending from votes to endorsements) off-chain or across EVM-compatible blockchains, all without revealing their personal identity. | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | The core of the Semaphore protocol is in the [circuit logic](/packages/circuits/scheme.png). However, Semaphore also provides [Solidity contracts](/packages/contracts) and JavaScript libraries to make the steps for offchain proof creation and onchain/offchain verification easier. To learn more about Semaphore visit [semaphore.pse.dev](https://semaphore.pse.dev). > [!IMPORTANT] > Help Semaphore prosper by sharing your ideas with the PSE [acceleration program](https://github.com/privacy-scaling-explorations/acceleration-program). ## 📦 Packages
Package Version Downloads
@semaphore-protocol/core NPM version Downloads
@semaphore-protocol/contracts NPM version Downloads
@semaphore-protocol/identity (docs) NPM version Downloads
@semaphore-protocol/group (docs) NPM version Downloads
@semaphore-protocol/proof (docs) NPM version Downloads
@semaphore-protocol/data (docs) NPM version Downloads
@semaphore-protocol/hardhat NPM version Downloads
@semaphore-protocol/cli NPM version Downloads
@semaphore-protocol/utils (docs) NPM version Downloads
## 🛠 Install Clone this repository: ```bash git clone https://github.com/semaphore-protocol/semaphore.git ``` And install the dependencies: ```bash cd semaphore && yarn ``` ## 📜 Usage Copy the `.env.example` file as `.env`: ```bash cp .env.example .env ``` And add your environment variables. ### Code quality and formatting Run [ESLint](https://eslint.org/) to analyze the code and catch bugs: ```bash yarn lint ``` Run [Prettier](https://prettier.io/) to check formatting rules: ```bash yarn format ``` Or to automatically format the code: ```bash yarn format:write ``` ### Conventional commits Semaphore uses [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/). A [command line utility](https://github.com/commitizen/cz-cli) to commit using the correct syntax can be used by running: ```bash git commit ``` It will also automatically check that the modified files comply with ESLint and Prettier rules. ### Testing Run [Jest](https://jestjs.io/) to test the JS libraries: ```bash yarn test:libraries ``` Run [Mocha](https://mochajs.org/) to test the contracts: ```bash yarn test:contracts ``` Or test everything with: ```bash yarn test ``` ### Build libraries & compile contracts Run [Rollup](https://www.rollupjs.org) and [TheGraph](https://www.npmjs.com/package/@graphprotocol/graph-cli) to build all the packages and the subgraph: ```bash yarn build ``` Compile the smart contracts with [Hardhat](https://hardhat.org/): ```bash yarn compile:contracts ``` ### Documentation (JS libraries) Run [TypeDoc](https://typedoc.org/) to generate a documentation website for each package: ```bash yarn docs ``` The output will be placed on the `docs` folder. ### Releases Bump a new version with: ```bash yarn version:bump # e.g. yarn version:bump 2.0.0 ``` It will create a commit and a git tag that will need to be pushed on the main branch. A workflow will be triggered and will publish the Semaphore packages on [npm](https://www.npmjs.com/) and release a new version on Github with its changelogs automatically.