Skip to content

This repository contains a Solidity smart contract designed to facilitate a confidential voting process. Read more in README.md.

Notifications You must be signed in to change notification settings

sergeibanov/solidity-vote-contract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Features

  • 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.

Getting Started

  1. Clone the repository.
  2. Open the project in your preferred development environment.
  3. Compile the smart contracts using tools like Remix or Foundry.
  4. Deploy the contracts to an Ethereum testnet of your choice (e.g., Sepolia, Goerli).
  5. Interact with the deployed contracts via a suitable frontend or directly using Web3.js.

Vote Contract Overview

This repository includes a smart contract designed for confidential voting. Below are the key functionalities:

Features

  • 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

Contributions to this project are welcome. Feel free to open issues or submit pull requests.

License

This project is licensed under the MIT License.

About

This repository contains a Solidity smart contract designed to facilitate a confidential voting process. Read more in README.md.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published