1. Home
  2. VRF

VRF

What is Chainlink VRF and how does it work?

Using the provably fair and verifiable random number generator provided by Chainlink VRF, smart contracts can access random values without compromising security or usability.

Blockchain technology has spawned many applications over the past few years, the most popular being cryptocurrencies. It has also facilitated the creation of many decentralized, secure and transparent marketplaces in the digital economy. 

Offering far more trust since all transactions are immutably recorded on the blockchain, this technology has been well supplemented by the smart contract feature popularized by Ethereum. Decentralized applications (DApps) based on blockchains like Ethereum are disrupting traditional businesses such as retail banking and are even introducing use cases never deemed possible.

Expanding the capability of smart contracts with oracles

However, for the Ethereum blockchain to support the development of DApps that go beyond merely facilitating transactions, they must interact with the external or off-chain world and integrate the incoming data into smart contracts, which is where blockchain oracle technology comes into play, bolstering smart contracts by linking them with real-world data, events and transactions. Now, many types of third-party services are available, such as inbound, outbound, software and hardware oracles, which are further expanding the number of real-world applications that blockchain protocols can power.

Consensus-based oracle networks such as the Chainlink protocol provide end-to-end decentralization, which is key to securing the entire blockchain ecosystem in which they operate. Additionally, these oracles enhance smart contracts’ performance, functionality and interoperability to offer a higher degree of trust and transparency than on-chain systems.

This transformation will come about through broadening the use of hybrid smart contracts, which fuse blockchains’ special properties with the unique capabilities of off-chain systems such as oracle networks, thereby achieving far greater reach and power than on-chain systems in isolation.

What is Chainlink VRF?

Many DApps in the blockchain gaming and nonfungible token (NFT) space require a tamper-proof and verifiable source for random number generation to provide advanced functionalities such as executing an airdrop, running a lottery or developing chance-based games.

Related: A beginner's guide to the GameFi ecosystem

Chainlink’s Verifiable Random (VRF) function relies on a decentralized oracle network (DON) to enhance existing blockchains by providing verified off-chain data. It can even facilitate the export of blockchain data to systems beyond the blockchain ecosystem. Chainlink VRF provides cryptographically secured randomness by employing a set of Chainlink nodes that relay data to smart contracts while maintaining a classical-consensus mechanism through a committee of these nodes.

Offering random number generation (RNG) for smart contracts, Chainlink VRF helps developers build better experiences by leveraging random outcomes in their blockchain-powered applications. Moreover, the tamper-proof randomness provided by Chainlink VRF cannot be manipulated by any node operator, the user or even a malicious entity since every oracle in the DON has an associated private and public key pair, where the private key is maintained off-chain while the public key is published on-chain.

How does Chainlink VRF work?

A smart contract can utilize Chainlink VRF to obtain a secure and verifiable random number in four simple steps:

Since Chainlink VRF uses two keys to generate a random but unpredictable value that can be verified through proof of correctness, it offers a far more secure and decentralized storage of individual keys for applications with the capability of generalized computation. Overcoming the drawbacks of insecure RNG solutions that rely on off-chain computing, Chainlink VRF’s on-chain cryptographic verification combines on-chain block data that is used as an input to supply unbiased and tamper-proof results that are safe even from compromised oracles in its own network.

As a result of the superior capabilities provided by Chainlink’s on-chain RNG solution, use cases of Chainlink VRF include reliable smart contract applications in the decentralized finance (DeFi) space such as PoolTogether, where it allows for fairly gamified personal savings, and Moonbeam where it provides real-time price data for Polkadot (DOT) developers.

It is also helping to distribute nonfungible tokens (NFTs) in a fair manner as in the case of Polychain Monsters and introducing entropy in on-chain gaming by providing verifiable randomness solutions as in the case of Axie Infinity (AXS). Developed as part of the Chainlink 2.0 ecosystem, Chainlink VRF is providing the computational resources and infrastructure needed for smart contracts to be capable of advanced functionalities. Together with other DONs, it is also facilitating a general-purpose framework that developers can use with complete trust.

Related: Axie Infinity (AXS): A beginner's guide to the gaming metaverse project

What is Chainlink VRF v2?

In tune with its vision of constantly upgrading the features provided through its DONs, Chainlink has introduced Chainlink VRF v2 with several improvements revolving around how developers can fund and request randomness for their smart contracts.

This includes the ability to generate multiple random outputs in a single on-chain transaction, reducing the time needed for a response while also reducing transaction costs or gas fees. It also allows for up to 100 smart contract addresses to fund requests for verifiable randomness from a single LINK subscription balance account, that would be managed by the developer or subscription owner.

Additionally, Chainlink VRF v2 introduces a Subscription Manager application that permits developers to pre-fund multiple randomness requests using a single LINK token balance, doing away with the need to transfer tokens for each request and further reducing the applicable chainlink VRF fees considerably.

In fact, it even lets developers adjust the callback gas limit when their smart contract applications receive verified randomness and allows for more complex logic in the callback request function. While the gas limits are higher than that set in Chainlink VRF, they depend on the underlying blockchain being used and are clearly defined on the VRF Contract addresses page.

