- Confidential Voting Contract: Implements a Solidity smart contract to facilitate a secure and confidential voting process, ensuring compliance with voting rules and constraints.
- Core Functionality: Provides features for voter registration, secure voting, and accurate result computation.
- Code Quality: Follows best practices for Solidity smart contract development.
- Clone the repository.
- Open the project in your preferred development environment.
- Compile the smart contracts using tools like Remix or Foundry.
- Deploy the contracts to an Ethereum testnet of your choice (e.g., Sepolia, Goerli).
- Interact with the deployed contracts via a suitable frontend or directly using Web3.js.
This repository includes a smart contract designed for confidential voting. Below are the key functionalities:
-
Data Structures:
Voter
Structure:address voterAddress
: Address of the participant.bool hasVoted
: Indicates if the participant has voted.
Proposal
Structure:string description
: Description of the proposal.uint256 voteCount
: Number of votes received.
-
Core Functions:
startVoting()
: Initiates the voting process. Only the contract owner can start voting.endVoting()
: Concludes the voting process. Only the contract owner can end voting.registerVoter()
: Registers a participant for voting.vote(uint256 proposalIndex)
: Allows a registered participant to vote for a proposal.getWinner()
: Returns the proposal with the highest number of votes.
-
Advanced Features:
- Vote delegation: Participants can delegate their vote to another participant.
- Events: Logs important actions such as voter registration and voting.
- Modifiers: Implements access control for certain functions (e.g., only owner actions).
-
Constraints:
- A participant can vote only once.
- Voting results are visible only after voting concludes.
- Only the contract owner can start or end voting.
-
Testing:
- The contract has been rigorously tested in an Ethereum development environment to ensure reliability and correctness.
Contributions to this project are welcome. Feel free to open issues or submit pull requests.
This project is licensed under the MIT License.