Build a secure e-voting app
Use IBM Blockchain Platform and the IBM Kubernetes Service to build a web-based blockchain voting app
With its distributed ledger, smart contracts, and non-repudiation capabilities, blockchain is revolutionizing the way organizations do business, and the election industry is no exception. This developer code pattern shows you how to implement a web-based blockchain app using the IBM Blockchain Platform to facilitate voting and help ensure the prevention of double-voting.
Have you ever wondered how exactly the votes in a presidential election are counted? What if — instead of having volunteers spending many hours each day manually counting votes — you had an app backed by blockchain, recording each voter’s vote, ensuring that double-voting is not possible? That’s what this code pattern explains how to do. We aim to build a web app in which the voter can register with their driver’s license, get a unique voter ID, which is used to log in to the app, and cast the vote. The vote is tallied on the blockchain, and the web app shows the current poll standings.
At the start of the application, the user registers to vote by providing a driver’s license number, registrar district, and first and last name. In this step, you can check to see if the driver’s license is valid and has not been registered previously. If all goes well, you create a private and public key for the voter with the certificate authority running on the cloud and add those keys to the wallet.
After that, users use their driver’s license numbers to submit votes, during which the application checks to see if the driver with this license number has voted before. If this particular license number has not been used before, the vote goes through the consensus policy, and the world state is updated. The application then updates the current election standings to show which political party the user has voted for.
Since each transaction submitted to the ordering service must have a signature from a valid public-private key pair, you can trace back each transaction to a registered voter of the application, in case of an audit.
Given that every transaction that has been recorded on the blockchain has reached consensus on the network and is immutable, using blockchain for voting can help ensure trust between the public and the government. In addition, by using smart contracts to automate the tallying of votes, voting becomes a much more secure and cost-effective process. Although this is a simple application, you can see how to implement a Hyperledger Fabric web app to decrease the chance of election fraud and enhance a voting application by using blockchain technology.
- The blockchain operator sets up the IBM Blockchain Platform service.
- IBM Blockchain Platform creates a Hyperledger Fabric network on an IBM Kubernetes Service, and the operator installs and instantiates the smart contract on the network.
- The Node.js app server uses the Fabric SDK to interact with the deployed network on IBM Blockchain Platform and creates APIs for a web client.
- The Vue.js client uses the Node.js application API to interact with the network.
- The user interacts with the Vue.js web interface to cast their ballot and query the world state to see current poll standings.
Ready to get started? Check out the README for the step-by-step details on:
- Cloning the repo
- Creating IBM Cloud™ services
- Building a network
- Deploying a voterContract smart contract on the network
- Connecting the app to the network
- Running the application