Skip to content

System overview

System overview

D21 Contract

The D21 contract manages subjects and voters, it handles registration, voting, and vote counting. The contract enforces rules, manages access, and sorts results.

Registries

  • Subject: Stores voting entities such as political parties, including their names and vote counts.
  • Voter: Manages information about individual voters, including their voting status and remaining votes.

Sequence of operations

  1. Initialization:
  2. Deploy Contract: The contract is deployed, initializing the system and setting the contract owner.

  3. Setup Phase:

  4. Register Subjects (addSubject): Subjects (e.g., political parties) are added to the system.
  5. Register Voters (addVoter): Eligible voters are registered by the contract owner.

  6. Voting Phase Initiation:

  7. Start Voting (startVoting): The contract owner initiates the voting period. This sets the voting period's start and end times.

  8. During Voting Phase:

  9. Voters Cast Votes:

    • Positive Votes (votePositive): Registered voters cast positive votes for their chosen subjects.
    • Negative Votes (voteNegative): Voters also cast negative votes, following the specific rules of the D21 method.
  10. End of Voting Phase:

  11. The voting period automatically concludes based on the pre-set end time.

  12. Results Compilation:

  13. Retrieve Results (getResults): After the voting period ends, the results are compiled, sorted, and can be retrieved to see the final vote counts for each subject.

Actors

Contract Owner

  • Role: Typically the deployer of the contract.
  • Responsibilities:
    • Initiates and concludes the voting period.
    • Manages voter registration and other administrative tasks.
    • Enforces overall control over the contract’s critical functions.

Voters

  • Role: Users who participate in the voting process.
  • Capabilities:
    • Cast a limited number of positive and negative votes for different subjects.
    • Interact with the contract during the designated voting period.

Subjects (e.g., Political Parties)

  • Role: Entities that are the focus of the voting process.
  • Details:
    • Registered in the system by users.
    • Represented in the contract through the Subject struct.
    • Subject to voting by registered voters.