Introduction to Chainlink VRF
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.
Why is it hard to get randomness with smart contracts?
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
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.
Migration Warning
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:
Last updated