The fair draw
Public rules, a dice roll from a Midnight block nobody can know in advance, and a result sealed in the form's contract.
A draw is only fair if nobody can choose the winners or quietly draw again. Mitome's draw has three parts, each one checkable by anyone.
1. Who entered is on Midnight
Every entry is a receipt in the form's contract. The contract stops taking entries at the closing time (closesAt), which is sealed into it when the form is published, so nothing can be added after.
2. The dice roll is a future block
The dice roll is the first Midnight block whose timestamp is at least 60 seconds after closesAt. Its hash didn't exist when entries closed, so nobody could know it in advance, Mitome included.
seed = SHA-256("mitome:draw" ‖ contract address ‖ block hash)
ticket = SHA-256(seed ‖ entry) for each entry (its 32-byte nullifier)
winners = the lowest tickets, up to the number of winners (1 to 10,000)The same code (packages/contract/src/draw.ts) runs on Mitome's server and, whenever anyone presses Check it yourself, in their browser on the public entries page. Receipts show the result and link there to check it.
3. The result is sealed in the contract
fingerprint = key(SHA-256("mitome:draw-result" ‖ block hash ‖ winner count ‖ winners, sorted))
# winner count: the number set, 4 bytes big-endian; winners: 32-byte nullifiers, sorted by valueA team member's browser signs the fingerprint with the workspace key (the owner key whose public half is in the contract) and calls the contract's recordDraw(fingerprint, signature). The contract checks:
| Check | So that |
|---|---|
| The owner key signed it | Only the form's owner can seal a result |
| The form has a closing time, and it has passed | Nobody seals a draw while people can still enter |
drawn is still empty, and the fingerprint isn't zero | It happens once: a second draw is refused |
After that the contract's drawn field holds the fingerprint for good.
Rerunning it
On the public entries page, Check it yourself → Run the check reads the block, the receipts and the sealed fingerprint from Midnight and reruns the rules in the browser: the right block, the same number of entries as receipts, the same winners from those receipts, the same fingerprint. See Fair draws for what people see.
What the seal needs
Mitome's server works out the winners as soon as the block exists, but only the owner's key can seal them. That happens when someone on the team opens the form's Responses tab (or presses Seal on Midnight). Until then, the entries page says it's waiting for the organiser.