https://github.com/kimiwu123/zkvote
Zero-knowledge voting based on Semaphore
https://github.com/kimiwu123/zkvote
circom zkp
Last synced: over 1 year ago
JSON representation
Zero-knowledge voting based on Semaphore
- Host: GitHub
- URL: https://github.com/kimiwu123/zkvote
- Owner: KimiWu123
- Created: 2019-12-09T08:22:02.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-01-22T10:00:14.000Z (over 4 years ago)
- Last Synced: 2024-06-19T10:16:30.729Z (almost 2 years ago)
- Topics: circom, zkp
- Language: JavaScript
- Homepage:
- Size: 31.9 MB
- Stars: 6
- Watchers: 2
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# zkVote
## Introduction
zkVote is based on Semaphore which is introduced by [barryWhiteHat](https://github.com/barryWhiteHat) as a method of zero-knowledge signaling - a method for an approved user to broadcast an arbitrary string without exposing their identity. [Semaphorejs](https://github.com/kobigurk/semaphore) is an implementation of an upgraded version of the concept, including the zero-knowledge circuits and web side. This repo is copied from semaphorejs but remove the smart contract part, it's replaced by golang client. We use semaphore as base to achieve private-voting.
The project is separated into two parts, one is implemented in plain Node.JS and uses [circom](https://github.com/iden3/circom) for the zero-knowledge proofs.[The other](https://github.com/Unitychain/zkvote-node) is implemented in Golang for verification of zero-knowledge proofs and p2p network.
### zkSNARK statement
Implemented in [**semaphorejs/cricom**](./semaphorejs/circom).
The statement assures that given public inputs:
* **signal_hash** : hash of vote opinion (0, 1)
* **external_nullifier** : hash of the questions
* **root** : merkle root of id commitment
* **nullifiers_hash**: hash of (**external_nullifier**, **identity_secret**, **identity_path_index**)
* id commitment: hash of (**identity_pk**, **identity_secret**, **identity_path_index**)
and private inputs:
* **identity_pk** : public key
* **identity_secret** : random value generated by private key
* **identity_path_elements** : intermediate values of merkle tree
* **identity_path_index** : paths of merkle tree
* **auth_sig_r** : signature R
* **auth_sig_s** : signature S
#### Cryptographic primitives
Semaphore uses a few cryptographic primitives provided by circomlib:
* MiMCHash for the Merkle tree, the identity commitments and the message hash in the signature.
* EdDSA for the signature.
Note: MiMCHash, and especially the specific paramteres used in the circuit, have not been heavily audited yet by the cryptography community. Additionally, the circuit and code should also receive further review before relying on it for production applications.