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.Sequential Chain
Races are strictly sequential by design: race is created only when race resolves, in the same transaction as its resolution. A race awaiting resolution therefore pauses the schedule rather than being skipped — no race is ever bypassed, and every race inherits its track selection and permutation from the seed of the race immediately before it, with no exceptions or special cases. Liveness is preserved by the retry path above, which is permissionless: anyone can trigger resolution, and anyone can re-request randomness after a timeout — so a delay is always recoverable and bounded only by oracle availability, never by a privileged operator.Genesis
The first race has no predecessor to inherit a seed from. Its track selection and permutation derive from a fixed, public zero seed () — a constant in the open-source program, verifiable by anyone and chosen by no one. This grants no advantage: a race’s track and permutation are public during its entry phase by design and carry no information about its outcome, and race 1’s winners and jackpot triggers come from its own fresh seed, drawn at its entry close exactly like every other race’s.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
