Requesting Random Values

The deployed contract sends requests for random values to Plugin VRF, acquires those values, constructs a struct RequestStatus, and stores it within mapping s_requests.

  1. Navigate back to Remix and review the available functions of your deployed contract listed under Deployed Contracts.

  2. Execute the requestRandomWords() function on your contract to trigger the request. MetaMask prompts confirmation of the transaction. Upon approval, Plugin VRF processes your request, fulfills it, and returns the random values to your contract via a callback to the fulfillRandomWords() function. Subsequently, a new key requestId is appended to the mapping s_requests.

Given the prevailing conditions of the testnet, anticipate a brief interval before the callback delivers the requested random values to your contract.

Last updated