A decentralized blockchain-based voting system built with React (frontend) and Node.js (backend). This system ensures transparency and integrity while providing privacy-enhanced voting options. The application includes live updates via Socket.IO and features such as token-based rewards for voters.
- Real-Time Updates: Votes and rewards update live using WebSocket connections.
- Blockchain-Backed: Votes are recorded immutably on a blockchain to ensure integrity.
- Token Rewards: Voters earn tokens for participating in elections, which they can redeem for rewards.
- Dashboard Overview: Admins can view participants, votes, rewards, and blockchain details.
- User Privacy: Built with considerations for enhancing voter privacy using cryptographic methods.
- Resettable State: Navigate to /reset to completely reset the blockchain.
- React (React Router for navigation)
- Vite (for faster development builds)
- Node.js
- Express.js
- Socket.IO (for real-time updates)
- Custom Blockchain Implementation
- Frontend: Netlify
- Backend: Render (or optionally hosted locally via Ngrok for testing)
- Node.js (v14+ recommended)
- npm
- Git
git clone https://github.com/tvan04/blockchain-voting.git
cd blockchain-voting-system# Install backend dependencies
cd server
npm install
# Install frontend dependencies
cd ../client
npm installRunning Locally (the code is currently set up for deployment, so you will have to change socket link to http://localhost:4000 in the component files)
cd server
node index.jsThe backend server will start on http://localhost:4000.
cd client
npm run devThe frontend development server will start on http://localhost:5173.
- Run the build command:
npm run build
- Upload the
distfolder to Netlify. - Add a
_redirectsfile to thedistfolder with the following content:/* /index.html 200
- Create a Web Service on Render.
- Set the following settings:
- Build Command: Leave empty
- Start Command:
node server.js.
blockchain-voting-system/
├── server/
│ ├── index.js # Main backend server
│ ├── blockchain.js # Blockchain implementation
│ └── package.json # Backend dependencies
├── client/
│ ├── src/
│ │ ├── components/ # React components (Dashboard, Voting, etc.)
│ │ ├── App.jsx # Main application entry point
│ │ └── main.jsx # ReactDOM rendering
│ ├── public/ # Static assets
│ ├── dist/ # Production build folder (after `npm run build`)
│ └── package.json # Frontend dependencies
└── README.md
- Query Parameters:
name(string) - The name of the user.
- Response:
200 OK: Returns the address corresponding to the given name.404 Not Found: If no user matches the given name.
- Description: Allows a user to join the system by providing their name and address.
- Data:
{ "name": "string", "address": "string" }
- Description: Records a user's vote and rewards tokens.
- Data:
{ "name": "string", "address": "string", "vote": "string" }
- Description: Deducts tokens from a user's balance to redeem a reward.
- Data:
{ "address": "string", "cost": "number", "reward": "string" }
- Integrate Zero-Knowledge Proofs for private voting.
- Add role-based authentication for admin and users.
- Improve UI/UX for better accessibility and responsiveness.
- Add support for multiple elections.
MIT License