Skip to content

E-locks: A blockchain-based voting system E-locks is a robust voting system implemented in C++ and OpenCV, leveraging blockchain technology for enhanced security and transparency. The system integrates facial recognition for user identification and encryption techniques to securely store voter data. Each vote is recorded in a blockchain ledger.....

Notifications You must be signed in to change notification settings

Minhal128/E-locks-A-blockchain-based-voting-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

E-LOCKS: A Blockchain Based Voting System 🧊⫘🧊

I have developed a C++ application integrating facial recognition with a blockchain-based voting system, utilizing OpenCV for real-time face detection and recognition. The program allows users to register their details, including name, age, CNIC, and political party, which are securely encrypted and stored. It employs a custom SimpleEncryption class for data encryption and blockchain technology to create tamper-proof logs of user interactions. Users are prompted to enter their details interactively, and the application saves captured images and encrypted data in specified paths. This system ensures data privacy, transparency, and security, making it a robust solution for secure voting and user verification. Contributions to enhance its features and functionality are welcome.

🔎 Project Preview

Note: The camera resolution is not optimal.

Image Description

Disclaimer

This C++ program, designed and developed by Syed Muhammad Minhal Rizvi, enhances efficiency by providing quick access to frequently used applications and websites through facial recognition, encryption, and blockchain concepts using OpenCV. The program captures live video, detects faces, and allows users to input details for each detected face, which are then encrypted and saved. It employs XOR-based encryption for user data, decrypts it for display, and logs entries with block numbers, hashes, and timestamps. While efforts have been made to ensure reliability and security, users are advised to use the program responsibly and acknowledge its provided as-is without guarantees. The program operates based on user commands, automating tasks to optimize time, though effectiveness may vary based on system configurations and external factors.

🧐 Features

Our project "E-LOCKS: A Blockchain Based Voting System" includes features such as:

  • Facial recognition for user identification
  • Encryption of user data using a simple XOR encryption algorithm
  • Decryption of user data and saving decrypted data to a specified path
  • Capturing and storing images of detected faces
  • Managing user details including name, age, CNIC, and political party affiliation
  • Storing encrypted user data in a database
  • Displaying block details including block hash and timestamp
  • Real-time video capture and face detection using OpenCV
  • Providing an interactive console for user input and data entry
  • Implementing a blockchain mechanism for voting integrity

E-LOCKS Features

🛠 Installation Steps:

1. Clone the repository

    git clone https://github.com/Minhal128/E-locks-A-blockchain-based-voting-system.git

2. Set the path in Visual studio for OpenCV

here is the way that how I setup the OpenCV in visual studio
  • Add OpenCV include and library paths in project properties.
  • Include opencv_world470d.lib for debug and opencv_world470.lib for release.
  • Add lib and bin paths to system environment variables for OpenCV.
  • Name the main source file and copy test code to set up the project.
  • Modify the image path, then restart Visual Studio to ensure code recognition and execution.
  • Build the solution to execute the OpenCV project in Visual Studio 2022.

2. Install & Run OpenCV and C++ Language modules

 # Create a build directory
mkdir build
cd build

# Configure the project with CMake
cmake -DOpenCV_DIR=$OpenCV_DIR ..

# Build the project
make
 # Run the executable generated by the build process
run-- ./openCV.sln

Working

  • User-Defined Headers
  • The included header files in this C++ program provide essential functionalities for implementing a facial recognition and voting system using OpenCV. They enable core operations such as image processing (opencv2/core.hpp, opencv2/imgproc.hpp), GUI interactions (opencv2/highgui.hpp), object detection including face detection (opencv2/objdetect.hpp), standard input/output operations (iostream), file handling (fstream, sstream), date and time manipulation (ctime), dynamic data storage (vector, unordered_set), and output formatting (iomanip). Together, these headers support tasks ranging from capturing video, detecting faces, managing user data, encrypting information, and displaying results, essential for creating a robust application integrating computer vision with data handling in C++.

  • Database
  • We developed the C++ database using the basic concepts of file handling, ensuring that our data is stored in the specified paths.

  • SimpleEncryption Class
  • A simple encryption class is defined to encrypt and decrypt user data using a XOR-based encryption method.

  • Class Created
  • The UserData class encapsulates information about a user, storing details such as their name, age, CNIC (Pakistan's national identity card number), political party affiliation, and the file path to their image. Meanwhile, the BlockData class serves to structure and display block details within a blockchain-inspired voting system, showcasing attributes like hash and timestamp. The VotingSystem class integrates functionalities for face detection, user data collection, encryption, file management, and block handling. Its start() method initiates video capture via OpenCV, verifies camera accessibility, and displays live video in a window labeled "Face Recognition". It continuously processes frames, detects faces using a pre-trained classifier, prompts for user details upon detection, saves captured images, encrypts and stores user data in files, displays block details for each entry, and manages face data until the user exits via '0' or 'q'. The getCurrentTimestamp() method retrieves and returns the current timestamp formatted as %Y-%m-%d %H:%M:%S. ....

  • Main() Function
  • Initializes the path to the face cascade classifier XML file. Creates an instance of the VotingSystem class and starts the face recognition and data entry process.

  • Summary
  • The provided C++ code implements a facial recognition and voting system prototype using OpenCV. It integrates face detection, user data collection, encryption, file handling, and block-like data structuring. The program captures live video, detects faces, prompts for user details, stores encrypted user data in files, and displays block details akin to a blockchain system.

    🤝Team Contribution

    Minhal Rizvi

    • Implemented face detection and real-time video capture functionalities, UML diagram.

    Mesum Raza

    • Developed the user data entry and encryption/decryption logic & block details and documented the project.

    Mufaddal Huzaifa

    • Integrated the system and handled the storage of user data and did backend database with filing

    Muhammad Sameed

    • Created the OpenCV functionality code for the frontalface_cascade.xml and the idea to implement this on Blockchain

    This is our team contribution. A significant aspect is that, in our team, we have two cybersecurity enthusiasts and a very special member who is blind but can see dreams better than anyone else ❤

    ⚠️Limitations

  • Simple Encryption
  • Face Recognition
  • No Passkey locker
  • Difficulty Scaling Issues.
  • 🔮Future Enhancements

  • Advance Encryption
  • Eyes Identification
  • Database Integration
  • Will Use Biometric Machine
  • GUI Integration
  • 💖Hope you Like our work!

    This project needs a ⭐ from you. Don't forget to leave a star ⭐

    About

    E-locks: A blockchain-based voting system E-locks is a robust voting system implemented in C++ and OpenCV, leveraging blockchain technology for enhanced security and transparency. The system integrates facial recognition for user identification and encryption techniques to securely store voter data. Each vote is recorded in a blockchain ledger.....

    Resources

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published

    Languages