Introduction to Chainlink VRF
Last updated
Last updated
Before diving into Chainlink VRF, it is important to understand why achieving randomness on-chain is very difficult and where VRF plays a part in achieving this.
Blockchains are deterministic meaning that the output of any given input is always the same. This means that generating randomness on-chain is very difficult.
As the output from on-chain randomness is predictable, smart contracts utilising this method of randomness are prone to manipulation. This allows validator nodes or participants to 'game' outcomes by controlling or initiating transactions in their favour, undermining the integrity and fairness of decentralised applications.
Chainlink VRF (Verifiable Random Function) is a provably fair and verifiable random number generator (RNG) that enables smart contracts to access random values without compromising security or usability.
The next exercise uses Chainlink VRF 2.0, however Chainlink VRF 2.5 has since been released which has introduced some minor changes that need to implemented. Please refer the following migration guide for more details on these changes: