๐ŸŽฒ VRF

VRFConsumer

Spin the wheel to trigger a request for a random number. Each request costs LINK that is paid using the Direct Funding method. After the request transaction is mined, the VRF Coordinator waits a minimum of requestConfirmations blocks before calling the fulfillRandomWords function on the VRFConsumer contract.

Spin Events
0.0 LINKavailable in VRFConsumer to pay for requests

Loading...

Getting Started

Chainlink VRF provides access to verifiably random numbers on chain. Each request for a random number costs LINK and the reponse is delivered after requestConfirmations number of blocks. The VRFConsumer example uses the Direct Funding method, but you may prefer the Subscription method depending on your use case.

Steps

  1. Set up your contract to inherit VRFV2WrapperConsumerBase
  2. Impliment a function that triggers request for random number by calling the requestRandomness function inhereted from VRFV2WrapperConsumerBase
  3. You must override the fullFillrandomWords function inhereted from VRFV2WrapperConsumerBase

Details

  • The Direct Funding method requires your smart contract hold LINK tokens for payment
  • The fulfillRandomWords function is triggered by the VRF Coordinator contract
  • VRF response time is impacted by requestConfirmations which must be greater than the minimum amount set by the coordinator contract