The benefits of Chainlink VRF v2 also include a greater customization ability since developers can now define how many block confirmations are needed before a random number is generated and delivered onto the blockchain.

With a range of three to 200 blocks, developers can select the optimum number of block passes before randomness is generated, thereby protecting their applications from block re-organizations while still providing a far lower latency time from request to the final response. With Chainlink VRF v2, developers can now access highly scalable, gas-efficient and configurable on-chain randomness, which can unlock even greater functionalities for NFT and gaming DApps.

As a result of the constant introduction of improvements by Chainlink, its VRF application is emerging as the de facto choice for most developers building DApps on the Ethereum network. Delivering on the promise of facilitating the introduction of provably secure blockchain-based applications, Chainlink VRF is enabling developers to create more practical applications that can interface with real-world data reliably.

With blockchains now being able to connect with external data feeds in a trustless manner, Chainlink VRF represents a major step forward in the blockchain technology space as it grants developers the ability to push the frontiers of the Metaverse as we now know it.

The $1 Trillion Power Couple Reshaping Finance

Chainlink Verifiable Random Function v2 goes live on mainnet

Chainlink VRF v1 had previously crossed 3 million request transactions from NFT projects and blockchain games.

On Wednesday, blockchain oracle solution Chainlink (LINK) announced the release of Chainlink Verifiable Random Function, or VRF, v2. As told by its developers, the new, improved version of the random number generator can reduce transaction fees by 60% compared to v1. Randomness is a core component of making nonfungible tokens, or NFTs, and gaming applications fair and secure. On their own, blockchains and smart contracts cannot guarantee randomness, but rather require an oracle network to deliver such solutions on-chain.

Since its launch, Chainlink VRF (v1) has become the most widely adopted random number generator solution in the blockchain industry, fulfilling more than 3 million request transactions and currently providing verifiable randomness to more than 2,200 unique smart contracts across multiple blockchain networks. Popular projects like Bored Ape Yacht Club, Axie Infinity, Ethercards, and more rely on Chainlink VRF for randomness. "It is only with verifiable, tamper-proof randomness that it becomes possible to securely mint NFTs and their attributes or ensure fair outcomes in blockchain-based games," said Sergey Nazarov, co-founder of Chainlink.

Chainlink VRF generates a random number and cryptographic proof of how that number was determined using a combination of unpredictable block data and an oracle's private key with every new request. The cryptographic proof is then published and verified on the blockchain to prevent vulnerability and exploitation.

In addition to being live on the Ethereum Mainnet, Chainlink Network plans for deployment onto additional blockchains such as Polygon and BNB. Major upgrades in v2 include enhanced subscription management, the ability to adjust gas limits, expanded block confirmations, and being able to request multiple random numbers in a single on-chain transaction.

Aleksander Leonard Larsen, chief operating officer of Axie Infinity, commented:

"Verifiable randomness solutions like Chainlink VRF v2 are essential for developers introducing entropy into on-chain gaming and NFT experiences, empowering them to create fair and tamper-proof play-to-earn games."

The Chainlink Network comprises independent oracle nodes and data providers such as Deutsche Telekom's T-Systems, Swisscom, the Associated Press, and others. According to its developers, the network secured more than $75 billion worth of value across hundreds of applications and a dozen different blockchains at the end of 2021.

The $1 Trillion Power Couple Reshaping Finance

Chainlink onboards an average of 1.4 new partners each day in 2021

Chainlink is onboarding new partners twice as fast in 2021 compared to 2020.

Leading oracle provider, Chainlink, has onboarded partner integrations at a rate of more than 1.4 daily during 2021 so far.

According to the archives of Chainlink’s ecosystem portal, 281 different crypto projects have announced integrations during 2021 so far, with the calendar currently 201 days into the year.

With all time third-party Chainlink integrations currently totaling 650, that means 43% of the project’s partners were onboarded this year. By contrast, roughly 250 partners integrated with Chainlink during all of 2020.

While many of Chainlink’s partners are little-known projects in their nascent stages, some of the crypto sector’s leading players have recently teamed up with the oracle provider, including Huobi’s ECO Chain, the Hedera Governing Council, and Alchemix.

An increasing number of projects are also utilizing Chainlink’s Verifiable Random Function (VRF), which offers decentralized applications a secure and automated solution for generating randomization.

Related: Chainlink integration means metaverse can truly reflect the real world

For example, blockchain-powered game Infinity Skies announced it had teamed up with Chainlink on July 20 to distribute its in-game “loot” in a fair manner.

“Since loot is probabilistic and NFTs hold real value to players, it is imperative that the minting of loot cannot be ‘gamed’,” Infinity Skies stated.

“Chainlink VRF provides the Infinity Skies’ smart-contract responsible for chest opening with direct access to a tamper-proof and auditable random number to determine outcomes when opening chests.”

Crypto developers have come up with a wide array of novel applications for Chainlink’s VRF functionality, with PancakeSwap also integrating VRF for its decentralized lottery application last week. Other projects are using VRF to ensure prizes and rewards are issued in a verifiably fair fashion. 

The $1 Trillion Power Couple Reshaping Finance