logoAcademy

Deploy Consumer

Learn how to deploy the CrossChainVRFConsumer contract on any L1 that does not support Chainlink VRF.

Now that the CrossChainVRFWrapper is deployed on a Chainlink-supported L1, it’s time to deploy the CrossChainVRFConsumer contract on the L1 where Chainlink VRF is not supported. This contract will handle requests for random words and interact with the TeleporterMessenger to communicate with the supported L1.

Prerequisites

Make sure you have:

  • The TeleporterMessenger contract address on the unsupported L1.
  • The deployed CrossChainVRFWrapper on the supported L1. ($VRF_WRAPPER)

Deploy the Contract

Use the following command to deploy the CrossChainVRFConsumer contract on your unsupported L1.

forge create --rpc-url <RPC_URL> --private-key <PRIVATE_KEY> src/CrossChainVRFConsumer.sol:CrossChainVRFConsumer --constructor-args <TELEPORTER_MESSENGER_ADDRESS> $VRF_WRAPPER

Replace the following:

  • <RPC_URL>: The RPC URL for the L1.
  • <PRIVATE_KEY>: The private key for the account used to deploy the contract.
  • <TELEPORTER_MESSENGER_ADDRESS>: The address of the TeleporterMessenger contract on your unsupported L1.

After deployment, save the Deployed to address in an environment variable for future use.

export VRF_CONSUMER=<address>

Verify the Deployment

Once the CrossChainVRFConsumer contract is deployed, verify the contract’s address and confirm that it has been successfully deployed on your L1 using a block explorer.

On this page