• Stars
    star
    116
  • Rank 302,144 (Top 6 %)
  • Language
    Python
  • License
    Other
  • Created about 12 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A system for secure, trusted, and verifiable voting on the web

E-Vote

E-Vote is an open source system for secure, trusted, anonymous, and verifiable voting online. It is based on the web2py framework.

(The algorithms implemented here are also available standalone in https://github.com/mdipierro/evote_ranking wihtout database and they do not depend on web2py. The workflow is implemented there using the filesystem)

Overview

The elections site administrator sets up the election via the web admin interface; setting up the election involves creating a page listing the ballot items (e.g., candidates), and specifying the electorate (the voters, who are represented by email addresses).

Once the election is opened, each voter will receive a unique, non-identifying token by email. Using that token, the voter visits a corresponding ballot page via their web browser. One such ballot is created for each voter in the election, and the ballot has its own unique identifier (different from the token received in the email). Each voter casts their vote using their unique but unidentifiable ballot. Eventually the election is closed, perhaps manually or perhaps based on a pre-set time, and no more votes can be cast.

While no voter knows any unique ballot identifier other than their own, the election administrators can publish the list of all unique identifiers and how they voted. Each voter can then verify that their own vote was properly recorded, and thus the electorate as a whole can verify the results.

Installing E-Vote

E-Vote uses the web2py framework and can be installed like any other web2py application; see the web2py documentation for details. If you just want to try out E-Vote quickly, here is one way to get it up and running on your laptop:

  $ git clone --recursive https://github.com/web2py/web2py.git
  $ cd web2py/applications
  $ git clone https://github.com/mdipierro/evote.git
  $ cd ..
  $ sudo /etc/init.d/apachectl stop  # <-- stop other web server if needed
  $ pip install rsa
  $ python web2py.py
    ...Watch it launch, then visit
       http://127.0.0.1:8000/evote/default/index
    ...in your browser.

To deploy at the root of the site (e.g., at http://127.0.0.1:8000/ instead of http://127.0.0.1:8000/evote/default/index), simply name the E-Vote directory applications/init/ instead of applications/evote/. The magic name "init" will cause E-Vote to appear at the site root.

To deploy E-Vote in production, you may want to go to web2py.com and learn more about deploying web2py-based applications in general. If you're in a hurry, see scripts/setup-*.sh in the web2py tree. One common way to deploy web2py applications is with WSGI under Apache HTTPD: in the web2py tree, copy handlers/wsgihandler.py to the top level of the tree, and set the appropriate WSGI options in the Apache configuration. See the Deployment recipes chapter in the web2py manual for more.

Administrating E-Vote

Let's assume you installed E-vote as site root, in applications/init/.

When you first launched the web server ('python web2py.py' in the above example), you were prompted to set an admin password. That password allows you to log in on the web2py administration console:

  http://127.0.0.1:8000/admin/

(If you plan to run in production under Apache HTTPD or some other web server, then one easy way to set the admin password is to run web2py once first under its own web server as per above, just to set the admin password, then shut it down and switch to running it with your production web server thereafter.)

That URL will redirect to http://127.0.0.1:8000/admin/default/site, which will list the installed applications, of which "init" will be one. That's E-Vote. Pull down the "Manage" menu and select "Edit" -- you will see a web2py admin console for this application.

Under most circumstances, you won't need to do anything here; creating elections and running them does not require customization of the E-Vote app. Instead, see "Registering Users and Running Elections" later on.

Customizing E-Vote's Appearance

(Again, this somewhat duplicates web2py documentation, but since E-Vote users are most likely to want to customize their election sites' front pages and make other basic changes, we cover that here.)

We again assume you installed in the site root, as applications/init/.

Your site's pages live in init/views/default/. For example, the front page is init/views/default/index.html. These view files are mostly written in HTML, but they contain occasional Python and template code embedded between double curly braces, e.g., "{{extend 'layout.html'}}". See web2py.com/books/default/chapter/29/05/the-views for more about views and the templating commands available.

Registering Users and Running Elections

We cover the topics of registering users and running elections together, because they are somewhat intertwined.

In a normal E-Vote deployment, anyone can create their own user account by going to the front page, pulling down the "Login" menu on the upper right, and choosing "Register". After entering some information that includes their email address and a password of their choice, they will be sent an email with a unique link. To confirm the registration, they visit that link and enter their email addres and password. Now that user account exists. (See "Testing E-Vote Without Email" below for how to try all this without involving a mail delivery system.)

Now that we've created the user, what can she do?

A user can create new elections, and vote in elections where she has been named as a voter.

This may sound surprising -- after all, one might imagine that there is a single E-Vote administrator (perhaps the person who knows the initial admin password mentioned earlier in "Administrating E-Vote") who sets up elections, and who is separate from the voters who vote in those elections. But that's not how E-Vote works. Instead, anyone with an account can set up an election, assuming they have the "is_manager" flag set on their account, which is something they themselves can set when they register the account, or can change later by pulling down the the upper right user menu and clicking on "Profile" to manager their account (try it!).

So let's set up an election. After making sure your "is_manager" flag is turned on, choose "Elections" from the nav bar at the top, then click the New Election button under "Create a election."

You'll see a ballot creation form, which should be self-explanatory. Edit it to look like the ballot you want voters to see. Then put the email addresses of all those voters in the Voters box, one per line (those voters will receive unique tokens by email that allow them to vote in this election). If there's anyone else you want able to manage this election, add them to the "Managers" box.

Click Save and Preview to be brought to a preview page where you can make sure the ballot looks exactly as you want the voters to see it. Test it out -- in particular, if you are doing any ranked-choice elections, try dragging those candidates up and down and make sure the text above that group informs voters that they can drag to reorder.

Once you're satisfied, go to the top of the page and click Email Voters and Start Election Now. This will cause the ballot emails to go out to voters.

Concluding Elections

An election closes either on the date that was specified, if any, when the election was set up, or when one of the election's managers manually closes it from their Elections administration page (click on "Elections" in the nav bar).

When you close an election, will see a results page such as

  http://hostname_or_ip_etc.com/init/default/results/6

(You or any voter can also visit that page at any time, by choosing "Results" from the Action menu next to that election on the Elections page.)

The results are mostly self-explanatory, except for the ranked-choice groups, which use single-letter codes to indicate the candidate's scores under various scoring algorithms. For example, you might see this (well, in a very unusual election that happened to have just one voter):

  M:3  I:1  S:1       Candidate A
  M:9  I:1  S:2       Candidate B
  M:1  I:1  S:0       Candidate C

Here's how to interpret those codes:

  M = Borda (exponential)   I = Instant Runoff      S = Schulze
  -----------------------   ------------------      -------------------
  M:3                       I:1                     S:1
  M:9                       I:1                     S:2
  M:1                       I:1                     S:0

M = Borda Method = https://en.wikipedia.org/wiki/Borda_count

I = Instant Runoff = https://en.wikipedia.org/wiki/Instant-runoff_voting

S = Schulze Method = https://en.wikipedia.org/wiki/Schulze_method

(Yes, we plan to improve the results interface.)

Testing E-Vote Without Email

If you'd like to test all this out without worrying about email-sending configuration, you can edit this line in models/0.py:

  EMAIL_SERVER = 'localhost'

Change "localhost" to "logging"...

  EMAIL_SERVER = 'logging'   # 'localhost'

...and now the emails will print out on the web server console instead of being sent. You'll see things like this on the console:

  Welcome [email protected]!  Click on the link
  http://hostname_or_ip_etc.com/init/default/user/verify_email/18b9f977-249f-45e8-93fe-59161a687f88 
  to verify your email

More Repositories

1

nlib

The book "Annotated Algorithms in Python" and the nlib.py library
Python
1,327
star
2

workflow

minimalist file based workflow
Python
563
star
3

web2py-appliances

Set of Example Web2py Appliances
JavaScript
210
star
4

kryten

A shell tool to turn code into a video presentation
Python
148
star
5

autoinstaller

Python
104
star
6

no.css

Tiny CSS framework with almost no classes and some pure CSS effects
CSS
99
star
7

stupid.css

HTML
92
star
8

gluino

Port of web2py to Bottle, Flask, Pyramid, Tornado, wsgiref and other frameworks
Python
82
star
9

ocl

Python to C99/OpenCL/JS compiler
Python
64
star
10

Plasmid

web app to clone, edit in-place, and republish any web site
Python
54
star
11

ulid

Python
48
star
12

canvas

canvas is a simple interface to most common matplotlib functions
Python
42
star
13

web2py-recipes-source

Source code from the web2py recipes book published by packt
Python
37
star
14

pacioli

double entry account system compatible with ledger and beancount (but BSD license)
HTML
32
star
15

web2py-haystack

A full-text search engine for web2py named after Django-Haystack (since serves a similar purpose)
Python
29
star
16

buckingham

A library for error propagation and metric conversions
Python
25
star
17

web3py

web3py (work in progress... an experiment)
Python
25
star
18

videomonitor

Python
20
star
19

markmin.js

markmin.js (yet another wiki markup language but different)
JavaScript
18
star
20

mdpcl

some exercises with pyopencl
Python
17
star
21

algorithms-animator

Algorithms Animator
Python
11
star
22

fermiqcd

Automatically exported from code.google.com/p/fermiqcd
HTML
10
star
23

w2cms

w2cms
JavaScript
10
star
24

collection2

Python
10
star
25

web2py-plugins

9
star
26

nsa

Python
8
star
27

human_security

simple rsa signing API
Python
7
star
28

regift

Python
7
star
29

kusoma

JavaScript
6
star
30

date_finder

Python
6
star
31

csvstudio

A tool for processing csv files
Python
6
star
32

web2py-cordova

Python
6
star
33

estore3

Python
5
star
34

markmin-reveal-slides

markmin-reveal-slides
Python
5
star
35

cylon

physics engine
C++
5
star
36

emte-trading

Automatically exported from code.google.com/p/emte-trading
Python
5
star
37

w3

JavaScript
5
star
38

kpar

k(onfiguration) paramaters
Python
4
star
39

qcl

qcl
Python
4
star
40

qcdutils

Automatically exported from code.google.com/p/qcdutils
Python
4
star
41

demo.python.org

demo.python.org
JavaScript
4
star
42

simplescreencast.py

Python
4
star
43

evote_ranking

Python
4
star
44

vision-controlled-arm

vision-controlled-arm
JavaScript
3
star
45

web2py-welcome-theme-stupid

Python
2
star
46

scientific-cms

JavaScript
2
star
47

mdipierro.github.io

TeX
2
star
48

iotcallme

Python
2
star
49

forgetful

Python
2
star
50

blockchain_logger

Python
2
star
51

depy2015-cats

Python
2
star
52

random_variable

library to compute expectation values of random variables
Python
1
star
53

countach

Yet another static site generator - but different
Python
1
star
54

taskutils

Python
1
star
55

p2p-toy

Python
1
star
56

compy

compy
1
star
57

my_first_project

1
star
58

xml_parser

Python
1
star