I have the following code that is deployed using REMIX Injected Web3 into AVALANCHE FUJI TESTNET

import '@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol';
import '@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol';

contract ULotto is VRFConsumerBaseV2{

VRFCoordinatorV2Interface COORDINATOR;

    //values for CHAIN Link Integration
    uint64 s_subscriptionId; 
    address vrfCoordinator = 0x2eD832Ba664535e5886b75D64C46EB9a228C2610;
    bytes32 s_keyHash = 0x354d2f95da55398f44b7cff77da56283d9c6c829a4bdf1bbcaf2ad6a4d081f61;
    uint32 callbackGasLimit = 2000000;
    uint16 requestConfirmations = 3;
    uint32 numWords = 6;
    uint256[] public s_results;

constructor(uint64 subscriptionId) VRFConsumerBaseV2(vrfCoordinator){
        owner = msg.sender;
        lotteryIdCounter = 1;

        COORDINATOR = VRFCoordinatorV2Interface(vrfCoordinator);
        s_subscriptionId = subscriptionId;

function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal override {
        s_results = randomWords;

    function drawNumbers() public onlyOwner returns (uint256 requestId){
        //dragons require logic here

        requestId = COORDINATOR.requestRandomWords(



When I call draw numbers, I can see from testnet.snowtrace.io/ that the callback to my function has error.

enter image description here enter image description here Internal TXNs of supposed callback

Can someone point me in the right direction?

  • 1
    Hey there. Have you remembered to add the address of the contract as a consumer in the VRF subscription console? Jul 19, 2022 at 15:51
  • 1
    Hi Richard, thanks for your comment. Yes, everytime I deploy the contract, I add it as a consumer. I make sure as well that the subscriptionId matches the one on the console
    – momoja
    Jul 20, 2022 at 1:00

2 Answers 2


There are a few things to check with issues like this.

  1. Check that the Contract is a consumer in the VRF Subscription, as Richard Horrocks mentioned above
  2. Double check you supplied the correct subscription ID to the contract
  3. Try running the fulfillRandomWords function to see what the gas requirement is. Often the callbackGasLimit will need to be increased if the logic in the callback is involved.
  • 1
    Hi Richard, thanks for this answer. I can confirm #1 and #2 are correct. How would I run fulfillRandomWords function?
    – momoja
    Jul 20, 2022 at 1:06

To anyone who might view this question in the future.

As a summary, you need to follow the feedback of the 2 Richards who responded.

An important thing to consider is how you process the randomWords. Try to make the contents of fulfillRandomWords() as simple as you can, possibly just saving the uint256[] randomWords. I had loops to process the response on mine and I think that's what was causing the transaction to either out of gas or revert.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.