Skip to content

Method

How the draw works

There are two methods. A quick draw uses a seed made in your browser. A public draw locks the list first and takes its randomness from a drand round that does not exist yet. This page gives both in plain words and then in exact steps, so anyone can rebuild them.

One HTML file, no outside code. It talks only to the four drand mirrors, or you paste the round by hand.

Overview

The two methods in plain words

Quick draw

Your browser makes a random seed and mixes it with the sorted list of entries. The same list and the same seed always give the same winners, so anyone who has both can repeat the draw.

Nothing outside your browser adds randomness. That means you can draw again and get other winners, and the page says so.

Public draw

The list is turned into fingerprints and locked on our server, together with the time and the number of a drand round that has not happened yet. When drand publishes that round, its random value picks the winners from the locked list.

The host cannot choose the value, and nobody knows it when the list is locked. A changed list gives a different lock, and a lock made after the round fails the time check.

A host can still lock several lists and post one. The result page lists up to 50 other locks made from the same browser within 24 hours. A link posted before the draw lets others keep a copy; it does not prove that this was the only lock.

Method v2

Public draw, step by step

Method v2. Everything is UTF-8 text, hexadecimal is lower case, and H(x) is the SHA-256 of the text x written in hexadecimal.
  1. People

    After the filters, entries are grouped by person. Two entries are the same person when their cleaned names match: Unicode NFKC, spaces collapsed, no leading @, lower case. A person’s chances w are the number of their entries, capped at 100: entries beyond that add no chances. A draw has at most 10,000 people and 1,000,000 chances.

  2. Salt

    The browser makes a salt of 16 random bytes, written as 32 hexadecimal digits. The salt is public.

  3. Fingerprint of a person

    pfp is the first 32 hexadecimal digits of H("gt2|person|" + salt + "|" + name), with the cleaned name. For a Count only list, each person gets a random 16-byte nonce that stays in the host’s browser, and pfp is the first 32 digits of H("gt2|opaque|" + salt + "|" + nonce).

  4. List

    One line per person: pfp, a colon and the chances w. The lines are sorted by pfp in code unit order, and no pfp appears twice. The list hash is H of the lines joined by a line break.

  5. Lock

    The lock is the text "gt2|lock|" + chainHash + "|" + round + "|" + salt + "|" + listHash + "|" + people + "|" + chances + "|" + backups + "|" + prizes + "|" + listMode + "|" + namesHash, where prizes is name=count for each prize, joined by ; and with \, |, = and ; inside a name escaped by \, listMode is names, masked or opaque, and namesHash is H of the names the page shows, one per list line joined by a line break (H of the empty text for Count only). The names on the page are part of the lock, so they cannot be swapped afterwards. In Full names each shown name that can be tested has to give the fingerprint beside it (masked e-mail addresses and cut names cannot be tested), and in Masked names a name is only a label the host supplied. The lock hash is H of the lock text. The server picks the round and returns the lock hash; the browser computes it too and refuses the lock if the two differ.

  6. Round

    The chain is the drand quicknet. Its hash is 52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971, its first round is at Unix time 1692803367 and a round comes every 3 seconds, so the round at time t is floor((t - 1692803367) / 3) + 1. “Now” uses the server’s time plus 3 rounds. The other options use the round of the time asked for. The public key of the chain is fixed in the code of the site and of the verifier.

  7. Randomness

    The browser reads the round from drand (api.drand.sh, api2.drand.sh, api3.drand.sh or drand.cloudflare.com) and takes the first usable answer. It checks the BLS signature against the fixed public key and checks that the SHA-256 of the signature equals the randomness. Until the signature is checked the page says “computed, signature not checked yet” and never “Verified”. If the round is not out yet, the page waits and asks again at growing intervals. It never uses randomness from the device, and a round that never arrives leaves the draw without a result.

  8. Draw

    Random numbers are the 32-bit numbers of H(randomness + ":" + lockHash + ":" + counter), with the counter going 0, 1, 2 and so on, eight numbers per hash, big endian. For each slot, taking the prizes in order and then the backups: T is the sum of the chances of the people still on the list. A number x in [0, T) comes from rejection: limit = floor(2^32 / T) * T, numbers at or above limit are discarded, and x mod T is used. Walk the sorted list adding chances until the sum passes x. That person takes the slot and leaves the list.

  9. Result code

    "GT-" followed by the first 10 hexadecimal digits of H(lockHash + "|" + randomness + "|" + the picked pfps joined by commas), in upper case, shown as GT-XXXXX-XXXXX. It is a summary for the eye. The link is what finds the record.

The draw works on fingerprints and chances, so whoever checks it does not need any names.

Method v1

Quick draw, step by step

