Coder Social home page Coder Social logo

karthickravi138 / decentralized-voting-system-using-ethereum-blockchain Goto Github PK

View Code? Open in Web Editor NEW

This project forked from krish-depani/decentralized-voting-system

0.0 0.0 0.0 5.37 MB

A decentralized voting system using Ethereum blockchain for secure and transparent elections, with features like user authentication and real-time result tracking.

License: MIT License

JavaScript 34.17% Python 12.71% CSS 22.96% HTML 19.91% Solidity 10.26%

decentralized-voting-system-using-ethereum-blockchain's Introduction

Decentralized-Voting-System-Using-Ethereum-Blockchain

The Decentralized Voting System using Ethereum Blockchain is a secure and transparent solution for conducting elections. Leveraging Ethereum's blockchain technology, this system ensures tamper-proof voting records, enabling users to cast their votes remotely while maintaining anonymity and preventing fraud. Explore this innovative project for trustworthy and decentralized voting processes.

For a cool demo of this project watch this YouTube video.

For more details checkout Project Report.

Features

  • Implements JWT for secure voter authentication and authorization.
  • Utilizes Ethereum blockchain for tamper-proof and transparent voting records.
  • Removes the need for intermediaries, ensuring a trustless voting process.
  • Admin panel to manage candidates, set voting dates, and monitor results.
  • Intuitive UI for voters to cast votes and view candidate information.

Requirements

  • Node.js (version – 18.14.0)
  • Metamask
  • Python (version – 3.9)
  • FastAPI
  • MySQL Database (port – 3306)

Screenshots

Login Page

Admin Page

Voter Page

Installation

  1. Open a terminal.

  2. Clone the repository by using the command

     git clone https://github.com/Krish-Depani/Decentralized-Voting-System-Using-Ethereum-Blockchain.git
    
  3. Download and install Ganache.

  4. Create a workspace named developement, in the truffle projects section add truffle-config.js by clicking ADD PROJECT button.

  5. Download Metamask extension for the browser.

  6. Now create wallet (if you don't have one), then import accounts from ganache.

  7. Add network to the metamask. ( Network name - Localhost 7575, RPC URl - http://localhost:7545, Chain ID - 1337, Currency symbol - ETH)

  8. Open MySQL and create database named voter_db.

  9. In the database created, create new table named voters in the given format and add some values.

     +--------------------------------------+-------+-----------+
     | voter_id                             | role  | password  |
     +--------------------------------------+-------+-----------+
     |                                      |       |           |
     +--------------------------------------+-------+-----------+
    
  10. Install truffle globally

    npm install -g truffle
    

    After installation open the truffle console in the projects root directory

    truffle console
    

    Now build the smart contracts (Make sure ganache is running as per specified configuration)

    compile
    
  11. Go to the root directory of repo and install node modules

    npm install

  12. Install python dependencies

    pip install fastapi mysql-connector-python pydantic python-dotenv uvicorn uvicorn[standard]

Usage

Note: Update the database credentials in the ./Database_API/.env file.

  1. Open terminal at the project directory

  2. Bundle app.js with browserify

     browserify ./src/js/app.js -o ./src/dist/app/bundle.js
    
  3. Start the node server server

     npm index.js
    
  4. Navigate to Database_API folder in another terminal

     cd Database_API
    

    then start the database server by following command

     uvicorn main:app --reload --host 127.0.0.1
    
  5. In a new terminal migrate the truffle contract to local blockchain

     truffle migrate
    

You're all set! The Voting app should be up and running now at http://localhost:8080/.
For more info about usage checkout YouTube video.

Code Structure

├── blockchain-voting-dapp            # Root directory of the project.
    ├── build                         # Directory containing compiled contract artifacts.
    |   └── contracts                 
    |       ├── Migrations.json       
    |       └── Voting.json           
    ├── contracts                     # Directory containing smart contract source code.
    |   ├── 2_deploy_contracts.js     
    |   ├── Migrations.sol            
    |   └── Voting.sol                
    ├── Database_API                  # API code for database communication.
    |   └── main.py                   
    ├── migrations                    # Ethereum contract deployment scripts.
    |   └── 1_initial_migration.js    
    ├── node_modules                  # Node.js modules and dependencies.
    ├── public                        # Public assets like favicon.
    |   └── favicon.ico               
    ├── src                           
    |   ├── assets                    # Project images.
    |   |   └── eth5.jpg              
    |   ├── css                       # CSS stylesheets.
    |   |   ├── admin.css             
    |   |   ├── index.css             
    |   |   └── login.css             
    |   ├── dist                      # Compiled JavaScript bundles.
    |   |   ├── app.bundle.js         
    |   |   └── login.bundle.js       
    |   ├── html                      # HTML templates.
    |   |   ├── admin.html            
    |   |   ├── index.html            
    |   |   └── login.html            
    |   └── js                        # JavaScript logic files.
    |       ├── app.js                
    |       └── login.js              
    ├── index.js                      # Main entry point for Node.js application.
    ├── package.json                  # Node.js package configuration.
    ├── package-lock.json             # Lockfile for package dependencies.
    ├── README.md                     # Project documentation.
    └── truffle.js                    # Truffle configuration file.

License

The code in this repository is licensed under the MIT License. This means that you are free to use, modify, and distribute the code, as long as you include the original copyright and license notice. For more information about LICENSE please click here.

Thanks for checking out!!

decentralized-voting-system-using-ethereum-blockchain's People

Contributors

krish-depani avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.