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!
After reading this page:
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 their documentation.
The smart contract that developers need to interact with is located at GelatoVRFConsumerBase.sol
This contract serves as an interface to the Gelato VRF system, allowing other smart contracts to request and receive random numbers.
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.Internally, the system leverages Web3 functions to listen for the emitted RequestedRandomness
event and to fetch the required random number from Drand.
Internally, the system invokes the fulfillRandomness
function in the requesting contract.
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.
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!
After reading this page:
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 their documentation.
The smart contract that developers need to interact with is located at GelatoVRFConsumerBase.sol
This contract serves as an interface to the Gelato VRF system, allowing other smart contracts to request and receive random numbers.
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.Internally, the system leverages Web3 functions to listen for the emitted RequestedRandomness
event and to fetch the required random number from Drand.
Internally, the system invokes the fulfillRandomness
function in the requesting contract.
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.