Method v1. Links with a seed in the address still work.
  1. Each entry of the final list becomes one line: the account name, cleaned (Unicode NFKC, spaces collapsed, no leading @) and in lower case, and a tab and the comment when there is one.
  2. The lines are sorted by character code, so the order of the paste does not matter.
  3. The fingerprint of the list is the SHA-256 hash of the lines joined by a line break, written in hexadecimal.
  4. The seed is 16 random bytes from the browser’s cryptographic generator (crypto.getRandomValues), written as 32 hexadecimal digits.
  5. Random numbers come from the SHA-256 of the text seed:fingerprint:counter, with the counter going 0, 1, 2 and so on. Each hash gives eight 32-bit numbers, read big endian.
  6. To choose among N entries, a number is used only if it is below the largest multiple of N that fits in 32 bits. The others are discarded, which keeps the chances exactly equal.
  7. A Fisher-Yates shuffle with those numbers picks the winners first and the backups next. An entry cannot be picked twice.
  8. The code is GT- plus the first 10 hexadecimal digits, in upper case, of the SHA-256 of fingerprint|seed|winners|backups|picked lines, with the picked lines joined by a line break, shown as GT-XXXXX-XXXXX.

Check it yourself

How to check without our site

The dossier and the standalone verifier are made so that a result does not depend on the page that showed it.
  1. Download the dossier

    On the result page, download dossier.json. It holds the list of fingerprints, the salt, the prizes, the backups, the round, the lock hash and the lock time, and, after the round, the randomness and the signature. Download it before the draw if you want your own copy of the lock.

  2. Download the verifier

    The standalone verifier is a single HTML file with no outside code. Open it on your machine and load the dossier.

  3. Let it read the round

    If the dossier has no round yet, the verifier fetches it from the four drand mirrors, or you can paste the answer of any mirror. It contacts nothing else, and nothing you load into it is sent anywhere.

  4. Read the steps

    It reports each step as passed, failed or skipped: the dossier is readable, the chain is the quicknet, the list is sorted and fits the limits, the prizes fit the list, the names shown are the ones locked, the lock hash follows from the list, the salt, the round, the prizes and the names, the lock is dated before the round, the randomness is the SHA-256 of the signature, the BLS signature is valid for the round and the fixed key, the winners follow from the lock and the randomness, and the result code matches. A skipped step claims nothing.

  5. Test a name

    When the list was locked with Masked names or Full names, the verifier can test a name against it. A Count only list cannot be tested.

  6. Or write your own

    The steps above are complete. Compare your result with the test vectors, including the cases that must fail.

Download the verifier

A quick draw is checked by repeating it: paste the list and the seed on the verify page and compare the winners and the code.

Test values

Test vectors

Each case is a complete draw: the entries, the salt, the prizes and a real round of the drand quicknet with its signature. A checker you write passes when it reproduces the list hash, the names hash, the lock hash, the people picked and the code of every case.
The three test cases and the values a checker has to reproduce
CaseWhat it isList hashNames hashLock hashCode
No weights: eight people, one prize, two backups8 people, 8 chances, 1 winners and 2 backups, drand round 33,000,001.f9ca5016a675d4bdc156fb937bd81841554ede177ab5073ae5bba057d6928d8c8197efa9be0d1472b67a5d53197e47d4cea2d6f3a05f52d1a3812e4738437c999935a134e8c4fe3bb792e79d1e6b053b9ba7e102766cdf5fe124e4c2a0f4fd3fGT-9F73E-D63C7
Weights and three prizes: twelve people, twenty chances13 people, 22 chances, 6 winners and 2 backups, drand round 33,500,003.b2571822d70fc64c4b7b10a0c35b814f959c64adae28d72ea1507089756a83577d80971b455f0dff936fa0032192f36accf6d31aec0f07c00df9db3075ff72ee90bd6e498ce678cf8776d28edb5468a7dfbcfa2b426fb7006ec0aa796fc6d830GT-23DE9-E90EC
Opaque list: nine people, e-mails among them9 people, 9 chances, 2 winners and 1 backups, drand round 33,900,005.abab17f2b4dbfdd757165c9331a104a9fc6829d64dca23236c2fd14c349023bbe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855e550c4c9dc84ce30a10e389e8ca1da1fb0120d46ae9e0e3f38e2e59fdf741a3aGT-A1C8D-5AC24

Cases that must fail

Change one thing and the check has to stop agreeing with the vector.

  • One character of the list, a fingerprint or a number of chances: the list hash, the lock hash and the code change.
  • A different salt: every fingerprint changes, and so does everything after it.
  • A name shown on the page that is not the one locked: the names hash, the lock hash and the code change.
  • A different round: the lock hash changes, and the randomness belongs to the old round.
  • A prize changed in name, count or position, or a different number of backups: the lock hash changes.
  • A signature that is not the round’s, or a randomness that does not follow from its signature: the round is refused.
What could go wrong

What could go wrong, what stops it, and what does not

