[go: nahoru, domu]

Skip to content

Web based e-Voting system using the Ethereum Smart Contract

Notifications You must be signed in to change notification settings

suvambasak/eVoting-blockchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SC5-eVoting-G10

eVoting system using the Ethereum blockchain
Group: 10
Project code: SC5

Tech Stack
Front-end HTML, Bootstrap
Back-end Flask, web3.py
Blockchain Ethereum (Sepolia)
API Infura
Wallet MetaMask

Table of Contents

File details

Filename Details
candidates.csv Automatically get inserted into the candidate table in the database with a fresh start
admin.json Set the admin username, password, and wallet address. The contract address gets automatically added after deployment. Automatically get inserted into the database with a fresh start
ABI.json The ABI file gets automatically written after deployment

How to start the application

 "wallet": "YOUR_WALLET_ADDRESS"

Add credentials

Add email ID and App password here: dapp/credentials.py

SENDER_EMAIL = "example@domain.com"
PASSWORD = "nx2189n&gs76"

To disable email service. OTP will be available in the terminal.

EMAIL_SERVICE = False

Add admin details

Add Infura API

WEB3_PROVIDER_URL = "https://sepolia.infura.io/v3/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

Create virtual environment

The directory should be inside sc5-evoting-g10

suvam@KD-304A:~/Projects/sc5-evoting-g10$

Create

virtualenv .venv

Activate

. .venv/bin/activate

Install dependencies

Install dependencies from requirements.txt

pip install -r requirements.txt

Deploy smart contract

It will prompt for the private key. Input will be hidden.

python deploy.py
  • It will create ABI.json file
  • Add the contract address in admin.json

Start Flask application

  1. Export app name
export FLASK_APP=dapp
  1. Set debugging mode
export FLASK_DEBUG=1 
  1. Start app

For localhost

flask run

For LAN

flask run --host=0.0.0.0

Note:

  1. Login as Admin and set election start and end time before voting. Otherwise it will fail to cast vote.
  2. Publish the vote from the Admin panel to make the voting result available public.

How to get the private key

  1. Goto MetaMask
  2. Three dot menu (top right side)
  3. Select Account details
  4. Export private key
  5. Type your MetaMask password

Demo

Voter


Voter registration

Voter registration

Voting

Voter registration

Admin


Set election time

Voter registration

Publish election result

Voter registration

Contributors