Create and manage VRF V2.5 subscriptions
Using the VRF Subscription Manager
The private version of the VRF Subscription Manager is available to help you create and manage VRF V2.5 subscriptions. Alternatively, you can create and manage subscriptions programmatically.
Create a subscription
To create a VRF 2.5 subscription:
-
Use the VRF Subscription Manager at vrf.chain.link. Connect your wallet in the upper right corner and then click Create subscription. The address of your connected wallet is automatically filled in the Admin address field.
-
When the subscription is successfully created, there will be an alert in the upper right corner telling you that the subscription was successfully created. Click Home to navigate back to your main dashboard.
-
Your new subscription shows in the My Subscriptions list, along with previous V2 subscriptions you might have. Click the Subscription ID for your new subscription in the list.
Add a consumer
To add a consuming contract:
-
On the details page for your subscription, select Add Consumer.
-
Provide the address of your consuming contract, and then select Add Consumer again. Confirm the resulting prompts in MetaMask or other wallet browser extension.
Fund your subscription
To fund your subscription:
-
On the page for your subscription, select the Actions menu and then select Fund subscription.
-
Your subscription has two balances: one for LINK, and one for the native token. Expand the Asset menu to select either LINK or the native token.
-
In Amount to fund, enter the amount you want to fund your subscription. Your wallet balance is displayed below the Asset field for easier reference. Select Confirm to fund your wallet, and then confirm the resulting prompts in MetaMask or other wallet browser extension.
Create a subscription programmatically
If you prefer to create, fund and manage your subscriptions programmatically, you can either deploy a subscription manager contract or use your network's block explorer:
-
Create a new subscription for VRF v2.5:
Deploy the
SubscriptionManager
contract. On deployment, the contract creates a new subscription and adds itself as a consumer to the new subscription.- Navigate to the VRF coordinator contract on the block explorer for the network you want to use (for example, Etherscan or Polygonscan). You can find the coordinator addresses with links to the block explorers on the Supported Networks page.
- In the Contract tab, select the Write contract tab. Connect your wallet to the block explorer.
- Expand the
createSubscription
function and select the Write button. Follow the prompts in MetaMask to confirm the transaction. - Get your subscription ID for the next step, funding your subscription.
-
Fund your new VRF v2.5 subscription:
- Fund your new
VRFv2PlusSubscriptionManager
contract. - Call
topUpSubscription
from theVRFv2PlusSubscriptionManager
contract. This function uses the LINK token contract'stransferAndCall
function to fund your new subscription.
- Fund your new
VRFv2PlusSubscriptionManager
contract. - Navigate to the LINK token contract on the block explorer for the network you want to use (for example, Etherscan or Polygonscan). You can find the LINK token contract addresses with links to the block explorers on the Supported Networks page.
- In the Contract tab, select the Write contract tab. Connect your wallet to the block explorer.
- Expand the
transferAndCall
function and fill in the following parameters:- to(address): The address of the VRF coordinator.
- value(uint256): The amount you want to fund your subscription with.
- data(bytes): The ABI-encoded subscription ID.
- Select the Write button and follow the prompts in MetaMask to confirm the transaction.
- Fund your new