Skip to main content

Verifiable Random Functions

VRF provides cryptographic guarantees:
  1. Uniqueness: Input → Unique output
  2. Pseudorandomness: Output indistinguishable from random
  3. 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, wiZ0w_i \in \mathbb{Z}_{\geq 0} with i=08wi=10,000\sum_{i=0}^{8} w_i = 10{,}000. Starting from the full set R={0,1,,8}R = \{0, 1, \ldots, 8\}, fill finishing positions k=0,1,,8k = 0, 1, \ldots, 8 in order:
Position 0 is the winner (1st place), position 1 is 2nd, position 2 is 3rd; the same procedure yields the full ordering. If W=0W = 0 at some step (degenerate all-zero weights), the horse is chosen uniformly among those remaining.

Proof of Correctness

This is an exact sampler for the Plackett-Luce distribution. The first horse is drawn with probability proportional to its weight: Pr(i finishes 1st)=wijwj=pi\Pr(i \text{ finishes 1st}) = \frac{w_i}{\sum_j w_j} = p_i Conditioned on the horses already placed, each subsequent horse is drawn proportionally to the remaining weights, so the full finishing order a=(a0,,a8)a = (a_0, \ldots, a_8) has probability: Pr(a)=k=08wakjkwaj\Pr(a) = \prod_{k=0}^{8} \frac{w_{a_k}}{\sum_{j \geq k} w_{a_j}} QED: the marginal winning probability of each horse is exactly pip_i, 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 {0,1}256\{0,1\}^{256}. For modulo reduction: Pr(hash mod n=k)=1n\Pr(\text{hash mod } n = k) = \frac{1}{n} Bias ϵ=n2256<1070\epsilon = \frac{n}{2^{256}} < 10^{-70} for n{125,12500}n \in \{125, 12500\} (negligible) QED: Trigger probability is exactly 1/n

Liveness and Genesis

Oracle Liveness

If no valid VRF proof arrives within a timeout TVRFT_{\text{VRF}} 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 n+1n+1 is created only when race nn 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 (seed0=0x000\text{seed}_0 = 0\text{x}00\ldots0) — 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

  1. VRF Security: Switchboard VRF construction is secure
  2. SHA256 Collision Resistance: Computationally infeasible
  3. Discrete Log: Breaking oracle keys infeasible
All are standard cryptographic assumptions.

Next Steps

Verifiable Randomness

User-friendly VRF explanation

Security

Complete security analysis

Smart Contracts

Implementation details

Whitepaper

Full technical whitepaper