stonecoldpat / anonymousvoting

Anonymous voting on Ethereum without a tally authority. Protocol from this paper http://homepages.cs.ncl.ac.uk/feng.hao/files/OpenVote_IET.pdf
340 stars 88 forks source link

Open Vote Network

What is the Open Vote Network?

The Open Vote Network (OV-net) is a 2-round decentralized voting protocol with the following attractive features

A video tutorial on how to deploy and install the Open Vote Network can be found here: https://youtu.be/5wch2_WhPvg

Our paper was published in Financial Cryptography and Data Security 2017: http://fc17.ifca.ai/preproceedings/paper_80.pdf

Our third prize submission to the economist cyber security competition: http://www.economist.com/sites/default/files/newcastle.pdf

A description of the voting protocol can be found here: http://homepages.cs.ncl.ac.uk/feng.hao/files/OpenVote_IET.pdf

This program presents an efficient realization of this protocol over the Ethereum network.

Why Ethereum?

Ethereum is a platform for Smart Contracts that provides the following:

The above allows anyone to verify the execution of the program, and that the protocol is executed correctly.

How does it work?

The protocol has five phases.

SETUP

SIGNUP

COMMIT (OPTIONAL)

VOTE

TALLY

How can I pick up this library and go?

Video tutorial: https://youtu.be/5wch2_WhPvg

You need to run 'Geth' in the background:

  1. geth <OPTIONAL: --dev/testnet> --rpc --rpcapi="db,eth,net,web3,personal" --rpcport "8545" --rpcaddr "127.0.0.1" --rpccorsdomain "*" console

Example: ./geth --dev --rpc --ipcpath "~/Library/Ethereum/geth.ipc" --rpcapi="db,eth,net,web3,personal" --rpcport "8545" --rpcaddr "127.0.0.1" --rpccorsdomain "*" console

  1. Compile the .SOL, and send it to the Ethereum Network.

  2. Update vote.html, admin.html livetally.html with the correct abi/contract address.

  3. Voters open vote.html, and the Election Admin opens admin.html

  4. Each voter requires a voter.txt document that contains the following:

    • x - the private key for the voter's voting key,
    • xG - the voter's voting public key,
    • v - the random nonce for a single ZKP,
    • w,r,d - the random nonces for the 1 out of 2 ZKP.
    • All values should be seperated by commas (i.e. ",") in a .txt document.
  5. Voters can register and cast their vote.

An example 'voter.txt' has been included, and a Java Program 'votingcodes.jar' is included that can compute these numbers for the voter.

Some photos of the voting system can be found here:

http://homepages.cs.ncl.ac.uk/patrick.mc-corry/openvotenetwork/

What functions are available?

The voting protocol leverages the following libraries:

ECCMath and Secp256k1: https://github.com/androlo/standard-contracts/blob/master/contracts/src/crypto/Secp256k1.sol DateTimePicker: http://xdsoft.net/jqplugins/datetimepicker/

We have implemented the following:

Schnorr non-interactive ZKP:

1 out of 2 ZKP:

Election Functions:

SETUP

SIGNUP

COMMIT

VOTE

TALLY

ANY Phase.

What is next?

Ideas:

To Fix:

This project demonstrates the current limitation of cryptographic protocols on the Ethereum network.

We need to think of how Ethereum can better natively support cryptography... to avoid the limits we reached.

I release this code under the MIT license https://choosealicense.com/licenses/mit/

p.s. If you find any bugs in our code - then fix it and provide a pull request :) ... or at least tell me about them... patrick.mccorry@ncl.ac.uk