VRF Consumer
Last updated
Last updated
This page guides you through an example of consuming randomness from your consumer contract. The example consumer contract on the test network is at the
As you can see in the contract, we must create a variable to store
Subscription ID: you can get this after creating a subscription via our website
VRF Address: you can get the address from
Key Hash: you can get the key hash from
Requirements
Your contract has to inherit
Your contract has to implement a function
To get randomness, you must call the function called requestRandomWords() to the VRF coordinator by sending these parameters:
keyHash: you can get the key hash from
subscriptionId: your subscription id
requestConfirmations: the amount of block to confirm the transaction.
callbackGasLimit: gas limit when VRF node calls your fulfillRandomWords function
numWords: the amount of randomness