This decentralized voting application demonstrates how to implement a voting system using a Solidity smart contract and a ReactJS frontend. The application allows users to participate in secure and transparent voting, leveraging the Ethereum blockchain for integrity and traceability of votes.
Before you begin, ensure you have the following installed:
- Node.js (version 14.x or later recommended)
- npm (version 6.x or later)
- An Ethereum wallet with test Ether (for deploying contracts to test networks)
-
Clone the Repository
Start by cloning the repository to your local machine:
git clone https://github.com/PasanAbeysekara/blockchain-based-voting-system-using-solidity-and-hardhat cd blockchain-based-voting-system-using-solidity-and-hardhat
-
Install Dependencies
Install the necessary npm packages:
npm install
-
Compile and Deploy the Contract
Compile the smart contract and deploy it to the blockchain network (e.g., the Volta test network):
npx hardhat compile npx hardhat run --network volta scripts/deploy.js
-
Configure Environment
After deploying the contract, copy the contract address to the
.env
file. You may also specify a different blockchain network endpoint in thehardhat-config.js
file. Ensure your private key and the deployed contract address are correctly set in the.env
file. -
Start the Application
Launch the ReactJS application:
npm start
- Voting System: Enables users to vote for their preferred candidates in a secure and transparent manner.
- Blockchain Integration: Utilizes Ethereum blockchain for deploying and interacting with the smart contract.
- ReactJS Frontend: Provides a user-friendly interface for interacting with the voting system.
Contributions to improve the application are welcome. Please fork the repository, make your changes, and submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.