Skip to content

Fair Selection ​

Pick winners from a list in a way nobody can rig: raffles, allowlists, juries, airdrops, task assignment.

  1. Create a selection and add entrants. They can be weighted or equal.
  2. Draw. This locks the list and requests a VRF seed.
  3. Read the winners. They're a deterministic function of (entrants, seed), which anyone can recompute.

Contract calls ​

solidity
uint256 id = selection.createSelection("Community raffle", 3, false); // name, winners, weighted
selection.addEntrants(id, accounts, new uint256[](0));                // weights empty when unweighted
selection.draw{value: hypeFee}(id);                                   // or approve GENESIS and send no value
// ...after the VRF callback:
(address[] memory winners, uint256[] memory indices) = selection.getWinners(id);

Only the selection's creator can add entrants or draw. Once draw is called the list is frozen.

How winners are picked ​

ModeAlgorithm
Equal oddsPartial Fisher–Yates shuffle: j = i + keccak(seed, i) mod (n − i)
WeightedSequential draws without replacement, in proportion to remaining weight

The SDK implements the same functions, so a frontend can prove the result to users:

ts
import { computeIndices, computeWeightedIndices } from "@genesis/sdk";
const local = computeIndices(seed, entrantCount, numWinners);

Limits ​

  • Up to 5,000 entrants per selection.
  • Winners are picked by entry, so an address entered twice can win twice.
  • Fees work as for VRF. Holder discounts apply to the organizer.

GENESIS · verifiable infrastructure for Elysium