Bringing Chainlink VRF to Unsupported L1s (Consumer)
Learn how to request VRF from an unsupported L1 using CrossChainVRFConsumer.
The CrossChainVRFConsumer
contract enables DApps on an unsupported L1 to request random words from Chainlink VRF using a cross-chain communication mechanism. Since Chainlink does not natively support all blockchains, this setup allows developers to access Chainlink's VRF service even on networks that don’t have direct support.
Requesting Random Words
The CrossChainVRFConsumer
contract sends a cross-chain message to the CrossChainVRFWrapper
on a Chainlink-supported L1, requesting random words. This request is sent using TeleporterMessenger
, which handles cross-chain communication.
Processing the Request
Once the request is received by the CrossChainVRFWrapper
, it interacts with the Chainlink VRF Coordinator to request the random words on behalf of the consumer on the unsupported L1.
Receiving Random Words
Once Chainlink fulfills the request, the CrossChainVRFWrapper
sends the random words back to the CrossChainVRFConsumer
via a cross-chain message, enabling the DApp on the unsupported L1 to use them.