
Onchain randomness
on Abstract 
Request a random number. Get it verified on-chain. Five lines of Solidity. Powered by drand, settled on Abstract L2.
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; } }
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.
Three steps. One callback.
No subscriptions. No VRF proofs to manage. No coordinator setup. Just request and receive.
Request
Call `requestFee()`, then `requestRandomNumberWithTraceId()`. Same request and callback shape you wire into your consumer.
uint256 fee = vrfSystem.requestFee(); vrfSystem.requestRandomNumberWithTraceId{ value: fee }(traceId);
Verify
The relayer fetches a drand beacon round and submits its cryptographic proof on-chain.
Receive
Your contract receives the verified random number via callback. Built-in retries ensure delivery.
function randomNumberCallback( uint256 requestId, uint256 randomNumber ) external { // Use your number }
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
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 } }
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.
// 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.
to integrate
Fast
Sub-30-second fulfillment on Abstract L2. ZK rollup efficiency means lower latency and lower cost.
Predictable pricing
Fixed fee per request. No auctions, no dynamic pricing, no cost surprises.
Retry-safe
Failed callbacks automatically retry up to your configured limit. No manual intervention.
Expiry-protected
Stale requests auto-cancel after your chosen deadline with full fee refund.
Abstract native
Purpose-built for Abstract L2. Leverages ZKsync's architecture for efficient proof verification and low-cost settlement.
Start building with
verifiable randomness
Get your first random number on Abstract in under five minutes. Fixed pricing. No subscriptions. No setup.
