Docs · Reproduce a draw▾

Docs · The draw · Verify

Reproduce a draw

Anyone can re-run a LOOTBOX draw from public data and check they get the same winner. This page explains how.

What you need

InputWhere it comes from
Every snapshot for the dropPublished as JSON on the drop's proof page. Each file's SHA-256 is posted on Solana when it's taken.
The locked ticket list's fingerprintA Solana transaction posted before randomness was requested
The randomnessThe drop's ORAO VRF request account on Solana (64 bytes)

Steps

  1. Check the snapshots. Hash each snapshot file (SHA-256 over its canonical JSON, keys sorted) and confirm it matches the fingerprint posted on Solana at that time.
  2. Rebuild the ticket list. For each wallet, average its balance across the snapshots, then divide by the per-ticket amount and round down. Remove excluded wallets. Sort by wallet address.
  3. Check the lock. Hash the ticket list and confirm it matches the fingerprint posted before the randomness request.
  4. Pick. Run the selection with the VRF's 64 bytes, as below.
  5. Compare. The ticket and wallet you get must match the published winner.

The selection, exactly

total  = sum of all tickets
r      = the 64 VRF bytes, read as a big-endian 512-bit number
limit  = 2^512 - (2^512 mod total)
round  = 0
while r >= limit:
    round += 1
    r = SHA-512(vrf_bytes || round as 2 bytes)   # re-hash, try again
index  = r mod total                              # 0-based
ticket = index + 1                                # the number shown on the live page
winner = the wallet whose ticket range contains ticket

A worked example, computed by the real code

Three wallets hold 100, 300 and 600 tickets (1,000 in total), and the randomness is 64 bytes of 0x07. This page runs the actual selection function while it renders:

Rounds needed1
Winning index583
Winning ticket#584
WinnerWallet C

Any implementation of the steps above must produce the same result.