DRAW How the draw runs
How the draw runs

How the draw runs.

The lottery lives in one swap callback. No backend, no oracle, no operator with a key. Here is the hook, beat by beat — the fee skim, the one-step-behind settlement, the commit-blind hash, and the easing mark.

Why a hook

A hook, not a token tax.

The fee is charged in WETH, on the paired side of the trade — the ETH you are spending. A transfer-tax token can only ever tax itself; it cannot reach across to the ETH leg of a swap. Skimming the counter-currency off a buy is something only a hook standing inside the swap can do. Strip the hook and the fee is not relocated — it is impossible.

BUY · ETH IN $DRAW OUT UNISWAP V4 POOL VAULT HOOK 1%
The draw fee

A flat 1%, off every buy.

On each exact-input buy, the hook skims a flat 1% of the WETH leg in the beforeSwap callback. That is the draw fee. Because it is a percentage, a 0.05 ETH buy and a 50 ETH buy pay the same rate — a bigger buy just feeds a bigger pot. The flat 0.30% LP fee never moves; the only moving part is the prize. The vault is the sum of every draw fee taken since the last win.

beforeSwap fee = 1% of WETH spent vault += fee
One step behind

Your buy draws the buys ahead of it.

The hook does not draw the buy in front of it. It draws the tickets ahead — every ticket whose buy block has already closed. Your buy settles them; the next buy settles you. The draw always runs one step behind the trade that triggers it.

N−2N−1 NN+1 SETTLES →
The commit-blind hash

Your number is sealed after you sign.

A ticket's number is one keccak hash of three things: the hash of that ticket's own buy block, the buyer's address, and the running ticket count. A block's hash is sealed only after it is mined. So when you sign your buy, the number that will judge you does not exist yet — there is nothing to precompute, simulate, or grind.

ticketNumber = keccak256(
  blockhash(buyBlock),
  buyerAddress,
  ticketCount
)

blockhash(buyBlock) — the hash of the block your buy landed in, undefined until after you sign. buyerAddress — your wallet, so no two tickets resolve alike. ticketCount — the draw's running ticket index.

The mark & the ladder

The mark opens strict and only eases.

The ticket number is held against a difficulty mark. Land under it and you hit. The mark opens at a 1 in 8,192 slice. Every 500 draws with no winner, it eases one rung and the slice doubles. Thirteen eases down it covers the whole range — by the 6,500th cold draw, the next ticket wins for certain.

8,1921,024 1281 ODDS · 1 IN n 02,500 5,0006,500 COLD DRAWS THE DRAW OPENS HERE CERTAIN HIT
The payout

The vault clears in the settling transaction.

A hit sends the vault to the wallet that signed that ticket, in the same transaction that settled it — keeping a 1/16 sliver back to seed the next round, so the table is never cold. The mark snaps back to strict, and the draw begins again.

VAULT SEED 1/16 WINNER 15/16 OF THE VAULT
Read the whitepaper for the complete spec — the randomness model, every parameter, and the limits.