Gifts at the door

Weight

Every hour the keeper snapshots $BOX balances from the Transfer index. At 00:00 UTC each holder's weight is the lowest balance of each of the last 24 hourly snapshots, summed, times two if petted. Holders under 100,000 $BOX are left out. Petted $BOX counts as held.

0x3…0xa…0x11…0x18…0x1f…0x26…r = hash(block, root) mod totaleach holder owns a range [lo, hi) as wide as their weight
The random number lands in one holder's range.

Commit and draw

The keeper lays the holders end to end as ranges and commits the Merkle root and the total onchain. The Box sets the draw block five chain blocks later. After it, anyone can call drawGift with the leaf whose range holds r = keccak(blockhash(target), root) mod total. Blocks on this chain last about 0.11 s, so the 256-block window is about 28 s; if nobody draws in time, retarget() sets a new block. The table is published, so anyone can recheck the winner.