Skip to content

TLOSHiddenThreshold.sol - Hidden voting threshold example #50

@igor53627

Description

@igor53627

Parent Issue

Closes part of #47

Description

Build a hidden threshold voting contract where the exact threshold/quorum for a decision is obfuscated, but votes themselves are public.

Use Case (from iO "Voting & Private State")

Traditional voting exposes thresholds, enabling strategic voting. TLOS enables:

  • Hidden decision threshold inside obfuscated circuit
  • Votes are public (on-chain)
  • Outcome only revealed when threshold is crossed
  • Voters don't know exactly how many more votes are needed

Example Flow

Voters                           Contract                          Observer
   |                                |                                  |
   | vote(yes/no)                   |                                  |
   |------------------------------->| tallies are public               |
   |                                |                                  |
   | vote(yes/no)                   |                                  |
   |------------------------------->|                                  |
   |                                |                                  |
   | checkOutcome(puzzle)           |                                  |
   |------------------------------->|                                  |
   |                                | evaluates hidden threshold       |
   |                                | if crossed: emit Decided(result) |
   |                                |------ Decided(PASSED) ---------->|

Key Features

  • Public vote tallies (yes/no counts)
  • Hidden threshold logic in TLOS circuit
  • Multiple threshold types:
    • Simple majority with hidden quorum
    • Supermajority with hidden percentage
    • Complex multi-condition logic
  • Puzzle required to check outcome (prevents spamming checks)

Security Model

  • What's hidden: Exact threshold/quorum/conditions
  • What's public: Individual votes, current tallies
  • Guarantee: 2^76 minimum to brute-force threshold before voting ends
  • Note: NOT private voting - votes are visible, only threshold is hidden

Why Hide Thresholds?

  • Prevents strategic voting ("we only need 2 more votes")
  • Prevents last-minute coordination attacks
  • Adds uncertainty to governance manipulation
  • Useful for games, auctions, competitive scenarios

Implementation Notes

  • Threshold encoded in puzzle derivation or circuit output
  • Consider: reveal threshold after decision (post-hoc transparency)
  • Voting deadline to bound the hiding period

Acceptance Criteria

  • Contract compiles and passes tests
  • Multiple threshold types demonstrated
  • Clear distinction: votes public, threshold hidden
  • Gas benchmark documented

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions