$ roll.codes --info

Onchain randomness
on Abstract

Request a random number. Get it verified on-chain. Five lines of Solidity. Powered by drand, settled on Abstract L2.

MyGame.sol
contract MyGame is IVRFSystemCallback {
  IVRFSystem vrfSystem;

  // Step 1: Request a verified random number
  function roll() external payable {
    uint256  fee = vrfSystem.requestFee();
    vrfSystem.requestRandomNumberWithTraceId{value: fee}(0);
  }

  // Step 2: Receive the result via callback
  function randomNumberCallback(uint256, uint256 rand) external {
    result = rand % 6 + 1;
  }
}
~5
lines to integrate
<30s
fulfillment time
drand
decentralized beacon
# the-problem

On-chain randomness
shouldn't be this hard

Building on-chain games, NFT mints, or fair selection? Most randomness solutions are complex, expensive, or require trusting a centralized oracle.

Centralized trust

Most solutions depend on a single oracle. One point of failure, one point of trust. Your protocol's fairness hinges on one provider.

Integration complexity

VRF proofs, subscription models, coordinator contracts. Weeks of integration work just to get a single random number on-chain.

Unpredictable costs

Auction-based pricing means costs spike when you need randomness most. Budget for the worst case or risk downtime.

# how-it-works

Three steps. One callback.

No subscriptions. No VRF proofs to manage. No coordinator setup. Just request and receive.

01

Request

Call `requestFee()`, then `requestRandomNumberWithTraceId()`. Same request and callback shape you wire into your consumer.

request.sol
uint256 fee = vrfSystem.requestFee();
vrfSystem.requestRandomNumberWithTraceId{
  value: fee
}(traceId);
02

Verify

The relayer fetches a drand beacon round and submits its cryptographic proof on-chain.

dApp
VRF
drand
03

Receive

Your contract receives the verified random number via callback. Built-in retries ensure delivery.

callback.sol
function randomNumberCallback(
  uint256 requestId,
  uint256 randomNumber
) external {
  // Use your number
}
# integration

Ship randomness
in minutes

Call the request function, implement the callback, and let roll.codes handle delivery.

  • +One interface, one callback
  • +No oracle setup or VRF math
  • +Built-in retries and fixed pricing
GameConsumer.sol
contract GameConsumer is IVRFSystemCallback {
  IVRFSystem public vrfSystem;

  function roll() external payable {
    uint256 fee = vrfSystem.requestFee();
    vrfSystem.requestRandomNumberWithTraceId{
      value: fee
    }(traceId);
  }

  function randomNumberCallback(
    uint256, uint256 randomNumber
  ) external override {
    // Your verified random number is ready
  }
}
18 lines
# features

Built for production

Everything you need to ship verifiable randomness. Nothing you don't.

Verifiable

Every number backed by a drand beacon proof, verified on-chain via BN254 pairing. Public randomness, cryptographic certainty.

on-chain verification
// BN254 pairing check
bool valid = Bn254Pairing.verify(
  proof, publicKey, message
);
require(valid);
// ✓ Proof verified on-chain

Simple

Five lines to request. One callback to implement. No subscription management, no oracle setup.

5lines of Solidity
to integrate

Fast

Sub-30-second fulfillment on Abstract L2. ZK rollup efficiency means lower latency and lower cost.

0s<30s total

Predictable pricing

Fixed fee per request. No auctions, no dynamic pricing, no cost surprises.

fixed fee
per request
none
subscriptions
zero
hidden costs

Retry-safe

Failed callbacks automatically retry up to your configured limit. No manual intervention.

attempt 1 — callback reverted
retrying (1/3)...
fulfilled — requestId #4207

Expiry-protected

Stale requests auto-cancel after your chosen deadline with full fee refund.

expirySeconds:3600
on expire:full refund

Abstract native

Purpose-built for Abstract L2. Leverages ZKsync's architecture for efficient proof verification and low-cost settlement.

chain:Abstract L2
stack:ZKsync
chainId:2741
$ roll.codes init

Start building with
verifiable randomness

Get your first random number on Abstract in under five minutes. Fixed pricing. No subscriptions. No setup.