Skip to content

Experience the future of voting with our blockchain-powered platform. Secure, transparent, and accessible voting for everyone.

Notifications You must be signed in to change notification settings

hridesh94/SecureVoteChain

Repository files navigation

Secure Vote Chain: Blockchain Based Voting System

Experience the future of voting with our blockchain-powered platform. Secure, transparent, and accessible voting for everyone.

🌍 Live Demo

🔗 URL: Secure Vote Chain

📌 Project Overview

Secure Vote Chain is a decentralized voting platform leveraging blockchain technology to ensure secure, transparent, and tamper-proof elections. With an intuitive interface and advanced security measures, our system empowers voters and administrators alike.

✨ Features

  • Blockchain Security - Ensures immutable and fraud-resistant voting records.
  • 🎨 User-Friendly Interface - Simplifies the voting process for all users.
  • 🔍 Real-Time Vote Tracking - Enables transparent vote verification.
  • 🔒 Advanced Security Measures - Protects voter identity and data integrity.

🚀 Blockchain Implementation Details

Blockchain Structure

Each block in the blockchain contains the following properties:

  • Index: Position of the block in the chain.
  • Timestamp: Time the block was created.
  • Vote Data: Stores candidateId and voterId.
  • Previous Hash: Hash of the previous block.
  • Current Hash: Unique hash for the current block.
  • Nonce: Value used in mining.

Example of a Vote Block:

{
  "index": 1,
  "timestamp": 1709041234567,
  "vote": {
    "candidateId": "L001",  // L for local, P for provincial, F for federal
    "voterId": "V12345"
  },
  "previousHash": "000abc...",
  "hash": "000def...",
  "nonce": 1234
}

Key Features

  • Genesis Block: The first block in the chain, created upon blockchain initialization.
  • Proof of Work: Mining mechanism requiring a specific number of leading zeros in the hash.
  • Vote Recording: Each vote is stored as a new block in the chain.
  • Chain Validation: Ensures blockchain integrity by verifying hashes.
  • Singleton Pattern: Ensures only one instance of the blockchain exists.

Core Methods

  • addBlock(): Adds a new vote to the blockchain.
  • isChainValid(): Verifies blockchain integrity by checking hashes.
  • getVotingResults(): Retrieves vote counts for each candidate.
  • getAnonymizedVotes(): Retrieves votes without voter IDs for privacy.
  • setVotingEnded(): Controls the voting state.

Usage Flow

  1. Voting Process: When a voter casts votes in VoterDashboard.tsx, three blocks are added (one for local, provincial, and federal levels).
  2. Results Processing: After voting ends, the admin can view results in AdminDashboard.tsx.
  3. Data Export: Results can be exported while maintaining voter privacy.

Security Features

  • Immutable Records: Once a vote is added, it cannot be altered.
  • Mining Requirement: Prevents unauthorized modifications.
  • Anonymous Vote Retrieval: Ensures voter privacy while retrieving results.
  • Voting State Control: Allows admins to end voting and prevent further modifications.

Data Persistence

Currently, the blockchain is stored in memory, meaning it resets on page refresh. Future enhancements could include:

  • Local Storage Integration
  • Backend Database Storage

Potential Enhancements

  • Data Persistence: Store blockchain data beyond session memory.
  • Distributed Consensus: Implement a decentralized approach for validation.
  • Vote Verification Mechanisms: Introduce cryptographic verification for votes.
  • Mining Difficulty Adjustment: Optimize the mining process for better security.
  • Advanced Authentication: Enhance voter authentication to prevent fraud.

This implementation provides a foundational blockchain-based voting system, focusing on security, transparency, and vote privacy. Future enhancements will strengthen the system’s robustness and scalability.


🛠 How to Edit and Contribute

There are multiple ways to modify and contribute to this project:

1️⃣ Clone and Edit Locally

If you prefer to work in your own development environment, follow these steps:

Prerequisites:

Ensure you have Node.js & npm installed. We recommend installing via nvm: 👉 Install with nvm

Steps:

# Step 1: Clone the repository
git clone <YOUR_GIT_URL>

# Step 2: Navigate to the project directory
cd <YOUR_PROJECT_NAME>

# Step 3: Install dependencies
npm install

# Step 4: Start the development server
npm run dev

This will launch a local development server with hot-reloading.

2️⃣ Edit Files Directly in GitHub

  • Navigate to the desired file.
  • Click the Edit button (pencil icon) in the top-right.
  • Make changes and commit them directly.

3️⃣ Use GitHub Codespaces

GitHub Codespaces provides an instant cloud-based development environment:

  • Go to your repository’s main page.
  • Click CodeCodespacesNew Codespace.
  • Edit files and push changes seamlessly.

🏗 Technologies Used

This project is built with modern technologies for optimal performance and scalability:

  • Vite - Fast build tool for frontend development.
  • 🔵 TypeScript - Strongly typed JavaScript for maintainability.
  • React - UI library for building dynamic user interfaces.
  • 🎨 shadcn-ui - A modern UI component library.
  • 🎨 Tailwind CSS - Utility-first CSS framework for styling.

🌍 Deployment & Custom Domains

Currently, the project is deployed on Netlify. We plan to support custom domains in the future.

For self-hosting or using your own domain, we recommend:

  • Deploying on Netlify (Guide)
  • Hosting on Vercel or Cloudflare Pages

🤝 Contributing

We welcome contributions! If you’d like to contribute:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-name).
  3. Commit your changes (git commit -m 'Add new feature').
  4. Push to your branch (git push origin feature-name).
  5. Submit a Pull Request!

📜 License

This project is open-source and available under the MIT License.


About

Experience the future of voting with our blockchain-powered platform. Secure, transparent, and accessible voting for everyone.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages