This project addresses key challenges in modern voting by creating a privacy-focused, cost-efficient, and transparent election system. It ensures voter privacy using hashed commitments and leverages blockchain for immutable, verifiable vote records. By using off-chain processing for complex ranked-choice vote calculations, it reduces gas costs while maintaining transparency. The integration of Web3 technologies like Worldcoin for voter verification, The Graph for querying election data, and Scroll for scalability, makes it a secure and scalable solution that allows for flexible voting and transparent election outcomes without sacrificing efficiency or security.
One of the major hurdles we faced while building this project was managing the high gas fees when storing all ranked votes on-chain. Initially, we attempted to store every vote, including the ranked choices, directly in the smart contract. However, this quickly became inefficient due to the high storage costs associated with on-chain data, especially as the number of candidates and voters increased.
We decided to shift to an off-chain storage model for ranked votes using event emissions. Instead of storing all votes on-chain, we now emit an event with the ranked votes whenever a user submits their vote. These events are then indexed by The Graph, which allows us to query and process the voting results off-chain. By only updating the first-choice votes on-chain and handling the detailed ranked-choice tallying off-chain, we significantly reduced gas costs while maintaining transparency and security.
This approach allowed us to overcome the gas fee challenge and achieve a scalable, cost-effective solution.
Tracks Applied (8)
Scroll
Scroll
The Graph
Worldcoin
Worldcoin
Worldcoin
Worldcoin
Worldcoin
Discussion