Absentee Voting on Blockchain

Some countries has implement absentee voting for years, but there’s several countries haven’t because of lots of doubts.As the blockchain smart contract being mature ,maybe we can try using smart contract to implement an absentee voting?

There’re some token standard provided, ERC20,ERC721,ERC777,ERC1155 and so on.ERC20 is for currency transaction,ERC721 for collection,ERC777 as an operator managed ERC20, how about ERC1155?ERC1155 is now most for games, but I think that ERC1155 may be a great token standard for ballots.

The standard Mint function is like:

We input account(mint to which address),id(the type of ERC1155)and amount.It has the feature of ERC20(the amount of each token can be not only 1) and ERC721(each token has its tokenId),the id can be ballot for president ,ballot for mayor or parliamentary.Each token balance can be more than 1, it’s just like ballots.

ERC20 also have burn function:

As the voter votes, the ballot will be burnt to ensure that nobody vote for the same candidate twice.

The ballot contract totally follow the ERC1155 standard.And next is the voting contract.The voting contract is to :

  1. Add the candidate
  2. Voter vote for candidate
  3. get the votes balance after the voting ended

So,it may looks like:

In the constructor, we declared the ballot address and the endtime of the voting,and there’s 3 main function,including:

addCandidate : Register the candidate and his/her info

vote:Voters have to input the id(the type of candidate), dist(your voting district) and cid(the id of the candidate) to finish the vote.

VoteBalance:We can view the total votes of each candidates only after the voting ended.

By this simple voting contract ,maybe an absentee voting is not that hard and hope oneday most countries in the world will implement the absentee voting.

For the entire contract ,you can visit:https://github.com/timmychien/Absentee-Voting