zkVote is based on Semaphore which is introduced by barryWhiteHat as a method of zero-knowledge signaling - a method for an approved user to broadcast an arbitrary string without exposing their identity. Semaphorejs 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 for the zero-knowledge proofs.The other is implemented in Golang for verification of zero-knowledge proofs and p2p network.
Implemented in semaphorejs/cricom.
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
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.