NateRich.net Docs Lab Tools

Quintile Lottery

A provably fair on-chain raffle running on Sepolia. One ticket in five wins. No oracle, no house cut on the pot, no admin who can alter the result.

What it is

Quintile Lottery is a smart-contract raffle where every round is self-contained: tickets are purchased, the pot accumulates, and when the deadline passes anyone can trigger the draw. Winners are selected by the contract using public on-chain randomness — no trusted third party decides the outcome.

The demo lives on Sepolia testnet at the lottery app. It costs testnet ETH only. Try the no-wallet simulator to model any round before connecting.

How a round works

phasewhat happens
OpenTickets are on sale at Ξ0.005 each. Donations can be sent any time and go 100% to the pot.
ArmedThe deadline block has passed. The round is locked — no new tickets. Anyone can call requestDraw().
DrawingThe contract has a pending randomness request. Anyone can call executeDraw() once the block is final.
ClaimableWinners are set. Each winning wallet calls claim() to pull their prize. Prizes are never auto-pushed.
ExpiredClaim window has closed. Unclaimed prizes roll forward into the next pot.

Prize structure

About one ticket in five wins. The pot is divided into three legs — winners in earlier legs receive more per ticket:

legshare of potwinners
Grand20%1 – 3 depending on round size
Top decile50%~10% of all tickets, split evenly
Second decile30%~10% of all tickets, split evenly

Grand winners take 20% of the pot split among only 1–3 tickets — a single grand-prize ticket can be worth dozens of second-decile tickets on the same round. The simulator shows the exact split for any pot size and ticket count.

Design principles

The 1% protocol fee is the only value extracted from the system — it is segregated from the pot and can only be swept by the contract owner. Everything else (ticket purchase, donation, draw request, draw execution, claim) is permissionless: any wallet can perform any action, and the contract cannot be paused or altered after deployment.

Randomness comes from the block hash of a future block rather than an oracle. This keeps the contract independent and cheap. The tradeoff — a miner could theoretically withhold a block — is documented in Blocks, time & state.

Documentation

New to crypto? Start with Crypto 101, then try the simulator before connecting a wallet.