Chainlink VRF v2 Is Now Live on Mainnet, Providing Highly Scalable, Configurable, and Gas-Efficient On-Chain Randomness for NFT and Gaming dApps

Over the past year, Chainlink Verifiable Random Function (VRF) has become the industry standard random number generator (RNG) solution for smart contracts and off-chain systems that require a cryptographically secure, transparent, and provably fair source of randomness. 

Since its launch, Chainlink VRF has fulfilled more than three million request transactions and currently provides verifiable randomness to over 2,300 unique smart contracts across multiple blockchain networks, including Ethereum, Polygon, and Binance Smart Chain. Using an advanced cryptographic commitment scheme, Chainlink VRF supplies dApps with tamper-proof on-chain randomness to help secure NFT minting and attribution, generate fair outcomes in blockchain-based games, and enable a wide range of use cases across DeFi, DAO governance, and beyond. 

After extensive research and feedback from users, we are proud to announce the release of Chainlink VRF v2, a new and improved version of the widely used RNG solution. Chainlink VRF v2 offers smart contract developers an even better randomness solution, providing them with an easier way to configure and scale randomness requests while reducing request transaction costs by up to 60%. Chainlink VRF v2 also represents an initial push toward creating a more self-service model for building, accessing, and managing Chainlink decentralized services.

Chainlink VRF v2 is already live on Ethereum mainnet (developer documentation), with plans for deployment onto additional leading blockchains already supported or soon to be supported by Chainlink in the future. These deployments enable a wide variety of new on-chain gaming, NFT, and off-chain applications that are fair, secure, and exciting for users. In this blog post, we will explore the major improvements introduced in the VRF v2 release and provide example use cases made possible by verifiable randomness.

Five Major Benefits of Chainlink VRF v2

1. Pay-As-You-Go At Scale: Cost-Efficient Randomness Requests

Chainlink VRF v2 introduces a subscription management app that allows smart contract applications to pre-fund multiple requests for randomness using a single LINK token balance. This improvement helps reduce gas fees for VRF requests by up to 60% by eliminating the need to transfer LINK tokens for each individual request. 

Upon the fulfillment of verifiable randomness on Ethereum, the amount of ETH needed to pay for the response transaction’s gas fee is calculated, converted to LINK using a Chainlink Price Feed for the LINK/ETH exchange rate, and charged to the subscription contract along with a flat per-request fee. As a result, users only need to transfer LINK tokens once to fill up their subscription balance, reducing friction and costs, especially for high-frequency applications.

Chainlink VRF v2 subscription management app.
The subscription management app enables pre-funding of VRF v2 requests.

2. Variable Callback Gas Limit: More Flexibility in the Hands of Developers

Chainlink VRF v2 offers users the ability to adjust the callback gas limit when verifiable randomness is delivered to their smart contract application. This enables consuming contracts to execute more complex logic in the same transaction that they receive verifiable randomness. As a result, critical tasks involving randomness can be executed even during extreme blockchain network congestion, leading to more reliability and flexibility for dApp developers.  

This parameter can be set to a maximum of 2M gas, which is 10x higher than the VRF v1 limit. This functionality is made possible through the pre-funded subscription model, where the amount of LINK charged per randomness call can scale with the amount of gas consumed during delivery. The parameters will vary based on the underlying blockchain that Chainlink VRF is being used on.

3. Configurability: More User Control in Defining Security Parameters

Chainlink VRF v2 offers users the ability to define how many block confirmations must pass after a request transaction is made before verifiable randomness is generated and delivered on-chain—ranging from a 3-block minimum to a 200-block maximum across all testnets and mainnets. In VRF v1, this was fixed at 10 blocks on Ethereum. 

A configurable block confirmation parameter offers development teams the ability to strike their desired balance between security (protection from block re-organizations) and performance (latency from request to response) to match their own application’s specific needs. For more information on how to safely set this parameter, refer to the Security Considerations documentation.

4. More Randomness Per Request: Multiple Random Outputs in a Single Request

Chainlink VRF v2 uses an improved VRF Coordinator contract to give users a seamless and low-cost way to request multiple random numbers (multi-word) through just a single on-chain transaction. Additionally, the fulfillment of randomness back on-chain is also delivered with a single transaction, further lowering costs and reducing response latency. 

By batching multiple requests and responses into single transactions, users who need multiple randomized values can achieve significant gas savings. This cost-efficiency gain is particularly advantageous for high-frequency applications on blockchains with higher transaction fees.

5. Unified Billing: Delegate Subscription Balance to Multiple Addresses

Chainlink VRF v2 allows multiple smart contract addresses (up to 100) to fund their requests for verifiable randomness from a single LINK subscription balance managed by the subscription owner. 

