Semaphore
A privacy gadget for creating anonymous proof of membership on Ethereum.
| Semaphore is a zero-knowledge gadget which allows Ethereum users to prove their membership of a set without revealing their original identity. At the same time, it allows users to signal their endorsement of an arbitrary string. It is designed to be a simple and generic privacy layer for Ethereum DApps. Use cases include private voting, whistleblowing, mixers, and anonymous authentication. |
|---|
The core of the Semaphore protocol is in the circuit logic, however Semaphore provides Solidity contracts and JavaScript libraries to make the steps for offchain proof creation and onchain verification simple.
🛠 Install
You can install our Semaphore packages with npm:
npm i @zk-kit/identity @zk-kit/protocols @semaphore/contracts --save
or yarn:
yarn add @zk-kit/identity @zk-kit/protocols @semaphore/contracts
📜 Usage
Contracts
When using Semaphore contracts keep in mind that there are two types of contracts:
- Base contracts: they allow you to use the main fatures of the protocol (i.e. verify a proof or manage Merkle trees/groups).
- Extension contracts: they contain application logic and could be used for specific use-cases (e.g. anonymous voting).
Our current available extension contracts can be a good example of how base contracts can be used.
ZK-kit libraries
When using Semaphore each user will need to create their own identity, which will then be added to a group. @zk-kit/identity allows users to create and manage their identities, while @zk-kit/protocols allows users to create Semaphore proofs to prove their group membership and signal their endorsement of an arbitrary string anonymously.