NateRich.net Docs Lab Tools

Math & Simulator

The Quintile Simulator plays out a whole round in your browser. No wallet, no tokens, no real or test ETH spent. Move the dials and watch the pot, the prize tiers, the countdown, and your odds resolve under the exact math the contract runs on-chain.

What it shows

One panel per piece of the round: the compression curve that shrinks the fuse as the pot fills, the round summary (pot, EV per ticket, edge, winners), the three prize tiers (Grand · Top · Second), your personal outcome at the ticket count you hold, and a Monte-Carlo button that rolls 1,000 fresh draws so you can watch the averages settle.

Every number is computed locally from the same constants the deployed contract uses. There is no API call, no testnet round behind it — the simulator is the model alone.

Controls

ControlMeaning
tickets soldRound size, 40 to the cap. The minimum (40) is the floor below which a round can’t arm or draw.
ticket pricePicks the game variant (Ether, Mini, BQTST, Mini-BQTST). Each variant rescales the pot cap, donation cap, and max tickets proportionally; the rules are identical.
donations to the potPure-upside ETH added to the pool. Donations don’t buy tickets, don’t pay the 1% fee, and can flip the round positive-EV. Anything above the donation cap rolls into the next round.
your ticketsHow many of the round’s tickets you hold (1 to 50 in the slider). Sets your win odds and expected payout.
▶ run 1,000 drawsMonte-Carlo button. Picks winning tickets uniformly without replacement, 1,000 times, and reports your hit-rate and average payout per draw. The narrative line shows one sampled draw in plain English.

The countdown curve

The fuller the pot, the shorter the fuse. The simulator draws this on a log scale so the full week-to-minute compression fits in one panel. A pot that just barely armed gets up to a week; a pot at the knee (about half the cap) sits near an hour; a pot near full sits near a minute. The purple dot is your current round on the curve.

This is the same compression the contract runs — see Blocks & time for the prose explanation and the role of the knee, cap, and donation overflow.

The math

Every panel in the simulator is one of the formulas below. The contract runs the same equations in Solidity; the simulator is a faithful JS port.

Pot and expected value

Let n be tickets sold, p the ticket price, d donations (after the cap, with overflow d' rolling forward), and f = 0.01 the protocol fee.

ticket revenue (net of fee)R = n · p · (1 − f)
potP = R + d
EV per ticketEV = P / n
edge vs. priceedge = (EV − p) / p

Each ticket has an exactly equal share of the pot in expectation — the tiers redistribute the same total. EV is what a single ticket is worth on average; edge is how that compares to the price paid.

Positive-EV rounds (EVL)

A round is positive-EV when donations more than cover the 1% fee skimmed from ticket spend. Concretely:

positive_EV ↔ d · 99 > Rgross,  where Rgross = n · p

Equivalently, EV > p. When that flips, the round is eligible to mint the EVL credential to participants.

Tier counts

About one ticket in five wins. The contract assigns three legs deterministically from n:

Grand winnersg = 1 for n < 100,  g = 2 for 100 ≤ n < 1000,  g = 3 for n ≥ 1000
Second-decile winnerss = ⌊ n / 10 ⌋
Top-decile winnerst = s when n mod 10 ≥ 5, otherwise t = s − g
Total winnersW = g + t + s

Tier shares

The pool splits 20% / 50% / 30% across Grand / Top / Second, evenly within each leg:

Grand shareP · 0.20 / g
Top-decile shareP · 0.50 / t
Second-decile shareP · 0.30 / s

Per-ticket value is therefore Grand » Top > Second. Dust (tiny rounding remainders) rolls into the next round — see Rules > Prize Tiers.

Your odds with k tickets

Winners are drawn uniformly without replacement, so the chance that you hold at least one winning ticket given you hold k out of n is:

P(win ≥1) = 1 − ∏i=0..W−1 (n − k − i) / (n − i)

Expected winning tickets are W · k / n; expected payout is k · EV (by symmetry); expected net is payout − cost.

Compression curve

Let b(P) be the deadline distance in blocks at pot P. With block constants BLOCK_WEEK = 50400, BLOCK_HOUR = 300, BLOCK_MIN = 5, and curve knees Pmin = 1, Pknee = 21, Pcap = 42 (canonical Ether scale):

b(P) = BLOCK_WEEK  for P < Pmin

b(P) = BLOCK_WEEK − (BLOCK_WEEK − BLOCK_HOUR) · (P − Pmin) / (Pknee − Pmin)  for Pmin ≤ P ≤ Pknee  (linear leg)

b(P) = BLOCK_HOUR − (BLOCK_HOUR − BLOCK_MIN) · ((P − Pknee) / (Pcap − Pknee))2  for Pknee < P < Pcap  (quadratic leg)

b(P) = BLOCK_MIN  for P ≥ Pcap

Each game variant rescales (Pmin, Pknee, Pcap) proportionally with its donation cap.

For a shorter EV explanation, see Expected Value. Live lottery: Quintile Lottery demo.