Skip to content

Minimal implementation of a single-transferable voting system in solidity.

Notifications You must be signed in to change notification settings

MimmyJau/miniSTV

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

miniSTV

This is a minimal implementation of single-transferable voting (STV), a rank-order voting system aiming to be fairer than the traditional first-past-the-post voting system.

Background

The advantages of STV are manyfold:

  • It can be used for both single-winner (instant-runoff) or multi-winner elections,
  • It minimizes "wasted" votes, since your vote can be transferred to another candidate you've ranked if your preferred candidate is either eliminated or elected,
  • By minimizing wasted votes, it disincentives strategic voting, thus encouraging voters to state their actual preferences,
  • In a multi-winner election, the use of a quota in STV ensures that the proportion of winners roughly mirrors the proportion of votes.

For more detailed information see the following wikipedia articles:

Local Environment

This project was built using Foundry.

To run tests, call forge test.

Limitations / TODOs

Gas cost is very high for submitting a vote.

The tiebreaking process in each round of counting involves a three-step procedure.

  1. Initially, it considers who had the most (or least) first-rank votes in the initial tally.
  2. Next, it evaluates who had the most (or least) votes in the most recent tally before the current tie.
  3. Finally, it considers which proposal was submitted first (or last) by the vote's owner.

This last step should be replaced with a random number generator (RNG) function for improved fairness. Additionally, we can use all tallies in chronological order rather than just the first and last tallies.

If for whatever reason, not enough candidates surpass the quota to be elected, the program will not warn you in advance, and will instead close the vote and only return the number of candidates that surpassed the quota. This situation should only occur in when there are very few votes.

Currently, the implementation only supports the Droop quota method for calculating the required votes for a candidate to be elected. Future versions may include alternative quota calculation methods.

About

Minimal implementation of a single-transferable voting system in solidity.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published