Getting Started with Band VRF
Compatibility Notice
Band VRF is compatible with BandChain v2 Mainnet and is not yet implemented in BandChain v3.
Please ensure you're using BandChain v2 for this module to function as expected.
This guide serves as a quick reference on how to request random data from the Band VRF. For a detailed reference with examples, please refer to the VRF Integration section.
Step 1: Prepare a VRF consumer contract
- Create a VRF consumer contract that can call the
requestRandomData
function on theVRFProvider
contract. - Implement a callback function on the VRF consumer contract, which allows the
VRFProvider
contract to call back and execute some logic against the returned result.
Step 2: Choose a resolving method
There are currently 3 methods for relaying and resolving the VRF request:
- Band's VRF worker solution - We provide both standard and customized solutions for all clients. Please Email Us for more details.
- Manually resolve on CosmoScan - This is an ideal and low cost solution for one-off Band VRF requests. Please refer to this guide for how to resolve manually.
- Implement your own resolver bot - Anyone can implement their own version of resolver bot. An open-source version of Band's VRF worker bot is available at VRFWorkerV1 repository.
Step 3: Request a random value
You are now ready to request a random value from the Band VRF.
A summary of the Band VRF process is outlined below:
- Simply call the request function on you VRF consumer contract that implements the
requestRandomData
function in Step 1, providing aseed
and an optionalmsg.value
. - Depending on the resolving method chosen in Step 2, the request is sent to the BandChain.
- The VRF oracle script on the BandChain forwards the request to a randomly chosen data source, and then retrieves the returned result and the corresponding proof of authenticity.
- Depending on the resolving method chosen in Step 2, the proof is relayed to the
Bridge
contract for verification on the client chain via theVRFProvider
contract. - If the verification succeeds, the result (random value) is returned to the VRF consumer contract via the callback function mentioned in Step 1.