zkvote: Using ZK-SNARK to Implement Decentralized Anonymous Voting on p2p Network
zkvote-node is a Kademlia DHT node. Nodes connect with each other to form a mesh network. On top of this network, nodes can propose and anyone could vote with zk. The votes could reveal anytime. (with zk, everyone knows the number of votes without revealing who votes)
Architecture
Cmd
zkvote(pkg)
Service(pkg)
Node.go
manager(pkg)
Manager(Collector).go
subject_protocol.go
identity_protocol.go
voter(pkg)
Voter.go
IdentityPool(IdentityIMP).go
Proposal.go
zksnark(pkg)
Verifier.go
Store(pkg)
Validator.go
Store.go
utils(pkg)
crypto(pkg)
Model(pkg)
Subject.go
Identity.go
MerkelTree.go
Context.go
pb(pkg)
zkvote.proto
restapi(pkg)
Controller
Model
Flow
Onboarding flow:
Run zkvote-node. The node will connect to other peers in the network.
Use defferent libp2p protocol
Nodes form two networks: DHT and pub/sub
The local running node provides a web UI for the user to register and submit proof.
A pub/sub topic is a voting subject
Node can start a new subject (topic) or discover a subject (topic)