Everything bitsig returns can be recomputed from public data with what is on this page. The test vectors are produced by the code the service runs; an implementation that matches them derives the same results.
Conventions: SHA-256 is FIPS 180-4. ‖ is byte concatenation. Hex is lowercase. Strings are UTF-8. Times are UTC.
1. The beacon
All randomness comes from drand’s quicknet chain, run by the League of Entropy.
| Chain hash | 52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971 |
| Scheme | bls-unchained-g1-rfc9380 |
| Public key (G2, compressed) | 83cf0f2896adee7eb8b5f01fcad3912212c437e0073e911fb90022d3e760183c8c4b450b6a0a6c3ac6a5776a2d1064510d1fec758c921cc22b0e17e63aaf4bcb5ed66304de9cf809bd274ca73bab4af5a6e9c76a4bc09e76eae8991ef5ece45a |
| Genesis | 1692803367 (Unix seconds) |
| Period | 3 seconds |
Round N carries a 48-byte signature, a BLS signature on G1 over SHA-256(uint64_be(N)), hashed to the curve with domain separation tag BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_. A round is accepted only if
- the signature verifies under the public key above, and
randomness= SHA-256(signature).
bitsig checks both before using a round. The verify page and the Python client check both again on the reader’s side, so a round served by a dishonest relay is rejected. Call the 32-byte randomness R.
Round N is published at genesis + (N − 1) × 3 seconds. The current round at time t is floor((t − genesis) / 3) + 1. The first round at or after t is max(1, ceil((t − genesis) / 3) + 1).
2. The stream
A result is read from a byte stream made from R and a seed string S:
block(i) = SHA-256( R ‖ UTF-8(S) ‖ uint32_be(i) ) i = 0, 1, 2, …
stream = block(0) ‖ block(1) ‖ block(2) ‖ …
Every operation starts at the front of a fresh stream and reads forward.
- word: the next 4 bytes as an unsigned 32-bit big-endian integer.
- uniform(k), 1 ≤ k ≤ 232: let
limit = floor(2^32 / k) × k; read words until one is belowlimit; return it mod k. Rejected words are consumed.
3. Operations
An operation is a short string. Results:
| Op | Result |
|---|---|
"" or bit | the first bit of the stream, as 0 or 1 |
n (1–4096) | the first n bits, most significant bit of each byte first |
coin | first bit: 1 = heads, 0 = tails |
dN | uniform(N) + 1 |
A-B | A + uniform(B − A + 1) |
hex/n (1–1024) | the first n bytes as hex |
pick?x,y,… | items[uniform(count)] |
shuffle?x,y,… | Fisher–Yates: for i from count − 1 down to 1, swap item i with item uniform(i + 1) |
circle?x,y,…&teams=…¬=… | A Secret Santa circle with exclusions; see Circles with exclusions |
weighted/k?x:3,y:2,… | Each item has a whole-number weight of at least 1. k times (default: count − 1): r = uniform(sum of remaining weights); take the first remaining item whose running total of weights exceeds r, and remove it. Items not drawn follow in the order listed. |
Items are split on commas and trimmed; empty items are dropped. Item order matters: it is part of the operation. In a weighted item, the weight follows the last colon.
Circles with exclusions
A Secret Santa circle without exclusions is a shuffle: the entry in seat k gives to the entry in seat k + 1, and the last gives to the first. When some people must not draw each other, the drawing uses circle? instead:
circle?x,y,z,…&teams=1,1,2,0,…¬=3-7,4-9
Grammar. After the entries come, in this order and in lower case, an optional &teams= part and an optional ¬= part; nothing else may follow, and an entry may not contain &, a word and = (so &TEAMS= or &team= is refused, not read as part of a name). The first &teams= or ¬= ends the entries. Entries are split on commas, trimmed, and empty ones dropped before anything is counted; entries must all be different. teams is whole numbers separated by commas, one per entry that remains after empty items are dropped, in list order. A number is 0 or 1 to 6 digits starting with 1–9, so there are no leading zeros. 0 means no team. Labels are numbered 1, 2, 3 by first appearance, and a label used by only one entry is refused (write 0). A teams part that is all zeros means the same as none; bitsig writes none. Two entries with the same label never give to each other. not lists extra pairs by 1-based entry number, each as low-high with low below high, no leading zeros, sorted by low and then high, no repeats, each number at most the number of entries. The two never give to each other, in either direction. A pair whose two entries share a team is refused.
A seat is a position 0 to n − 1 in the circle. The edge e runs from seat e to seat e + 1, and the seat after seat n − 1 is seat 0. The entry in seat e gives to the entry in the seat after it.
- Fisher–Yates on the stream, exactly as
shuffle; the result is the seat order. - Edge e is bad if the entry in seat e and the entry in the seat after it are the same entry, share a team, or are an extra pair.
- Repair. While a bad edge exists: if 100·n + 1,000 steps have been taken, stop; the result is no circle. Otherwise count a step. Draw
q = uniform(number of bad edges), and let p be the q-th bad edge (counting from 0) in ascending order. Drawj = uniform(n)and let i = (p + 1) mod n. If j ≠ i, swap seats i and j, and keep the swap only if the number of bad edges among the edges i − 1, i, j − 1 and j (each mod n, counted once if two coincide) does not go up; otherwise undo it. A step with j = i still counts, and both drawings are still made. - Mixing. After a valid circle, make 100·n proposals:
i = uniform(n),j = uniform(n); if i ≠ j, swap seats i and j and keep the swap only if none of those four edges is bad afterwards. Both drawings are made for every proposal.
Every uniform(k) reads at least one 4-byte word from the stream, including uniform(1), which reads a word and returns 0. The result is the entries in seat order, or an empty list for “no circle”.
The operation accepts two or more entries. With two, the circle is two seats giving to each other; with three, every pair is adjacent, so any exclusion leaves no circle. bitsig makes a drawing from a circle only for three or more entries, refuses a setup in which anyone has fewer than three possible matches, refuses a team of more than half the group, and refuses any setup where a validation trial fails.
Validation trials. A trial runs steps 1 to 3 (not mixing, which comes after repair and can’t change its step count) with a plain generator instead of the stream. The generator is xorshift128 on 32-bit words: a = seed or 1 (a seed of 0 becomes 1), b = 362436069, c = 521288629, d = 88675123; discard 20 words; each word is t = (a xor (a << 11)) mod 2^32; a = b; b = c; c = d; d = (d xor (d >> 19) xor t xor (t >> 8)) mod 2^32, returning d. Its uniform(k) uses the same rule as the stream: with limit = floor(2^32 / k) · k, take words until one is below limit, and return it mod k. Trial t (from 0) is seeded with (base + t · 2654435761) mod 2^32, where base is the first four bytes, big-endian, of the SHA-256 of the UTF-8 text circle-trials/N/TEAMS/PAIRS: N the number of entries, TEAMS the team numbers joined by commas (or - if there are none), PAIRS the pairs as low-high joined by commas (or -). The names are not part of it, so a setup with hidden names gets the same verdict in the browser and on bitsig. There are 400 trials for up to 12 entries, 200 for up to 200, 40 for up to 1,000, and 10 above that. A trial fails if it ends in no circle or takes more than half the step limit, (100·n + 1,000) / 2 steps. Trials never touch a real drawing’s randomness.
Evenness. Repair alone does not give every valid circle the same chance; the mixing step is meant to. Mixing proposes symmetric swaps and refuses only invalid results, so the chain’s long-run distribution is uniform over valid circles; how fast it gets there is what the tests measure. The multiplier is 100·n proposals. Tests with fixed seeds: 6 people in 3 couples (32 valid circles), and 8 people with teams of 3 and 2 and three pairs (464 valid circles; 139,200 runs); neither shows a difference from even odds at that multiplier. At 5·n the 8-person case did show one (chi-square about 700 on 463 degrees of freedom). Tighter setups and larger groups converge more slowly: for 100 people in teams of 45, 30 and 25, the mean number of times a team-1 entry gives to a team-2 entry is exactly 25 in an even result, and measured 24.43 at 5·n, 24.98 at 50·n and 25.01 at 100·n (4,000 runs each). Evenness for large groups is not proven. The teams and pairs are part of the operation, so anyone with the link can see them.
Referenced lists
A pick or shuffle whose list is too long to write into the operation names the list by its fingerprint instead:
pick@COUNT:FINGERPRINT shuffle@COUNT:FINGERPRINT
list bytes = UTF-8( item(0) ‖ "\n" ‖ item(1) ‖ "\n" ‖ … ‖ item(COUNT − 1) )
FINGERPRINT = SHA-256( list bytes ), as 64 lowercase hex digits
There is no newline after the last item. COUNT is the number of items, written without leading zeros. Items are exactly as the drawing uses them: trimmed, never empty, with no commas or line breaks. To check such an operation, fetch the list, confirm that its SHA-256 is FINGERPRINT and that splitting it on \n gives COUNT items, then run pick or shuffle on those items exactly as in the table above. Nothing about the derivation changes.
bitsig uses a reference only when the list has more than 10,000 items, or when the operation written out (pick?… or shuffle?…) would be over 400,000 characters. Every other drawing, including every drawing made before referenced lists existed, writes its list into the operation as before. A referenced list can hold up to 1,000,000 items and 10,000,000 bytes, with each item at most 200 characters.
4. Drawings
A drawing fixes, before its round is published, the operation (its entry list, in order), the round, and the seed. The seed is the drawing’s id, a 10-character string bitsig generates at random when the drawing is made. bitsig refuses to make a drawing whose round is less than two rounds ahead.
- One winner:
pick. - k winners, or a full order:
shuffle; winners are the first k of the shuffled list, in order. - g groups:
shuffle, then deal the shuffled list round-robin: item i goes to groupi mod g. - Weighted lottery:
weighted/k, entries listed worst team first, weights as the number of chances each gets. The first k picks are drawn by weight; everyone else keeps the listed order. With every pick weighted, k is omitted.
A drawing with a referenced list (section 3) serves the list at /draw/id/list.txt, byte for byte as fingerprinted, and its record carries list = { count, sha256, url }. Its result is the entry drawn for pick; for shuffle, only the first k + 3 entries of the shuffled order (the winners, then three backups), or all of them if there are fewer. The rest of the order follows from the same computation. With hidden names, the list holds the codes, never the names.
Limits per drawing: picking winners takes up to 1,000,000 entries, with at most 10,000 winners when the list has more than 10,000 entries. A full order, groups, a Secret Santa circle and a weighted lottery take up to 10,000 entries, because their results list every entry (and a weighted lottery’s work grows with the square of the list). A request to POST /draw can be up to 16 MB.
Before the round, the drawing’s page carries a creation receipt signed by bitsig (section 7) with the operation, round, seed and creation time. A result therefore can’t be steered by choosing the entries, seed or round after the randomness is known.
Hidden names
A drawing can hide its entries. The organizer’s browser picks a random 16-byte salt Si for each entry Ei, written as 32 lowercase hex digits, and replaces the entry with
tag = first 16 hex digits of SHA-256( "bitsig-entry-v2" ‖ "\n" ‖ S_i ‖ "\n" ‖ norm(E_i) )
norm applies Unicode NFC, removes leading and trailing spaces, tabs, carriage returns and line feeds, turns each run of them into one space, and lowercases A–Z only. The drawing then runs on the tags exactly as above. The record carries mask = { scheme: "bitsig-entry-v2" }; bitsig never receives the entries or the salts. Whoever holds an entry’s salt can show that the entry is on the list and where it was drawn. Without the salt, a guessed entry can’t be tested. A private check link is the drawing’s address with #s=Si appended; the part after # is never sent to a server.
Drawings made before 22 November 2026 used bitsig-entry-v1: one public salt for the whole list, carried as mask.salt, with the same formula. Under v1, anyone can test a guessed entry.
5. Seeds
A seed is R itself for a chosen round. /day/YYYY-MM-DD and /today use the first round at or after 00:00:00 UTC on that date. seed_u32 and seed_u64 are the first 4 and 8 bytes of R as unsigned big-endian integers.
6. Organizer logs
An organizer token T is stored only as SHA-256("bitsg-organizer:" ‖ T). Every drawing made with the token becomes the next entry in the organizer’s log:
entry = { organizer, seq, prev, draw, title, op, winners, round, created_at [, groups] [, mask] }
hash = SHA-256( canonical_json(entry) )
seq counts from 1. prev is the previous entry’s hash, or 64 zeros for entry 1. winners is the number of winners, or null for a single pick or a group drawing. groups appears only on group drawings, and mask (the hidden-names scheme, { scheme }; drawings made before 22 November 2026 also carry their public salt) only on drawings with hidden names. created_at is an ISO 8601 time with milliseconds. op is the operation exactly as the drawing states it, so for a referenced list the entry holds pick@COUNT:FINGERPRINT or shuffle@COUNT:FINGERPRINT, and the log fixes the list through its fingerprint. Changing, removing or reordering any entry breaks every hash after it. If bitsig withholds an entry’s text (see removal), the log keeps its number, round, times and hashes.
7. bitsig’s signatures
Signed records carry bitsig = { alg: "Ed25519", key, sig }. sig is an Ed25519 signature, base64url without padding, over canonical_json(record without bitsig):
- objects: keys sorted by UTF-16 code unit order (the same as code point order for these keys), members with no value omitted;
- no whitespace; strings and numbers as
JSON.stringifywrites them; UTF-8 bytes.
key is a key id. Public keys, current and retired, are at /key; the id is the first 16 hex characters of SHA-256 of the raw 32-byte public key.
8. What a check shows
A recomputed result shows that it follows, by this method, from a genuine drand round and the stated seed. bitsig’s signature shows what bitsig published and when. Neither shows that an organizer made only one drawing: an organizer log does, provided the organizer announced the log in advance. Neither shows that an entry list is complete or fair to entrants; entrants can check that they are on it. An instant result uses a round that is already public, so whoever asked for it could have asked again.
9. Test vectors
/test-vectors.json covers the beacon check (round 1000, valid, and the same signature failing for round 1001), round timing, the first three stream blocks, every operation including a rejected word, drawings with winners and groups, a referenced list of 20,000 items (entry-000001 to entry-020000: its size, fingerprint, first and last items, and the results of a pick and of a three-winner shuffle), a daily seed, two linked organizer entries, and a real signed record with the exact bytes that were signed.