Blockchain Will Completely Revolutionize The Way We Vote

Photo by Arnaud Jaegers on Unsplash

The U.S Presidential Election (2020)

Photo by NBC News

Building A Voting Dapp

Photo by Christopher Gower on Unsplash
  • Smart contracts are self-executing digital contracts with the terms of the agreement between buyer and seller directly embedded into the code
  • They render transactions traceable, transparent, and irreversible
  • The most popular blockchain for running smart contracts is Ethereum
  • A dApp is a digital application that runs on a blockchain network of computers instead of relying on a single computer
  • They are entirely decentralized (free from the control and interference of a single authority)
  • Key benefits of dApps are their ability to safeguard users privacy, their lack of censorship, and their flexibility
Traditional Web vs Decentralized App

What You’ll Need

By Karolina Grabowska on Pexels

Metamask:

Remix — Ethereum IDE:

Replit:

Writing The Smart Contract (Backend)

Step #1: Setting up your workspace

Step #2: Declaring License + Solidity Version

Step #3: Define A Contract

Step #4: Define The Candidate Structure

Step #5: Mapping Candidates + Voters + Candidate Count

eventVote is explained in step #8

Step #6: Introduce Your Candidates

Step #7: Add Candidates Function

Step #8: Define Vote Function

Step #9: Return The Vote Count For A Candidate

Step #10: Test + Deploy Your Contract

Making It Interactive (Frontend)

Step #1: Set Up New Repl

Step #2: Create The Following Files

Step #3: Import The ABI (Application Binary Interface)

Step #4: Import The Smart Contract Address

Your Smart Contract Address Won’t Be the Same as Mine

Step #5: Set Up The Index.js File

Step #6: Set Up The Public/index.html File

You Can Find the Full Code to This Project in the Attached Video (End of Article)

Step #7: Create A Table For Candidates + Votes

Step #8: Connect Metamask Function

Step #9: Get Current Vote Count

Step #10: Get Current Account Function

Step #11: Create Vote Function

Step #12: Test Your Application

Newly Created Accounts Cannot Be Deleted!

Let’s Connect!

--

--

--

Hey, I’m Girik, a 16-year-old based in Toronto interested in blockchain technology and web3

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

BLOCK-CHAIN TECHNOLOGY

Hedera Technical Insights: Stablecoins (and other tokens) demand Stable Fees

📢News of the week

How Can Blockchain Strengthen the Marine Ecosystem

Achieving Sustainability Through Blockchain

The 73rd Weekly Report on ONEROOT

CRODO — LUNCHPAD. Making X’s

Announcement on upgrade of the repurchase and burn mechanism

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Girik Narang

Girik Narang

Hey, I’m Girik, a 16-year-old based in Toronto interested in blockchain technology and web3

More from Medium

HOW DOES AN AUCTION WORKS ON LASTCHANCE.

Roblox— Postmortem of outage on 28th October.

Roblox outage

marvel

CERTHUM’S COLLATOR NEWS UPDATE — 12th March, 2022