Skip to content

A decentralized application for conducting elections

Notifications You must be signed in to change notification settings

Saagar2005/Election-DApp

Repository files navigation

Project Report: Gymkhana Elections DApp

1. Introduction

Welcome to the Gymkhana Elections DApp, a decentralized application (dApp) that operates on a peer-to-peer (P2P) network of computers connected through the Ethereum blockchain. Unlike traditional applications controlled by a single authority, dApps like ours embrace transparency and autonomy. This enables our campus junta to engage in the election process without fear of censorship or manipulation.

This user manual gives you a gist of the Gymkhana Elections DApp, including its functionalities, how to use the application, and the technologies used.

2. Getting started

Please note that the user needs to have MetaMask installed and have testnet Ether (ETH) available to perform actions within the DApp.

3. Application Overview

This application facilitates the registration of voters and candidates. Voters can cast their vote, and the leader can access the result.Leader is the creator of the election.The voter gives three preferences (which are the indices (natural numbers) corresponding to the intended candidates).The scores corresponding to the three preferences are 5, 3, and 1.That candidate whose total score is the highest is declared as the winner of the election.

4. How to run

  1. Install dependencies
npm install
  1. Run the hardhat node. This will create 20 accounts with 10000 ETH each.
npx hardhat node
  1. Connect the node with Metamask

Go to Metamask > Click on networks tab > Click on add network > Add network manually > Fill in the following details

Network Name: localhost

RPC URL: http://localhost:8545

Chain ID: 31337

Currency Symbol: ETH
  1. Add some accounts to Metamask (Use the private keys from the hardhat node).

Go to Metamask > Click on account icon > Import account > Paste the private key > Click on Import

  1. Deploy the contract
npx hardhat run scripts/deploy.js --network localhost
  1. Load the frontend using the VSCode Live Server extension.

Right-click on index.html > Open with Live Server

  1. Interact with the frontend.

5. Conclusion

The Gymkhana Elections DApp offers an elegant and user-friendly interface that allows individuals to take part in the election process with utmost security and transparency. By seamlessly connecting their MetaMask wallets, users can register as voters, exercise their right to cast votes, and access the winning Candidate of the election. The DApp harnesses the power of the Ethereum blockchain and smart contracts to ensure a secure, honest, and accurate election process.

With the aid of the accompanying manual, users can confidently engage in electoral affairs and play a pivotal role in choosing their leaders in the election.