DEV Community

fair-allocation-research
fair-allocation-research

Posted on

Fair Allocation Protocol: Mathematically Proven 100% RTP in Decentralized Lotteries

Introduction

Most blockchain lotteries suffer from a fundamental problem: they are not mathematically fair. Players lose money to house edges, high fees, and opaque mechanics.

What if we could build a lottery with:

  • 100% Return to Player (RTP) — every dollar in the pool returns to players over time
  • No centralized oracle dependencies — decentralized commit-reveal randomness
  • Verifiable randomness without Chainlink VRF costs on every draw
  • Transparent, mathematically proven fairness — formulas published, invariants tested over 100,000 simulated draws

This is Fair Allocation Protocol — an open research project for a 6/36 lottery with deferred payouts, voluntary organizer commission, and reputation-based validator coordination.

Transparency: Open Math, Closed Source

The protocol source code is intentionally closed for legal reasons. Lotteries and real-money games face strict regulation in most jurisdictions.

However, the full mathematical model is described in this article — probabilities, payout formulas, pool allocation, reserve rules, commission, invariants, and the complete random number generation methodology. Additional parameters: specification page.

Try the live simulation — 50 automated bots, real-time stats. Virtual tokens only.

The Problem

House edge. Traditional lotteries take 10–30% profit. Even blockchain lotteries often have 2–5% house edge.

Oracle dependency. Chainlink VRF costs $0.50–2.00 per draw, adds centralization risk.

Opacity. Many projects claim "provably fair" but hide math and contract logic.

Players cannot verify: Is RTP really 100%? Is randomness unpredictable? Can large wins be paid?

Mathematical Foundation

For a 6/36 lottery, probability of exactly k matches:

P(k) = C(6,k) × C(30,6−k) / C(36,6)

Total combinations: C(36,6) = 1,947,792.

Paying categories: k = 2, 3, 4, 5, 6. Each contributes 20% of stake to RTP:

W_k = (0.20 / P_k) × stake

Result: Σ P_k × W_k = stake — proven 100% RTP.

Payouts at $10 stake

  • 2 matches (21.10%) → $9.48
  • 3 matches (2.06%) → $47.98
  • 4 matches (0.128%) → $597.02
  • 5 matches (0.00512%) → $21,642.13
  • 6 matches (0.0000513%) → $3,895,584.00
  • Jackpot 6/6$19,477,920.00

Verified: 100,000 simulated draws, invariants I1–I7 pass.

Deferred Payouts

Large wins would drain the pool. Solution:

  • Instant pool (40%) — categories 2, 3, half of 4
  • Debt pool (60%) — large wins repaid over future draws
  • Reserve fund (30% target) — covers instant shortfalls

Voluntary Commission

Organizer earns 5% on winnings only — not from the prize pool. Player chooses opt-in or opt-out at purchase. No house edge.

Random Number Generation

Six stages from trigger to winning numbers.

Stage 1 — Trigger

200 regular tickets sold → commit phase starts.

Stage 2 — Commit (5 min)

Each validator generates secret + salt, submits hash only:

commit = keccak256(secret + salt + address)

Minimum 3 validators. Nobody can predict outcome until secrets are revealed.

Stage 3 — Reveal (5 min)

Validators reveal secret + salt. Contract verifies hash matches commit.

Stage 4 — Finalization

Build 256-bit randomWord:

  • Start with blockhash of previous block
  • Mix in each validator secret via keccak256
  • Store as randomWord on-chain

Anyone can reproduce this from blockchain data.

Stage 5 — Six Winning Numbers

Fisher–Yates shuffle on numbers 1–36:

  • Array pool = [1, 2, …, 36]
  • For i from 35 to 1: pick random index j, swap
  • First 6 elements = winning numbers
  • j derived from keccak256(randomWord, i)

Every combination equally likely. Same randomWord always gives same numbers.

Stage 6 — Execute Draw

Contract compares winning numbers with tickets, credits payouts.

Limitation: blockhash manipulable on mainnet. OK for testnet research only. Production needs Chainlink VRF.

Validator Coordination

RNG validators — commit-reveal randomness.

Draw executors — run draw on time, fallback chain if primary fails.

Reputation 0–100: +2 success, −10 missed deadline, −5 bad reveal. Below 20 = shadow ban (excluded silently).

20% of commission shared among successful RNG validators.

Gas on Base (Hardhat, June 2026)

  • Buy ticket: ~179k gas (~$0.006)
  • Fulfill draw (worst case): ~3.6M gas (~$0.13)
  • Withdraw: ~160k gas (~$0.005)

Simulation Results

  • 100,000-draw audit: PASS
  • 13 hidden-bug tests: PASS
  • 21/21 contract tests: PASS
  • Live 24/7: 50 bots on Railway demo

Roadmap

Now: simulation, math verified, contracts written.

Q3 2026: Base Sepolia testnet, public validators.

Later: audit, Chainlink VRF, legal review.

Links

Donate (ETH Base): 0x93DfCca12B6904a8d7724546acbeFEF1aB8D0085

Contact validators: fair-allocation-research@proton.me

Conclusion

100% RTP is mathematically possible. Decentralized RNG can be free on testnet. Reputation systems and deferred payouts keep the protocol solvent. This is a proof of concept for fair decentralized fund distribution.

Educational research only. Testnet tokens, no real value. Code closed for legal reasons; full math and RNG methodology in this article.

Top comments (0)