✨What is Chainlink?✨
Chainlink is a modular decentralized oracle network that can deliver accurate data and perform external computation for our decentralized applications.
✨What is Chainlink VRF?✨
Chainlink VRF is a provably fair and verifiably random number generator service that allows for secure and verifiable randomness in smart contracts.
Chainlink VRF allows for more secure and tamper-proof smart contracts, resulting in more reliable and fair results in games and applications requiring randomness.
✨The need for VRF?✨
Many Dapps, especially in the gaming, lottery, and NFT space, require a tamper-proof and verifiable source for random number generation.
In traditional blockchains, randomness is generated through pseudorandom number generators (PRNGs), which are deterministic and can easily be tampered with. This can lead to unfairness in games or other applications that demand true randomness.
Chainlink VRF works by combining block data that is still unknown when the request is made with the Oracle node’s private keys to generate both a random number and its cryptographic proof.
✨What is Chainlink VRF v2?✨
Chainlink VRF v2 is an upgrade to the original VRF service that improves the cost-efficiency and usability of the service.
Chainlink VRF v2 offers two methods for requesting randomness:
1️⃣ Subscription: create a subscription account and authorize multiple consuming contracts to request randomness.
2️⃣ Direct Funding: directly fund individual smart contracts with LINK tokens.
✨VRF random number generation Process✨
It’s a two-transaction process:
1️⃣ The consuming contract submits a VRF request by calling the `requestRandomWords()` function on the VRF Coordinator, and the Coordinator emits an event.
2️⃣ The event is picked up by Chainlink VRF nodes, the nodes will wait for a number of block confirmations and then respond back to the Coordinator with a random number and proof of how it was generated.
✨Closing Thoughts✨
Chainlink VRF produces unbiased randomness with cryptographic proof, making sure the results are tamper-proof.
In addition, Chainlink VRF provides a scalable solution to RNG as it can be used by multiple consuming smart contracts at the same time.
As developers, we can make use of Chainlink VRF in decentralized apps that require random & unbiased outcomes such as a raffle, random NFT distribution, and creating dynamic scenarios in games.