Chain Link
Chain Link is a huge ecosystem that acts as an Oracle for blockchain.
Smart contract can't get any information from off-chain by itself thus required information must be passed to it from off-chain by executing transaction. This is what ChainLink does. One of the data type which they can pass to blockchain is random number. We use it in different mechanics like Mystery Boxes, Lottery and Raffle.
More information about how it works can be found here
Steps to connect ChainLink:
- Go to ChainLink dashboard.
- Create a Subscription.
- Add the Contract as a Consumer to the Subscription
- Fund the Subscription
- Set
subscriptionId
in Contract:- Go to Contracts list, click the
•••
and selectSet VRF subscriptionId
- Choose the appropriate VRF Subscription Id and click
OK
.
- Go to Contracts list, click the