Verified draws
How draws work.
How every winner is picked, why nobody, including us, can choose or predict a drawn winner, how you can check a draw yourself, and what the checks don’t cover.
How draws work at The Reg Raffle
The Verity draw engine, explained. Part 1 is for everyone, including solicitors, journalists and customers. Part 2 is for auditors and test labs. This document is published on the site at /how-draws-work.
Part 1. In plain English
The short version
Every draw is decided by a computer process that nobody can steer, including us. Before we sell a single entry, we lock in a secret number. When entries close, we lock in the full list of entries. The winner is then worked out from those two things and a random number published by an independent public service a minute or so after entries close. Nobody knows that number in advance, including us. Afterwards we publish everything, so anyone can repeat the draw on their own computer and check they get the same winner.
What “a draw” means here
There are two kinds of prize.
- Drawn prizes: the monthly number-plate cash draws, and competitions with a first, second or third prize. Everyone’s entries go into one list, and the winners are picked from it after entries close.
- Instant wins: some competitions have prizes that are already set aside on particular entry numbers when the competition opens. When you buy, your entry numbers are given to you at random. If one of them is a winning number, you’ve won. The spin or the scratch card only shows a result that was already decided.
How a drawn prize is decided
1. Before any entries are sold, we seal a secret number. The computer creates a long random number, the “seed”, and keeps it secret. We publish its fingerprint. A fingerprint is a short code worked out from the number in a way that can’t be reversed and can’t be matched by any other number. Once the fingerprint is public, we can’t swap the seed for a different one without everyone being able to tell.
2. We also fix, in advance, which public random number will be used. The public random number comes from drand, a service run by a group of independent universities and companies (the League of Entropy). It publishes a new random number every three seconds, each with a digital signature that proves it’s genuine. When a competition opens, we record which of those future numbers its draw will use: the first one published a minute after entries close. We can’t pick a different one later.
3. When entries close, the entry list is frozen. At the closing time, the full list of entries is fingerprinted and published. That includes paid entries, free postal entries, bonus entries and membership entries, all in the same list. From that moment the system refuses any change to the list. Entries arriving afterwards aren’t added.
4. The draw. About a minute later, drand publishes the number we fixed in step 2. Nobody knew it before then: it didn’t exist yet. The computer checks its signature, then combines three things: our secret seed, the frozen list, and the drand number. A published, standard method turns that combination into a winner. Every entry has exactly the same chance.
5. Everything is published. After the draw we publish the secret seed, the list of entries (by ticket number, with a code instead of a name), the drand number and its signature, and the winners. Anyone can check:
- that the seed matches the fingerprint we published before sales;
- that the entry list matches the fingerprint taken at the close;
- that the drand number is genuine and was published after entries closed;
- that the published method gives the same winners.
Our Verify page does all of this in your own web browser, with its own copy of the method. It doesn’t ask our server for the answer.
Why nobody, including us, can choose or predict a drawn winner
- We know the seed, but the winner also depends on the drand number, which doesn’t exist until after entries close. So we can’t know the winner while entries can still change.
- Once drand publishes, the entry list and the seed are already fixed and public, so we can’t change either to get a different winner.
- We can’t choose which drand number to use: it was fixed when the competition opened.
- If anything delays the close (for example a server outage), the system takes a later drand number that is still in the future and marks the draw as “closed late” in public, with how late it was.
- Changing the seed, the list or the drand number would break a fingerprint or a signature that’s already public.
How instant wins are kept fair
- The winning entry numbers are worked out from the sealed seed when the competition opens, so they’re fixed before anyone buys. We can’t move a prize after that.
- Your entry numbers are picked at random by the computer from the numbers not yet sold. You can’t choose them, and neither can we.
- So your chance of winning is the same whoever you are and whenever you buy: it depends only on how many prizes and how many entries are left.
- After the competition ends, we publish the seed, so anyone can check that the winning numbers were the ones fixed at the start.
Free postal entries
Every draw and competition can be entered free by post. A postal entry goes into exactly the same list as a paid one, gets an entry number in exactly the same way, and has exactly the same chance. The draw can’t tell the difference: it doesn’t know which entries were paid for.
How you can check a draw
- Go to Verify and choose a finished draw.
- The page fetches the published record and re-runs the draw in your browser.
- Each check shows a tick: seed against fingerprint, entry list against fingerprint, drand signature, round published after the close, and winners.
- If you entered, look for your ticket number in the entry list.
Our tests of the method (millions of simulated draws, and the standard US government randomness test battery) are in the randomness report.
What this doesn’t promise
We’d rather be clear about the limits.
- Instant wins are decided in advance. The winning numbers are fixed when a competition opens, and our server could work them out. What stops anyone using that is the random allocation of entry numbers. Nobody outside can check, purchase by purchase, that the numbers were handed out at random. We check it statistically every week, and the test lab reviews the code.
- The checks cover the draw, not everything around it. They prove the winner was picked fairly from the published list. They don’t, on their own, prove the list contains everyone who paid, so check your own entry number is in it. They don’t prove a winner will pass the ID and V5C checks. And they don’t cover delivery of prizes.
- We rely on drand being honest. drand is run by many independent organisations, and enough of them would have to work together to cheat. Even then, they wouldn’t know our secret seed.
- The checks need the published record. It stays public, and every day a fingerprint of the whole record is sent to people who keep it away from our systems, so the record can’t be rewritten without it showing.
- Winning is down to chance. Nothing here changes the odds. Please play within your limits: play responsibly.
Part 2. Technical description
1. Scope and versions
Verity is a commit–reveal draw engine with a public randomness beacon. The normative specification is docs/verity/VERITY-1-SPEC.md, which defines both versions byte for byte:
| Version | Used by | Stream | Selection | Instant table |
|---|---|---|---|---|
| VERITY-1 (frozen) | Competitions created before VERITY-2 | HMAC-SHA256 counter construction keyed on the hex seed | Rejection sampling on 48-bit values, without replacement | Per-slot rejection sampling with collision skip |
| VERITY-2 (current) | Every competition created since | HMAC_DRBG, SHA-256, NIST SP 800-90A Rev. 1 §10.1.2 (no reseed, no prediction resistance) | Simple Discard Method (SP 800-90A Appendix A.5.1), forward Fisher–Yates (Durstenfeld) prefix | Fisher–Yates prefix over all ticket numbers, on a separate personalised stream |
Each competition records its version (competitions.spec, write-once) and is verified with that version forever. VERITY-1’s code is frozen and its known-answer vectors run on every test run. Changing any output for existing inputs requires a new version (rule 1).
2. Constructions (VERITY-2)
-
Seed:
server_seed= 32 bytes from the OS CSPRNG, stored encrypted (VERITY_SEED_KEY).commitment = SHA-256(ASCII(hex(server_seed))), published before any sale. -
Entries: the canonical list of
"{ticket}|{owner}"lines sorted by ticket, whereowneris a 12-hex tag derived from the order reference.entries_hash = SHA-256("VERITY-2|entries|" ‖ ref ‖ "\n" ‖ lines). -
Beacon: drand quicknet (chain
52db9ba7…e971, period 3 s, schemebls-unchained-g1-rfc9380).randomness = SHA-256(σ), where σ is a BLS signature onSHA-256(uint64_be(round))verified against the published group key. Both the server (app/Verity/Drand.php) and the browser (src/lib/drand.js) implement the pairing check independently. -
Draw stream:
HMAC_DRBG.Instantiate(entropy = seed, nonce = beacon_randomness ‖ entries_hash, personalisation = "VERITY-2|main|" ‖ ref). -
Index selection:
below(n)takes the leftmostm = bitlen(n−1)bits of oneGenerate(ceil(m/8))request and discards values ≥ n. Each attempt is accepted with probability > ½. There is no modulo reduction, so there is no modulo bias. -
Winners: positions 1…k of a forward Fisher–Yates shuffle of the indices 0…N−1 (
j = i + below(N−i)). Every ordered k-tuple of distinct entries has probability (N−k)!/N!. Each entry is first with probability 1/N. -
Redraw (protocol R2, spec §5.6): when a winner forfeits (a failed check, or no documents in time, with a second admin’s approval), the same transaction:
- freezes the eligible list (everyone who hasn’t already won) and hashes it;
- commits to a drand round about a minute in the future, with the same margins as a close.
It’s on the audit chain, timestamped by an outside authority, and shown on the public verify page at once: “Redraw 1 scheduled: drand round X, available at about HH:MM”. Once that round is out, the replacement is drawn from a fresh HMAC_DRBG stream seeded with the draw seed, the redraw number, the forfeit record, the eligible list and the new round.
So nobody, us included, can know who a redraw will pick when the forfeit is approved, and getting a winner rejected can’t hand the prize to a known person. Choosing when to approve only moves the round later, to a round that’s still unknown. Redraws made before this (protocol R1, the next position of the same shuffle) keep verifying exactly as before.
-
Instant table: an independent stream (
nonce = SHA-256("VERITY-2|instant-nonce|" ‖ ref), personalisation"VERITY-2|instant|" ‖ ref). Slots (prizes expanded in published order) take ticket numbers from a Fisher–Yates prefix over 1…max_tickets.instant_table_hash = SHA-256("VERITY-2|instant-table|" ‖ ref ‖ "|" ‖ max_tickets ‖ "\n" ‖ lines)(it covers the ticket count too: spec §6.3). It is withheld until the draw, because it isn’t salted and a small table could be brute-forced from it. -
Ticket allocation at purchase (outside the engine, spec §9): uniform over unsold numbers using PHP’s
Random\Randomizeron the OS CSPRNG. VERITY-1/2 plate draws, which have no instant prizes, number entries sequentially. -
Audit chain:
hash = SHA-256(prev ‖ "|" ‖ seq ‖ "|" ‖ type ‖ "|" ‖ canonical_json(payload) ‖ "|" ‖ occurred_at). It is append-only (database triggers), checked hourly, and anchored daily outside the database.
3. Commitments and timeline
time ──────────────────────────────────────────────────────────────────────────►
PUBLISH SALES CLOSE (closes_at) ROUND r DRAW REVEAL
seed ← CSPRNG tickets ← CSPRNG entries frozen published verify σ(r) seed, entries,
commitment ────► order.paid on chain entries_hash ────► by drand winners ← beacon, winners
r = round_at( (ticket numbers) round r committed (~60 s after engine on chain and
closes_at+60) (or later, flagged late) closes_at) /verify
table fixed
commitment, r and the table hash are recorded on the chain at PUBLISH. entries_hash at CLOSE.
Invariant: round_time(r) > closed_at, so no input is known to anyone while entries can change.
| Commitment | Made at | Recorded | Fixed by |
|---|---|---|---|
Seed (commitment) |
Creation | competition.published |
rr_comp_committed trigger; SHA-256 preimage resistance |
| Planned round | Publish (re-planned only by audited extension) | competition.published / competition.extended |
Write-once column; chain |
| Instant table | Publish | Table hash on the chain (withheld from view until drawn) | rr_iwt_locked_* triggers |
| Entries | Close | competition.closed (hash, count, round, late flag) |
rr_tickets_frozen_*, rr_comp_sealed; DrawService::closeProblem |
| Result | Draw | draw.completed (seed, beacon, signature, draw seed, winners, code fingerprint) |
Write-once columns; status flow trigger |
4. Verification procedure
From /api/competitions/{slug}/verification (spec §7):
- Pick the algorithm by
verity.spec. SHA-256(revealed_seed) = commitment.- With instant prizes: re-derive the table from the seed,
max_ticketsand the prize list. It must hash toinstant_table_hashand equal the published rows. - With an end draw: the hash of the published entries equals
entries_hash, and the count matches. σ verifies forbeacon_round.round_time(beacon_round) > closed_at. Unlessbeacon_late,beacon_round = beacon_planned_round. Re-running the draw gives the publisheddraw_seedand winners, in order. /api/auditverifies, and its events agree with the record.
Three independent implementations do this: the browser (/verify/{slug}, frontend/src/lib/verity.js and drand.js), the command line (frontend/scripts/verify-export.mjs), and a clean-room Python verifier written from the spec alone (tools/verity-verify-py/). All three agree on docs/verity/test-vectors.json (75 of 75 cases), and on 16 past draws (9 VERITY-1, 7 VERITY-2) of a rehearsed deploy, re-verified in PHP, JavaScript and Python (docs/verity/notes/pyverify.md). The Python verifier was written from the spec alone, without reading the engine code.
5. Which code is live
The server reports the SHA-256 fingerprint of its engine files and of its draw-path files. These are published at /api/site (verity.engine_sha256, verity.draw_path_sha256), on every draw.completed event, on every draw certificate, and every hour on the verity:check record. docs/verity/SOURCE-MANIFEST.txt (tools/verity-manifest/manifest.mjs) lists the same fingerprints, and the SHA-256 of each file, for the reviewed source. It also lists the built browser verifier, which anyone can download and hash. A server can misreport its own fingerprint, so this is an attestation and not a proof (threat model §5.6). It ties a lab certificate to a public, timestamped record.
6. What the design does and doesn’t guarantee
Guaranteed by the cryptography and the public data, even against the operator:
- the seed wasn’t changed after commitment;
- the entry list wasn’t changed after the close;
- the beacon round wasn’t chosen after the fact;
- the winners are the spec’s output for those inputs.
Unpredictability of main draws to the operator holds as long as the close genuinely precedes the round. The verifier relies on the server’s closed_at for that. An external timestamp of the entries hash at close is proposed (threat model G-8).
Relies on the operator’s honest code, and checked indirectly:
- random allocation of instant-win numbers (weekly statistical check
verity:win-rates, code review, the live fingerprint); - completeness of the entry list (each entrant can find their ticket; every
order.paidis on the chain).
Full analysis: docs/verity/THREAT-MODEL.md.
7. Evidence pack
| Evidence | Where |
|---|---|
| Specification (both versions) | docs/verity/VERITY-1-SPEC.md |
| Known-answer vectors (both versions, edge cases, DRBG) | docs/verity/test-vectors.json; NIST CAVP HMAC_DRBG vectors in backend/tests/Fixtures/verity/ |
| Statistical evidence (NIST SP 800-22, chi-square on simulated draws and tables, both versions) | docs/verity/evidence/ (re-run with scripts/verity-evidence.sh); summary at /randomness (docs/randomness-report.md) |
| Clean-room verifier and its cross-check of past draws | tools/verity-verify-py/, docs/verity/notes/pyverify.md |
| Code review and edge tests | docs/verity/notes/review.md; backend/tests/Feature/Verity/ |
| Threat model | docs/verity/THREAT-MODEL.md |
| Source manifest with SHA-256 per file | docs/verity/SOURCE-MANIFEST.txt |
| Lab submission pack | docs/verity/LAB-SUBMISSION-PACK.md |
| Security history (audits, pentests) | docs/SECURITY.md, docs/history/PENTEST-2026-11-06*.md, docs/history/AUDIT-2026-11-05.md |
Check a finished draw on the Verify page, or read how we tested the method in the randomness report.