The Algorithm Explained
No math degree required. Here is exactly what happens, step by step, in plain language.
1. Entry Hashing
Every participant entry gets a unique SHA-256 fingerprint. This fingerprint is built from the entry ID, its weight, and the VRF seed. Even a tiny change in any of these values completely changes the hash, making tampering impossible.
SHA-256(entry_id + ':' + weight + ':' + seed)2. VRF Seed Commitment
The randomness source is a publicly verifiable seed from Chainlink VRF. This seed is published on-chain before the draw, so everyone knows the randomness source in advance and nobody can manipulate it.
seed = on-chain VRF output (64-char hex)3. Cumulative Weighting
All entry weights are capped at the maximum (e.g. 3.0×) and then stacked into a running total. Each entry 'owns' a slice of this total proportional to its weight. The bigger the weight, the bigger the slice.
cumulative[i] = sum(weights[0..i])4. Deterministic Random Pick
A random number between 0 and the total weight is generated using the VRF seed. Because the PRNG is fully deterministic, anyone who knows the seed can reproduce the exact same random values.
pick = rng.random() * total_weight5. Binary Search Selection
The random pick lands somewhere on the cumulative weight line. A fast binary search finds exactly which entry 'owns' that spot. This is efficient even with millions of entries (O(log n) per winner).
bisect_left(cumulative, pick) → winner_index6. No-Replacement Draw
After a winner is picked, they are removed from the pool so they cannot win again. The remaining entries are re-cumulative-weighted and the process repeats for each prize rank (1st, 2nd, 3rd).
available.remove(winner) → redrawImplementation Code
The same algorithm running on our servers. Copy it, run it, verify it.
Public API
Test the draw algorithm yourself using our public API. Send your own entries, get deterministic winners back, and verify everything independently.
POST /api/v1/lottery/drawNone — fully public100 req/minuteWinners, seed, hashes, draw logHow to Verify a Draw
Four simple steps to independently confirm that any draw result is fair and unmanipulated.
Download the published entry list (IDs + weights) from the API
Note the VRF seed hex string published on-chain before the draw
Run the algorithm locally using the same seed, entries, and max_weight_cap
Compare your output winners, cumulative weights, and entry hashes — they must match exactly