The same points sit behind the “What it cannot show” box of every result page.
What could go wrong, what stops it and what does not
What could go wrongWhat stops itWhat does not stop it
The host changes the list after seeing who would winThe fingerprints of the list, and the names shown next to them, are inside the lock hash, and the lock names the round before it exists. A changed list gives another lock hash and the check fails.A different list locked before the round is a different lock. See the next row.
The host locks several lists and posts only the one that picked a friendThe page lists up to 50 other locks made from the same browser within 24 hours, and counts the networks that opened the link before the draw.Locks made from another browser do not show up. A link posted before the draw lets others keep a copy but does not prove that anyone saw it, and a link first posted after the draw says nothing about the time before it.
The host waits for the round and then locks a list that suitsThe lock must be dated before the round, and the server fixes the round when it records the lock. The time check fails when the lock is dated after the round.The lock time is our clock. Until someone else holds a copy it is our word. You can download the dossier before the draw or ask the Internet Archive to save the lock; that only helps if the copy is kept.
The list leaves people out, or has fake entriesNothing in the method. The page shows how many entries each filter removed and how many people took part, and entrants can look for their own name unless the host chose Count only.The page cannot show that the list is complete or that the entries are real people, and the post alone may not either.
Someone says the winners were picked by handAnyone can redo the draw from the dossier with the standalone verifier or with their own code. The rule is fixed, and the test vectors pin it down.A host who announces other names than the ones the rule gives. Compare the announcement with the result page.
The site shows a wrong resultThe site cannot produce a valid signature for a value it chose, and the verifier uses only the lock, the round and the fixed rule. A dossier you saved catches a page that shows other winners.If you read only our page, you rely on our page. For anything that matters, run the verifier.
drand is late or unreachableThe page waits and asks again, and tries four mirrors. It never falls back to a random number from the device.A round that never arrives leaves the draw without a result, and the page says so.
A name is worked out from the listThe fingerprints use a public salt, so the hash does not directly reveal a name. A Count only list uses a random nonce for each person, so no name can be tested.In Masked names and Full names, anyone who guesses a name can test it. The page says so before the lock.
The host deletes a lock they do not likeA deleted record leaves a marker with the date, and it still counts when locks are compared.After 400 days the record is no longer shown, and the marker is deleted with it in the next cleanup run.

Limits

Limits

  • The lock time is the giveaway.tools clock. A timestamp from an independent service is not part of the lock.
  • The page cannot show that this was the only lock. It lists up to 50 other locks made from the same browser within 24 hours, not locks made from another browser.
  • It cannot show that the list is complete or that the entries are real people.
  • In Masked names and Full names, anyone with the link can test a name.
  • The draw depends on drand. If a round never arrives, there is no result.
  • The verifier checks the calculation. It cannot check whether the prize was sent or whether the post said what the host says it said.
  • A quick draw can be repeated, and checking it means repeating it. It cannot show that the host drew only once.
  • A public draw takes up to 10,000 people, 1,000,000 chances in total and 100 chances for one person. Names stop being shown after 90 days and the record after 400 days.

Verified winner picker · Verify a giveaway result · Start a draw

Questions

What people ask first

Why does the public draw use drand?

drand publishes a new signed random value on a fixed schedule, one every 3 seconds on the chain used here. The lock names the round before it exists, so nobody can choose a list after seeing the number that will pick from it.

Which drand chain does the site use?

The quicknet chain, hash 52db9ba7…e971. Its hash, start time, period and public key are fixed in the code of the site and of the verifier, so a round from another chain is refused.

What is the fingerprint of a person?

In Full and Masked names, the first 32 hexadecimal digits of SHA-256("gt2|person|" + salt + "|" + name), with the name cleaned of capital letters, extra spaces and a leading @. In Count only, a random nonce stands in for the name. The salt is public, so anyone who guesses a name can compute its fingerprint.

Can a name be worked out from its fingerprint?

The hash does not directly reveal the name, but a guess can be tested, which is why masked and full-name lists say that anyone can check a name. In Count only each person gets a random nonce kept in the host’s browser, so nobody can test a name.

Why are the prizes and the backups inside the lock?

So the host cannot add a prize or change the number of backups after seeing the winners. A different prize list, order or count gives a different lock hash, and the check fails.

How does a draw with unequal chances work?

For each prize in order, the draw takes a number between 0 and the sum of the chances still on the list and walks the sorted list until the running sum passes it. That person takes the prize and leaves the list.

Why are some random numbers thrown away?

A 32-bit number cut down to a smaller range slightly favours the low end unless the range divides 2 to the 32nd power. Discarding the numbers above the largest multiple of the range makes every chance exactly equal.

Does the result code prove anything?

No. It is a summary of the lock, the randomness and the people drawn, short enough to compare by eye. The proof is the lock, the round and the signature, which the verifier redoes.

What does the standalone verifier need from the network?

Nothing, if the dossier carries the round or you paste it. Otherwise it fetches the round from the four drand mirrors and contacts nothing else. Nothing you load into it is sent anywhere.

Can I write my own checker?

Yes. The steps on this page are complete, and the test cases give inputs and results to compare with, including cases that must fail: one character of the list, the salt, the round, a prize or the signature changed.