I'm learning how to use Chain Link VFR to get some random numbers.

I have a Localhost Mainnet Forked by Hardhat and Alchemy.

I'm using the example contract, I can deploy on my localhost normally, I can transfer some LINK to the contract address, I can interact with the contract using some tests:

    const LINK_ADDRESS = "0x514910771AF9Ca656af840dff83E8264EcF986CA"; //Mainnet
    LINK = new ethers.Contract(LINK_ADDRESS, ercAbi, accounts[0]);


  it("Get Random Words", async function () {
    Contract = await (
      await ethers.getContractFactory("VRFGenerator")
    ).attach("0x1D13fF25b10C9a6741DFdce229073bed652197c7"); //The contract address after deploy at Localhost Mainnet Forked

    /* Check Contract LINK Balance */
    const contractLINKBalance = await LINK.balanceOf(Contract.address);
    const contractLINKBalanceNumber = Number(
      ethers.utils.formatUnits(contractLINKBalance, DECIMALS)
    console.log(`Contract LINK Balance: ${contractLINKBalanceNumber} LINK`);
    const lastRequestId = await Contract.lastRequestId();


Contract LINK Balance: 30 LINK
BigNumber { _hex: '0x00', _isBigNumber: true } // I haven't been able to make any requests yet.

but I can't make the request for the numbers.

    await network.provider.send("evm_setIntervalMining", [5000]);

    const requestTX = await Contract.requestRandomWords();
    await requestTX.wait(3); 

It's configured for 3 confirmations, but I've tried with other values, I even tried using the same contract on REMIX.org (the original contract per ChainkLink documentation) but the same erro.

 ProviderError: Error: Transaction reverted without a reason string

I tried a few other things, a few other versions of the contract, I used another example, but I'm running into the same problem, does anyone have any idea what it could be? Thanks.


Your Answer

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

Browse other questions tagged or ask your own question.