Live on Somnia MainnetReactivity + Agents

Total requests

…

Since coordinator deploy

Coordinator balance

… SOMI

Pays every request out of pocket

Latest block

…

Chain id 5031

Live demo

Flip a coin. The chain reveals it.

One tx from your wallet, sixteen blocks, heads or tails resolved on-chain by the coordinator. Switch chains in the header to see the same demo on testnet or mainnet.

Live Mainnet demoChain 5031

CoinFlip · a 42-line VRF consumer

Click flip, sign one tx from your wallet, wait 16 blocks, and read heads or tails back on-chain. The coordinator handles the schedule, the reveal, and the callback. No fulfiller sits behind it.

How it works

Four moves. Nothing off-chain in between.

A commit-reveal flow that borrows the Reactivity precompile as the delivery mechanism, so the network itself pays for the callback out of the coordinator's balance.

1
Consumer requests words

Any contract that extends VRFConsumerBaseV2Plus calls requestRandomWords({callbackGasLimit, commitDelayBlocks, numWords, useVerifiableEntropy}). The coordinator records the request under revealBlock = block.number + commitDelayBlocks.

2
Coordinator schedules Reactivity tick

The coordinator schedules a subscription against Somnia's Reactivity precompile for revealBlock. Multiple requests at the same reveal block share one subscription (coalescence).

3
Reveal block fires

At revealBlock, the Reactivity precompile calls coordinator.onEvent(...). Fast mode derives the seed from blockhash(revealBlock-1) directly. Verifiable mode fires a Somnia Agents JSON API Request against api.drand.sh.

4
Callback delivered

Once entropy is resolved (immediately in Fast mode, ~5s later in Verifiable mode), consumer.rawFulfillRandomWords(requestId, words) is called under a try/catch. A reverting consumer surfaces callbackSuccess=false in the event.

Mainnet onlyFast mode is disabled here

The mainnet coordinator was deployed with FAST_MODE_ENABLED = false. Blockhash-only requests revert at request time. Every mainnet request goes through the drand-mixed Verifiable path.

Consumer template

Drop-in shape.

examples/CoinFlip.sol

coordinator = 0x50AAEE5ECE41627F2bc4b64Ad29a4659a5C018cb

import {VRFConsumerBaseV2Plus} from "somnia-vrf/VRFConsumerBaseV2Plus.sol";
import {ISomniaVRFCoordinator} from "somnia-vrf/ISomniaVRFCoordinator.sol";

contract CoinFlip is VRFConsumerBaseV2Plus {
    enum Result { Pending, Heads, Tails }
    mapping(uint256 => Result) public flips;

    constructor(address coordinator) VRFConsumerBaseV2Plus(coordinator) {}

    function flipVerifiable() external returns (uint256 requestId) {
        return COORDINATOR.requestRandomWords(
            ISomniaVRFCoordinator.RandomWordsRequest({
                callbackGasLimit: 100_000,
                commitDelayBlocks: 16,
                numWords: 1,
                useVerifiableEntropy: true
            })
        );
    }

    function fulfillRandomWords(uint256 requestId, uint256[] memory words)
        internal override
    {
        flips[requestId] = words[0] & 1 == 0 ? Result.Heads : Result.Tails;
    }
}
Deployed

Live coordinators on both chains.

Somnia Mainnet
Chain 5031 · SOMIVerifiable-only
Coordinator0x50AAEE5ECE41627F2bc4b64Ad29a4659a5C018cbexplorer ↗
CoinFlip0x0c80964dB885091194F547eaDf95249b74Ba651Dexplorer ↗
Agent platform0x5E5205CF39E766118C01636bED000A54D93163E6explorer ↗
Somnia Testnet
Chain 50312 · STT
Coordinator0x0834459256bbb8d2efee23dc6c3f1722266182ddexplorer ↗
CoinFlip0x9c220e99bf41df220ce54147a0a10a025a151e63explorer ↗
Agent platform0x037Bb9C718F3f7fe5eCBDB0b600D607b52706776explorer ↗
Activity

Every reveal on the active chain.

Last … reveals · Somnia Mainnet

Landed events from CoinFlip

scanning last ~300k blocks…