Giter Site home page Giter Site logo

advaita-saha / zk-voting Goto Github PK

View Code? Open in Web Editor NEW
14.0 2.0 1.0 4.9 MB

Anonymous Voting system build with the power of Zero-knowledge cryptography

Circom 12.40% Solidity 46.29% JavaScript 41.30%
circom circomlib cryptography merkle-tree snarkjs voting-application zero-knowledge zk-snarks

zk-voting's Introduction

Annonymous Voting System built with zk-SNARKS

alt text

Paper-based voting (like the Elections) is a very expensive way of voting. I have no exact data, but it costs billions of dollars, and it is always in the air that somebody cheated it. A blockchain-based system costs only a fraction of this price, and it is super secure because the blockchain is public and everybody can track everything on it. The only thing that is untrackable is that who voted to which party thanks to the zero-knowledge proof. So, blockchain-based voting seems like the holy grail of voting.

How does it work?

The voting system registers the voters list and create a polling system. When the voter comes to the system the, it generates a ticket for them which they can use only once to vote. The ticket is a zero-knowledge proof which proves that the voter is in the voters list and it is not used before. The ticket is generated by the voter's private key and the public key of the system.

When the voter comes to the polling system, it downloads the ticket from the system. The system verifies the ticket and then the voter can vote to a party. The vote is also a zero-knowledge proof which proves that the voter is in the voters list and it is not used before and it is a valid vote.

How to run the project

Install dependencies if you haven't already

  • Clone this repository and then run the following commands
npm i
npm run start-poll
npm run download-ticket
npm run vote

There are many other commands in the ./package.json file. You can run them by typing npm run <command-name>.

  • To clean the existing build files
npm run clean

Installing dependencies

  • Install rust
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
  • Install circom
git clone https://github.com/iden3/circom.git
cd circom
cargo build --release
cargo install --path circom
  • Install snarkjs
npm install -g snarkjs
  • Others command that are important
npm run build
npm run setup
npm run generate-solidity

zk-voting's People

Contributors

advaita-saha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

tea2x

zk-voting's Issues

ZK explanation

Would it be possible to explain in specifics where the ZK processes happen in the code. There doesn't seem to be any private user key that is used in the ZK proof. It also seems that the "server" & "client" aren't fully seperated, so the ZK proof doesn't really happen only on the client.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.