Verifiable Random Functions
VRF provides cryptographic guarantees:- Uniqueness: Input → Unique output
- Pseudorandomness: Output indistinguishable from random
- Verifiability: Proof allows anyone to verify correctness
Plackett-Luce Sampling
The full finishing order is produced by sequential weighted sampling without replacement, using only integer arithmetic so it is deterministic and verifiable on-chain.Algorithm
Let the (already permuted) winning weights be in basis points, with . Starting from the full set , fill finishing positions in order:Proof of Correctness
This is an exact sampler for the Plackett-Luce distribution. The first horse is drawn with probability proportional to its weight: Conditioned on the horses already placed, each subsequent horse is drawn proportionally to the remaining weights, so the full finishing order has probability: QED: the marginal winning probability of each horse is exactly , and higher-weight horses are more likely both to win and to place.Fisher-Yates Shuffle
Algorithm
Properties
- Uniform: All permutations equally likely
- Deterministic: Same seed → same permutation
- Verifiable: Anyone can recompute
Jackpot Trigger Uniformity
Hash-Based Derivation
Uniformity Proof
SHA256 output is uniformly distributed over . For modulo reduction: Bias for (negligible) QED: Trigger probability is exactly 1/nLiveness and Genesis
Oracle Liveness
If no valid VRF proof arrives within a timeout after entries close, the protocol re-requests randomness and the race stays pending — resolution is simply late. The per-attempt timeout is deliberately long (minutes, not seconds): each new request draws a fresh seed, so rapid retries would let an adversary capable of briefly censoring fulfillment transactions suppress unfavorable outcomes and “re-roll” the race. A slow retry cadence makes such censorship impractically expensive.Permanent Oracle Failure
Retries continue indefinitely — there is no in-contract cancellation path. If the oracle provider discontinued service entirely, resolution is restored through the protocol’s standard upgrade path: the multi-sig upgrade authority migrates the program to an alternative VRF provider, and pending races then resolve with fresh verifiable randomness. This adds no trust beyond what upgrades already require. The protocol never substitutes a deterministic fallback (blockhash, fixed seed) for missing oracle output: a known fallback seed would make the emergency outcome computable in advance — converting a liveness failure into an integrity failure.Chain Continuity
A pending race consumes nothing: the following race derives its track and permutation from the most recent fulfilled seed, and the randomness chain resumes at the next fulfillment. Track and permutation are public during the entry phase by design, so reusing the latest fulfilled seed for setup leaks no outcome-relevant information — winners and jackpot triggers always come from the fresh seed drawn at each race’s own entry close.Genesis
The first race has no predecessor to inherit a seed from. At initialization, a dedicated VRF request is made before race 1 opens for entries; its output serves as , so even the first track selection and permutation are oracle-derived rather than operator-chosen.Security Assumptions
- VRF Security: Switchboard VRF construction is secure
- SHA256 Collision Resistance: Computationally infeasible
- Discrete Log: Breaking oracle keys infeasible
Next Steps
Verifiable Randomness
User-friendly VRF explanation
Security
Complete security analysis
Smart Contracts
Implementation details
Whitepaper
Full technical whitepaper
