What is Chainlink VRF and how does it work?

Published at: Aug. 7, 2022

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.

Tags
Related Posts
How to convert your digital art into NFTs and sell it
What is an NFT? NFTs are nonfungible tokens. The adjective “nonfungible” is often used in economics to represent features such as uniqueness and non-interchangeability. In the crypto space, nonfungibility simply indicates that one item cannot be exchanged for another. A “token” as a unit of account is basically a certificate of validity stored on the decentralized blockchain, making digital assets traceable and accessible to everyone. As a result, NFTs are a one-of-a-kind virtual currency that can fall into pretty much any category and usually take the shape of paintings, videos, music, collectible items in video games or any other type …
Adoption / March 26, 2022
How to use Minecraft to understand the Metaverse and Web3
What is the Metaverse? The Metaverse is a term coined by Neal Stephenson in his 1992 science fiction novel Snow Crash to describe a future virtual reality-based online world. Some have gone as far as pronouncing Stephenson’s novel a prediction of the future. Before you agree that it’s some mystical peek into the future and invoke the rules of time travel, let’s first investigate what the Metaverse is through the lens of something much more accessible: Minecraft. But, more on this later. Unlike the internet or even virtual reality as we know it today, the Metaverse would be a fully …
Technology / April 23, 2022
How to store Bitcoin on MetaMask?
MetaMask is a well-known wallet for Ethereum-enabled distributed applications (dApps). But can MetaMask hold Bitcoin (BTC), which remains the largest cryptocurrency? For many crypto investors, Bitcoin is an important part of their portfolio. Besides being an investment asset, Bitcoin can also be used as a payment method. Thanks to wallets such as MetaMask, paying via blockchain technology has become much easier. This Ethereum crypto wallet enables millions of investors to participate in everything the crypto market has to offer. Even though Ether (ETH) is a very popular means of payment, most people buy Bitcoin. Related: How does Bitcoin work and …
Adoption / April 26, 2022
What is a crypto airdrop, and how does it work?
For most crypto investors, there is nothing more important than making a return on their investment. Thanks to the volatility, this can be done quickly or it can be a hugely difficult task. That's why crypto airdrops are an inexpensive way to make additional returns on your portfolio. After all, airdrop tokens are free and never hurt, right? Almost daily there are new crypto airdrops, with some easier to obtain than others. Not every airdrop is equally reliable. Crypto airdrops always seem very lucrative at first, but they can also cause problems. To make sure you can profit from crypto …
Technology / July 14, 2022
What is SolScan and how to use it?
When you are looking for information about certain transactions or tokens on the Solana blockchain, SolScan is the tool to use for this purpose. This tool is trusted by many venture capitalists, such as Solana Ventures and Alameda Research. In addition, there are over 2 million monthly users, totaling over 180 million data requests. Related: What is Solana, and how does it work? Most crypto enthusiasts know Etherscan, the Ethereum blockchain explorer, where you can, for example, find all tokens on the Ethereum blockchain. In addition to Ethereum, there are several blockchain protocols that are experiencing tremendous growth in adoption, …
Technology / July 7, 2022