Blockchain based Voting

Voting in election is a tedious task

While in most cases the voter identification details are already stored in a computer system and counting votes is a trivial task to program, still most election campaigns are conducted manually. Both the voting itself and the counting of the votes.

This process is in fact so labor intensive and time consuming that in many countries it requires a dedicated vacation day.

But why can’t you cast your vote online and save all this hassle?

The Trust Problem

With today’s manual voting, faking a small number of votes is not difficult. But systematically changing the outcome of the election on a grand scale is nearly impossible without help from the governments itself.

Well, until you start voting online. Now a single hacker or sysadmin can login to the voting database and change the election outcome with a single SQL statement. Depending on the setup, perhaps no one will be able to trace this.

Blockchain to the Rescue

This risk can be mitigated when using an immutable ledger where all transactions are digitally signed and time stamped, also known as a blockchain. In a blockchain the ledger is managed by all parties involved so any attempt to cheat is quickly identified and eliminated. Users will first need to link their online identity to their physical identity (another use case for blockchain), then they can use their online identity to vote at the convenience of their home or mobile device. Counting the votes will become immediate. Seconds after closing the polls results will be available.

The rest of the article deals with actual implementation of blockchain based voting on the NXT blockchain

Voter identification process


V — represent the voter,

G — the government office or the entity managing,

ID — the voter id in the government office known to both V and G


(1) V generates a 12 words strong passphrase and obtains his NXT account id

(2) V concatenates his NXT account id to his known public ID and sends it to G

(3) G responds with a “challenge” token composed of a token of the data submitted in (2) signed by G’s passphrase

(4) V parses G’s token and verifies that it includes the data it sent in (2) then signs a token which is composed of G’s “challenge” token

(5) V sends the data from (2) the data from (3) and the signed token (4) to G

(6) G validates that the token (4) indeed includes the challenge token from (3) and that this challenge was indeed signed by it’s own private key

(7) G extracts V’s public key from the signed token (4) and funds V’s NXT account with the voting token

This process relies on the generateToken and decodeToken APIs of the NXT blockchain and can also be recorded on the blockchain using the sendMessage API

Voting process

After the identification process completes, the voter now has a single voting token and enough blokchain tokens to pay for a single transaction fee

The voting administrator now creates a poll which describes the voting options

The voting itself takes place when the user submits the castVote transaction

At a certain block height the poll is closed and votes are counted simultaneously by all the blockchain nodes which has to reach consensus about the actual poll result

Voter anonymity

In order to protect the anonymity of the voters, voting tokens can be shuffled between up to 30 accounts at once thus creating a new account which can no longer be associated with the voter id by the government. This process can be repeated as necessary to increase anonymity

Future Work

One disadvantage of existing blockchain based voting solutions is that power users can track the voting results while the poll is still ongoing by counting the submitted voting transactions. Possible solutions for this, which are relatively simple to implement using NXT, is to schedule the vote transactions but not actually submit them to the blockchain until very close to the ending block height of the poll, another option is to encrypt the vote using the public key of the poll issuer. This way only the poll issuer can count the votes before the poll ends.