Skip to content

Randomness Beacon ​

A public random value, published every period seconds (30 by default). There is no request and no fee to read it.

Round r is the VRF output over (r, value of round r − 1). Rounds must be published in order, so the operator can't skip a round it doesn't like or pick between candidates.

Reading it ​

solidity
interface IGenesisBeacon {
    function currentRound() external view returns (uint256);
    function roundTime(uint256 round) external view returns (uint256);
    function getRandomness(uint256 round) external view returns (bytes32); // reverts until published
    function latestRandomness() external view returns (uint256 round, bytes32 randomness);
}

The safe pattern: commit to a future round ​

Randomness that is already public can be front-run. Fix the round before its value exists:

solidity
uint256 public drawRound;

function closeEntries() external {
    drawRound = beacon.currentRound() + 2; // a round that hasn't happened yet
}

function settle() external {
    bytes32 r = beacon.getRandomness(drawRound); // reverts until it's published
    // use r
}

Catch-up behaviour ​

If the operator goes offline, missed rounds are published in order once it comes back. Each is still a unique VRF output, so late publication doesn't give the operator any choice. It only delays the value.

GENESIS · verifiable infrastructure for Elysium