https://github.com/supriya811106/blockchain-based-voting-application
A blockchain-based voting system built on Ethereum to ensure transparency, security, and accessibility. It leverages smart contracts, Ethers.js, and MetaMask to allow users to cast and verify votes on the blockchain.
https://github.com/supriya811106/blockchain-based-voting-application
blockchain ethereum ethersjs nodejs voting-application
Last synced: 4 months ago
JSON representation
A blockchain-based voting system built on Ethereum to ensure transparency, security, and accessibility. It leverages smart contracts, Ethers.js, and MetaMask to allow users to cast and verify votes on the blockchain.
- Host: GitHub
- URL: https://github.com/supriya811106/blockchain-based-voting-application
- Owner: supriya811106
- Created: 2025-04-12T06:32:10.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-12T08:58:55.000Z (about 1 year ago)
- Last Synced: 2025-07-04T10:43:34.671Z (12 months ago)
- Topics: blockchain, ethereum, ethersjs, nodejs, voting-application
- Language: JavaScript
- Homepage: https://blockchain-based-voting-application-ruu5.onrender.com
- Size: 2.18 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Decentralized Voting Application

A blockchain-based voting system built on Ethereum to ensure transparency, security, and accessibility. It leverages **smart contracts**, **Ethers.js**, and **MetaMask** to allow users to cast and verify votes on the blockchain.
🔗 **Live Demo**: [https://blockchain-based-voting-application-ruu5.onrender.com/](https://blockchain-based-voting-application-ruu5.onrender.com/)
---
## Features
- Secure, tamper-proof voting via smart contracts
- MetaMask integration for user authentication and transaction signing
- Live vote status and result updates
- Simple UI served via Express server
---
## Prerequisites
Before you begin, ensure you have the following installed:
- **[Node.js](https://nodejs.org/)** – to run the backend server
- **[MetaMask](https://metamask.io/)** – browser extension for Ethereum wallet interaction
- **Ethereum Account** – for deploying and interacting with smart contracts
- **Ethers.js** – for blockchain communication
- **Solidity Compiler** – (optional) for contract compilation
---
## Setup Instructions
### 1. Clone the Repository
```bash
git clone https://github.com/supriya81106/Blockchain-Based-Voting-Application.git
cd Blockchain-Based-Voting-Application
```
### 2. Install Dependencies
```bash
npm install express ethers dotenv express-fileupload
```
### 3. Configure Environment Variables
Create a `.env` file in the root with the following content:
```env
API_URL=https://
PRIVATE_KEY=
CONTRACT_ADDRESS=
PORT=3000
```
> âš **Never expose your private key publicly.** Use environment variables securely.
### 4. Start the Server
```bash
node index.js
```
Your app will run at `http://localhost:3000`
---
## Usage Guide
### Connect MetaMask
- Click the **"Connect MetaMask"** button on the homepage.
- Approve the connection request in your MetaMask wallet.
### Cast a Vote
- Enter the **candidate index** and click **"Cast Vote"**.
- MetaMask will prompt you to confirm the transaction.
### Check Voting Status
- Click the **"Check Voting Status"** button to fetch the latest results from the blockchain.
---
## Smart Contract Features
- **Add/Remove Candidates** – Built into the `voter.sol` contract
- **Vote Recording** – Immutable and secure
- **Result Retrieval** – Real-time updates
---
## Troubleshooting
- **MetaMask Not Connected**
→ Ensure MetaMask is installed and you're connected to the correct network.
- **Contract Not Working**
→ Verify that `CONTRACT_ADDRESS` in `.env` matches the deployed contract.
- **Transaction Errors**
→ Check for gas limits, correct private key, and enough ETH in your account.