Simple demo to allow only users of gold groups to vote anonymously in a ballot.
| Interep is made of several components. The purpose of this demo is to show how to start integrating contracts and libraries, and how these components interact. This demo consists of a frontend, where users can create their own zero-knowledge proof for anonymous voting, and a backend, where an admin receives the anonymous proofs and sends transactions for onchain voting. |
|---|
flowchart TD
subgraph in [Interep]
inwa([Web App]) --- insid
insid[/Semaphore ID/] --->|Allows users \nto join groups| rs
rs{{"Back-end\n(Reputation Service)"}} --->|Stores Merkle trees| db[(MongoDB)]
rs -->|Saves Merkle roots \nevery N minutes| ic{{Interep Contract}}
ic --- isc{{Semaphore Contracts}}
rs --- api{API}
end
subgraph cl [Client]
cwa([Web App]) --- csid
api -->|Provides group data| cwa
csid[/Semaphore ID/] --->|Allows users \nto generate zk-proofs| cbe{{Back-end}}
cbe -->|Sends transaction| cc{{Client Contract}}
cc -->|Verifies zk-proofs| ic
end
* Groups are Merkle trees
* Group members are Merkle tree leaves
* Merkle tree leaves are Semaphore IDs
* Semaphore IDs are used to join groups and generate ZK proofs
Clone this repository and install its dependencies:
git clone https://github.com/interep-project/voting-app.git && cd voting-app && yarnClone the contracts and reputation-service repositories and install their dependencies.
Compile the smart contracts on voting-app and contracts:
yarn compileStart an Hardhat network on contracts:
yarn startDeploy the smart contracts on voting-app and contracts:
yarn deploy --network localhostStart the web apps on voting-app and reputation-service:
yarn dev