This repository contains a Hardhat project for a decentralized voting system smart contract. The Voting contract uses OpenZeppelin's Ownable for ownership management and supports candidate registration, voting, and winner determination. The project includes deployment scripts using Hardhat Ignition and testing.
- Candidate Registration: Add and manage candidates.
- Voting: Users can vote for candidates.
- Winner Determination: Determine the candidate with the most votes.
- Deployment: Uses Hardhat Ignition for deployment.
- Testing: Includes tests to verify contract functionality.
- Node.js (v18 or later recommended)
- Hardhat
- OpenZeppelin Contracts
-
Clone the repository:
git clone https://github.com/yourusername/hardhat-voting-system.git cd hardhat-voting-system -
Install dependencies:
npm install
Run the following command to execute tests:
npx hardhat testDeploy the contract to a local Hardhat network:
-
Start Hardhat Network:
npx hardhat node
-
Deploy Contract:
In a new terminal, run:
npx hardhat ignition deploy ./ignition/modules/VotingSystem.js --network localhost