How a draw works, exactly
Every step, every formula, and a worked example you can recompute.
-
1
Read
Every public comment and reply on the post is read. The count read is shown next to the count Instagram reports; the difference is comments Instagram hides from everyone.
-
2
Apply rules and lock
The host's rules decide which comments are entries. At the lock, the eligible entries are frozen in the order they were read, written as "id:username" lines, and hashed with SHA-256. The commitment is published: code, hash, count, rules, lock time and round R.
-
3
Wait for the beacon
R is the first drand quicknet round published at least 20 seconds after the lock. Round R is published at genesis + (R - 1) x 3 seconds. Its randomness is SHA-256 of the round's signature.
-
4
Seed, shuffle, publish
seed = HMAC-SHA256(key = randomness, message = list hash | draw code | draw number on the post). The seed drives a Fisher-Yates shuffle; the first different people are the winners, the next the backups. The draw goes on the post ledger.
The formulas
entries_hash = SHA-256( "id1:user1\nid2:user2\n...\nidN:userN" ) # UTF-8, no trailing newline
R = first round with genesis + (R - 1) * 3 >= locked_at + 20
genesis = 1692803367, chain = 52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971
randomness = SHA-256( signature of round R ) # 32 bytes
message = ASCII( entries_hash_hex + "|" + draw_code + "|" + draw_number )
seed = hex( HMAC-SHA256( key = randomness bytes, message ) ) # 64 hex characters
block[i] = HMAC-SHA256( key = ASCII(seed), message = uint64_be(i) ), i = 0, 1, 2, ...
words = each block split into four 64-bit big-endian words, top bit cleared
below(n) = next word w with w < (2^63-1) - ((2^63-1) mod n), then w mod n
shuffle = for i = N-1 down to 1: j = below(i + 1); swap(list[i], list[j])
winners = walk the shuffled list, skipping anyone already picked (and anyone
who failed a follow check); first W are winners, next B are backups
A worked example
Six eligible entries, locked as draw 1 on a post with code k7m2p9qx4t, two winners and one backup. Suppose the lock happened at 2023-08-23 15:59:03 UTC; the first quicknet round at least 20 seconds later is round 1000, published at 2023-08-23 15:59:24 UTC.
locked list (entries.txt):
101:ana.bakes
102:ben_runs
103:carla.art
104:dev.k
105:ema_photo
106:farid.m
entries_hash = 9f82471de3670f3e26b8634e5b9eddf5f90666eb7db77962967c82afa380fe90
signature = b44679b9a59af2ec876b1a6b1ad52ea9b1615fc3982b19576350f93447cb1125e342b73a8dd2bacbe47e4b6b63ed5e39
randomness = fe290beca10872ef2fb164d2aa4442de4566183ec51c56ff3cd603d930e54fdd
message = 9f82471de3670f3e26b8634e5b9eddf5f90666eb7db77962967c82afa380fe90|k7m2p9qx4t|1
seed = 3997cd12fe71aea7e7e8fd844be9892a9907fcd134f6117517c1fea246f05d37
winners = @ben_runs, @dev.k
backup = @ema_photoRound 1000 is real: fetch https://api.drand.sh/52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971/public/1000 and you get the same signature and randomness. These numbers are computed by the same code that runs every draw.
Between the lock and the reveal
Nothing about the list or the rules can change. A host who made a mistake can withdraw the lock until 5 seconds before the round is published; the withdrawal is listed on the post ledger, and the next lock gets the next draw number and a later round. If the drand relays do not answer, the draw waits and retries with the same round. It is never drawn with any other randomness.
Questions
Where does the randomness come from?
From drand, the public randomness beacon run by the League of Entropy. Its "quicknet" chain publishes a new random value every 3 seconds, signed by a threshold of independent operators. PickFaire uses the first round published at least 20 seconds after your entry list is locked.
Can the host redraw until a friend wins?
Every redraw uses a new, later beacon round and is labelled on the results page with the earlier winners. Every draw ever locked on the post is on its public ledger, and the host cannot delete those rows.
Does it read every comment?
Every draw, free or paid, reads every public comment and reply on the post. The draw page and the results page show the number read next to the number Instagram reports.