This allows developers who manage multiple smart contracts requiring randomness to simplify fund management and reduce gas costs. By making Chainlink VRF cheaper and more customizable, developers can begin building more advanced use cases with a higher degree of cost-efficiency across a variety of leading blockchains.

Shared LINK subscription balance in Chainlink VRF v2.
A single LINK subscription balance can be used for multiple smart contracts.

Common Use Cases Enabled By Chainlink VRF

For inspiration on how to use the new and improved Chainlink VRF in your applications, check out our recent blog, 35+ Blockchain RNG Use Cases Enabled by Chainlink VRF. Below is a brief summary of some of the most popular use cases.

Fair NFT Minting

Creators are increasingly using Chainlink VRF as part of an industry-standard setup for fair NFT mints, particularly for NFTs with numerous attribute and trait combinations and varying levels of rarity. Chainlink VRF helps ensure everyone has an equally fair shot at minting a rare NFT with potentially increased value.

Polychain Monsters use Chainlink VRF to assign traits to its NFTs.
Polychain Monster NFTs each have three characteristics, with various potential traits for each characteristic based on probability and randomness from Chainlink VRF.

Random NFT and Loot Box Drops

Creators and game developers also use Chainlink VRF for NFT drops involving art collections and in-game items. Chainlink VRF is used to determine which NFT a user receives during a drop, helping prevent anyone from being able to influence or tamper with the distribution mechanism.

Axie Infinity used Chainlink VRF to mint provably rare Origin Axie NFTs.
Axie Infinity used Chainlink VRF to mint provably rare Origin Axie NFTs.

Lucky Draws and Community Giveaways

Various raffles, draws, and giveaways use Chainlink VRF to select winners from a set of eligible participants. Chainlink VRF helps bring unprecedented transparency to the winner selection process, something not seen in traditional draws conducted behind closed doors.

A diagram showing how Chainlink VRF powers PoolTogether with verifiable randomness.
PoolTogether uses Chainlink VRF to select random winners of its weekly prize draw.

Player Versus Player (PvP) Battles

Developers are leveraging Chainlink VRF for player matchmaking in games or NFT battle royale contests, as well as to determine the power of critical hits in fighting games. Chainlink VRF helps ensure gameplay is unbiased and tamper-proof, which is critical in play-to-earn games that feature monetary rewards for winners.

A diagram showing Chainlink VRF enables input/output randomness for more competitive and transparent gameplay.
Chainlink VRF enables input/output randomness for more competitive and transparent gameplay.

Queue Ordering

Smart contracts are deploying Chainlink VRF to fairly determine ordering in games, sales, events, or various turn-taking processes where ordering plays a role in outcomes. Chainlink VRF is instrumental in helping ensure that no player gets special access because of their stature or bank balance.

Chainlink VRF brings transparency to previously opaque selection processes.
Chainlink VRF brings transparency to previously opaque selection processes.

Start Building With Chainlink VRF

With Chainlink VRF v2’s significant cost-efficiency and usability improvements, it’s never been easier for developers to build advanced smart contract applications with truly unpredictable outcomes and provably fair gameplay. While we have provided a few examples of what’s possible with verifiable randomness, there are a limitless number of possible use cases that can be explored. 

If you’re a developer and want to quickly get your application connected to Chainlink VRF, visit the developer documentation, try the subscription management app, and join the technical discussion in Discord. If you want to schedule a call to discuss your integration in more depth, reach out to an expert.

We also encourage developers to combine Chainlink VRF v2 with other Chainlink decentralized services in their applications, such as Chainlink Keepers for automating on-chain transactions based on predefined conditions (e.g. starting/ending game rounds at certain times), Chainlink Price Feeds to determine the current value of in-game assets on marketplaces, Chainlink Data Feeds to augment in-game processes based on external events (e.g. the current weather or a sports match outcome influencing NFT art displays), and the upcoming Cross-Chain Interoperability Protocol (CCIP) to move assets across different blockchain metaverses and create cross-chain smart contracts.

We would like to thank all of the VRF v2 beta testers, which include:

Ether.cards, TreasureKey, Mechanized Abstractions, Polyroll, Decentral Games, Aavegotchi, Coin98, PolyWantsACracker, Gains Farm, PoolTogether, Yarloo, BetSwirl, Magic Beasties, Fantasy Arena, Black Eye Galaxy, Crypto Unicorns, JayPigs, Elemon, 0xCord, DigiBudz, BiFrost, PolyFight, DogeVille, MGG, Ridotto, LuckyChip, DexKit, HexTech, InuWars, DestinyDAO