ChainElect is a secure and transparent e-voting system built on blockchain technology, combining Ethereum smart contracts with a modern web interface. The system ensures the integrity of the voting process while providing a user-friendly experience.
-
Secure Authentication
- Email-based user verification
- Metamask wallet integration
- Profile image upload capability
- Session management
-
Blockchain Integration
- Smart contract-based voting system
- Real-time vote counting
- Transparent vote tracking
- Ethereum network integration
-
User Interface
- Modern, responsive design
- Real-time voting status updates
- Live countdown timer
- Interactive candidate selection
- Profile management
-
Security Features
- Email verification
- Metamask ID validation
- One vote per wallet address
- Secure image storage with Supabase
- Session-based authentication
Before running the application, ensure you have the following installed:
- Node.js (v14 or higher)
- npm (Node Package Manager)
- MetaMask browser extension
- Hardhat for local blockchain development
- Git
-
Frontend
- React.js with Vite
- Web3.js for blockchain interaction
- Modern CSS for styling
-
Backend
- Node.js with Express
- Supabase for database and storage
- Multer for file handling
-
Blockchain
- Ethereum (Hardhat local network)
- Solidity smart contracts
-
Authentication
- Supabase Auth
- Express sessions
- MetaMask wallet
-
Clone the Repository
git clone [your-repository-url] cd ChainElect -
Install Dependencies
# Install frontend dependencies npm install # Install backend dependencies cd ChainElectBackend npm install
-
Environment Setup
Create a
.envfile in the ChainElectBackend directory:NODE_ENV=development SUPABASE_URL=your_supabase_project_url SUPABASE_ANON_KEY=your_supabase_anon_key SESSION_SECRET=your_session_secret
-
MetaMask Configuration
Add a new network in MetaMask with these settings:
- Network Name: Hardhat Local
- New RPC URL: http://127.0.0.1:8545
- Chain ID: 31337
- Currency Symbol: ETH
-
Start the Frontend
npm run dev
-
Start the Backend Server
cd ChainElectBackend npx nodemon server.js -
Deploy Smart Contracts
# Compile contracts npx hardhat compile # Start local Hardhat node npx hardhat node # Deploy contracts npx hardhat run scripts/deploy.js --network localhost
-
User Registration
- Enter voter ID, email, and password
- Upload profile image
- Connect MetaMask wallet
- Verify email address
-
Authentication
- Login with email and password
- Automatic MetaMask wallet validation
- Session management
-
Voting Process
- View active election session
- See remaining voting time
- Cast vote for chosen candidate
- Receive confirmation
-
Profile Management
- View voter details
- Check MetaMask balance
- Manage session
-
Voters
- Register and authenticate
- Cast votes
- View profile information
- Check voting status
-
Admin
- Start/end voting sessions
- Manage candidates
- Monitor voting progress
- View results
- Email verification for new registrations
- MetaMask wallet verification
- Session-based authentication
- Secure image storage
- Smart contract security
- Input validation
- Error handling
This project is licensed under the MIT License - see the LICENSE file for details.
- The application uses Supabase for backend services
- Smart contracts are deployed on a local Hardhat network
- Frontend is built with React and Vite
- Supports modern browsers with MetaMask extension