Gelato
  • Introduction
    • Gelato, The Web3 Cloud Platform
  • Smart Wallets
    • Introduction
      • Understanding EIP-7702
      • Understanding ERC-4337
      • ERC-4337 vs EIP-7702
    • Templates & Examples
    • How-To Guides
      • Create a Sponsor API Key
      • Sponsor gas for your users
      • Allow users to pay gas with erc20
      • Allow users to pay gas with native
      • Create Dynamic's Environment Id
      • Use Dynamic/Privy signers with React SDK
      • Estimate Gas for your transactions
    • React SDK
    • Demo
    • Supported Networks
  • Rollup As A Service
    • Introduction
    • Rollup Stacks
      • Arbitrum Orbit
        • Run a Full Orbit Node
      • OP Stack
        • Run OP Node
    • Deploy your Rollup
    • Customization
      • Data Availability
        • Celestia
        • Avail
        • Eigen DA
      • Custom Gas Token
      • Marketplace
        • Gelato Services
        • Data Indexers
        • Block Explorers
        • Oracles
        • Bridges
        • Account Abstraction
        • On & Off-ramp
        • Community
        • Identity & KYC
        • Others
      • Verifier Node Package
    • Public Testnet
  • RPC Nodes
    • Introduction
    • Compute Units
    • Using RPC Nodes
    • Supported Networks
    • Pricing and Plans
    • FAQ
  • Web3 Services
    • Web3 Functions
      • Understanding Web3 Functions
        • Trigger Types
        • Typescript Function
        • Solidity Function
        • Automated Transactions
      • Security Considerations
      • Template & Use Cases
      • Quick Start
        • Writing Typescript Functions
          • Event Trigger
          • Private Typescript Functions
          • Callbacks
        • Test, Deploy & Run Typescript functions
        • Writing Solidity Functions
        • Test, Deploy & Run Solidity Functions
        • Initiate an Automated Transaction
      • Create a Web3 Function Task
        • Using the UI
        • Using the Safe App
        • Using a Smart Contract
        • Using the Automate SDK
      • Analytics & Monitoring
      • Supported Networks
      • Subscription & Payments
      • Legacy Automate Migration Guide
    • Relay
      • What is Relaying?
      • Security Considerations
        • ERC-2771 Delegatecall Vulnerability
      • Templates
      • Quick Start
        • Sponsored Calls
        • Non-Sponsored Calls
      • ERC-2771 (recommended)
        • SponsoredCallERC2771
        • CallWithSyncFeeERC2771
          • Relay Context Contracts ERC2771
      • Non-ERC-2771
        • SponsoredCall
        • CallWithSyncFee
          • Relay Context Contracts
      • Relay API
      • Gelato's Fee Oracle
      • Tracking your Relay Request
      • Supported Networks
      • Subscriptions and Payments
        • 1Balance & Relay
        • SyncFee Payment Tokens
        • Relay Pricing
      • ERC2771 Migration Guide
    • VRF
      • Understanding VRF
      • How does Gelato VRF Work?
      • Security Considerations
      • Template
      • Quick Start
      • Create a VRF Task
        • Create a Fallback VRF
        • Migrating from Chainlink VRF
      • Supported Networks
      • Pricing & Rate Limits
    • Oracles
      • Understanding Gelato Oracles
      • Quick Start
      • Data Providers
        • Stork
        • Choas Labs
      • Migrating from Chainlink Oracles
      • Available Price Feeds
      • Supported Networks
      • Pricing & Rate Limits
    • Account Abstraction
      • Understanding ERC-4337
      • Introduction to Gelato Bundler
      • Templates & Examples
      • Quick Start
      • Supported Networks
      • Bundler API Endpoints
        • eth_sendUserOperation
        • eth_estimateUserOperationGas
        • eth_getUserOperationByHash
        • eth_getUserOperationReceipt
        • eth_supportedEntryPoints
        • eth_maxPriorityFeePerGas
        • eth_chainId
    • 1Balance
      • 1Balance Alerts
      • Subscription Plans
      • Subscription Notifications
      • USDC Addresses
    • AI Agents
    • Teams
  • GELATO DAO
    • DAO & Token (GEL)
    • GEL Token Contracts
    • Governance Process
  • Social Media
Powered by GitBook
On this page
  • Core Component
  • Top level Flow
  • 1. Contract Deployment
  • 2. Requesting Randomness
  • 3. Processing the Randomness Request
  • 4. Delivering Randomness
  1. Web3 Services
  2. VRF

How does Gelato VRF Work?

Gelato VRF (Verifiable Random Function) provides a unique system offering trustable randomness on EVM-compatible blockchains. But what's the magic behind this reliable randomness? Let's see!

PreviousUnderstanding VRFNextSecurity Considerations

Last updated 11 months ago

After reading this page:

  • You'll be able to understand the core components of Gelato VRF.

  • You'll understand how you can initiate a randomness request.

  • You'll be able to navigate the randomness delivery.

  • You'll understand how to integrate and utilize Gelato VRF.

Core Component

Drand: This is the heart of the randomness. Drand is a decentralized randomness beacon, ensuring the unpredictability and unbiased nature of the random numbers provided. To learn more about Drand and how it works, please refer to .

Top level Flow

 +------------------------+
 | 1. Contract Deployment |
 +------------------------+
          |
          v
 +-----------------------+
 | 2. Requesting         |
 |    Randomness         |
 +-----------------------+
          |
          v
 +-----------------------+
 | 3. Processing the     |
 |     randomness        |
 |       event           |
 +-----------------------+
          |
          v
 +-----------------------+
 | 4. Randomness Delivery|
 +-----------------------+

1. Contract Deployment

This contract serves as an interface to the Gelato VRF system, allowing other smart contracts to request and receive random numbers.

2. Requesting Randomness

Inside the GelatoVRFConsumer contract, there's an event named RequestedRandomness. When a randomness request is made, this event is emitted.

The RequestedRandomness event serves as a beacon, signaling the Gelato VRF system about the need for a random number. It contains 2 parameters:

  • round explicitly signifies which Drand round is targeted to fulfill the randomness,

  • data offers versatility for developers, it can be used to attach any supplementary information or context about the randomness request.

event RequestedRandomness(uint256 round, bytes data);

3. Processing the Randomness Request

4. Delivering Randomness

Composable Callback with Arbitary Data

Internally, the system invokes the fulfillRandomness function in the requesting contract.

Callback Invocation and Data Decoding

The random number (sourced from Drand) is passed as the randomness parameter to the function. Additionally, the data parameter can carry any supplementary data provided during the original request or by the Gelato VRF.

The smart contract that developers need to interact with is located at

Internally, the system leverages to listen for the emitted RequestedRandomness event and to fetch the required random number from Drand.

their documentation
GelatoVRFConsumerBase.sol
Web3 functions