Skip to content

A Decentralized Blockchain Voting/Election Application

Notifications You must be signed in to change notification settings

kaymen99/Election-Dapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Election-Dapp

Overview:

A Decentralized Voting Application built for EVM compatible blockchains (ethereum, polygon, avalanche,...), it has the following features :

Administation functions:

  • Adding new candidates
  • Opening the voting for a giver duration
  • Closing the election after the predermined voting period

Main functions:

  • Allow user to vote only once for a choosen candidate
  • Determine the winner based on highest votes count
  • Give a complete list of all candidates with their data (id, name, votes count)

Installation & Setup:

  1. Installing Brownie: Brownie is a python framework for smart contracts development,testing and deployments. It's quit like HardHat but it uses python for writing test and deployements scripts instead of javascript. Here is a simple way to install brownie.

     pip install --user pipx
     pipx ensurepath
     # restart your terminal
     pipx install eth-brownie

    Or if you can't get pipx to work, via pip (it's recommended to use pipx)

    pip install eth-brownie

    Install ganache-cli:

     npm install -g ganache-cli
  2. Clone the repo:

    git clone https://github.com/kaymen99/Election-Dapp.git
    cd Election-Dapp

How to deploy:

To deploy the Election contract on development network, run the command :

brownie run scripts/deploy_election.py

To deploy on real network/testnets, run the command :

brownie run scripts/deploy_election.py --network=<network name>

Testing:

The tests for the Election smart contract can be found in the tests folder, you can run all the tests by :

brownie test

Or you can test each function individualy:

brownie test -k <function name>