Why an oracle
open_ticket is permissionless, so the account that signs a ticket can be the one that receives its payout. Block-derived randomness is then unsafe: that signer can simulate a transaction and only submit the ones that win, and a block producer knows its own block hash with certainty. A verifiable random function (VRF) served by an oracle is the arrangement both sides can accept. Every Fade draw uses one.
The VRF provider
Today the VRF is provided by ORAO VRF. This is the only page that names the provider: the rest of these docs say “the VRF”, and the account names below are the ones the program requires. ORAO is a push oracle: once a request exists, its authorities write the fulfilment, each contributing an Ed25519 signature over the seed, stored publicly. On mainnet the quorum is 3 of 3 authorities. What an integrator needs:
The request account’s rent. ORAO returns part of the request account’s rent at fulfilment; the rest stays locked, as ORAO has no close instruction. The request therefore stays readable after settlement (see Verify a draw yourself).
The fee. The request fee and the treasury are read from the oracle’s on-chain network state at request time, never set by Fade: 500 000 lamports on mainnet at the time of writing, 300 000 on devnet.
open_ticket prefunds twice the fee (see Fees). The quickstart derives every account above.
Request after entropy
The VRF’s key holders can compute the outcome of any seed before it is requested, because Ed25519 signatures are deterministic. If the seed were known when the ticket opened, a key holder colluding with whoever opens tickets could open only the tickets that win. Fade closes this by deriving the seed from entropy that does not exist yet when the ticket opens:1
Open at slot t
open_ticket admits the ticket and stores the payout table. No oracle call is made.2
Request from t + 2
request_randomness (permissionless, from t + 2 until t + T_SETTLE) takes s*, the smallest slot in SlotHashes greater than t (skipped slots are simply absent), and its hash h*, and derives:t and s* as little-endian u64. The ticket’s vrf_payer PDA pays the VRF to create the request for that seed. The seed, s*, h* and the request address are stored in the ticket.3
Fulfil
The VRF’s authorities write a 64-byte random value
R into the request account.4
Settle
settle_ticket checks the request’s address, owner, type, state and seed, and derives the outcome:i is a single byte, starting at 0. Each 32-byte w_i gives two candidate words, bytes 0 to 15 then 16 to 31, each read as a little-endian u128. A word below LIMIT = (2^128 − 1) − ((2^128 − 1) mod 1e9) gives x = word mod 1e9, exactly uniform in [0, 1e9); a word at or above LIMIT is rejected and the next candidate is tried, for at most 8 hashes. A rejection has a probability of about 2.3 × 10⁻³⁰; rejecting all 16 candidates would fail with DrawFailed. The outcome drawn is the first index k with x < p_0 + … + p_k.s* (to grind or skip that block) and whoever opens the ticket. Mixing h* in at settlement instead would not work: if the VRF fulfilled at or before s*, that slot’s leader would already know R.
Settlement never reads SlotHashes, so it has no 512-slot cliff, and it has no deadline: a ticket fulfilled late can still be settled.
A withheld draw
Any single VRF authority can stall a request by not signing. If the randomness is not fulfilled byopen_slot + T_SETTLE (150 slots, about a minute), anyone may call expire_ticket, and the vault keeps the ticket’s vault credit.
That rule is what makes withholding worthless. If an unfulfilled ticket were returned, an app colluding with a key holder could let every losing draw expire and keep every winner: a free option. Under forfeiture, suppressing losing draws and revealing only winners produces exactly the same payoff distribution as honest draws.
Forfeiture does not stop a key holder who also holds vault shares from withholding a winning draw to save the vault the payout. The per-ticket cap bounds each such event, and an isolated expiry among fulfilled requests, which a genuine outage does not produce, is the signature to watch for.
A genuine outage longer than T_SETTLE forfeits every ticket in flight. The guardian pausing new tickets when the oracle stalls bounds how many tickets that reaches.
Recording the entropy, and the one refund
The seed is public from the slot after the open, so anyone may create a ticket’s VRF request directly and read its outcome before the ticket’s own request. The program accounts for it:request_randomness binds a request that already exists at the seed’s address, even after the request window once it is fulfilled, and expire_ticket refuses to forfeit a ticket whose request exists and is fulfilled.
That check needs the seed, and SlotHashes keeps only about 512 recent slots. So the seed is recorded on the ticket from open_slot + 2: by request_randomness itself, or by record_ticket_entropy, which anyone may send without pay and which writes the seed, s* and h* and nothing else. Keepers send it on every ticket.
A ticket never requested and never recorded, once SlotHashes no longer proves s*, can no longer be checked for a request. Forfeiting it would let whoever holds a fulfilled request void every winner, so it is refunded instead: refund_expired_ticket returns its vault credit to the beneficiary (the protocol and app shares are not returned). Every refund, and every expiry a withheld draw may explain, counts in Vault.ticket_forfeits_withheld: a rise in that count is the signal for the guardian to pause new tickets.
Verify a draw yourself
Everything needed is public:- The payout table: in the
open_ticketinstruction data of the open transaction (decode withgetOpenTicketInstructionDataDecoder()), and in the ticket account while it is open. t,s*, the seed and the request: the ticket account while open, or theTicketOpened(open_slot),RandomnessRequested(seed,request,entropy_slot) andTicketEntropyRecordedevents.R: the VRF request account. ORAO has no close instruction, so it remains readable after settlement.- Recompute
w_i, apply the rejection sampling and the cumulative mapping above, and compare the outcome with theoutcomeinTicketSettled.
Limits
- Verifiable odds, not provable fairness. The guarantee rests on ORAO’s authorities not colluding with the leader of
s*and whoever opens the ticket, and on the ORAO program not being maliciously upgraded. A malicious upgrade could write arbitrary randomness after the fact; its upgrade authority is a single key. Verifying the authorities’ Ed25519 signatures over the seed inside the settle transaction is the planned hardening. - One provider. Fade depends on ORAO’s availability. An outage forfeits in-flight tickets as described above.