The error that I am getting when running this is:

Error: Invalid RpcBlockWithTransactions or null

I have a contract called PriceConsumerV3 and it makes a view function call on a contract. I am attempting to use hardhats forking functionality, but whenever I run this script from the forked version, (or even just the regular hardhat runtime environment) I get the error above.

However, when I use the kovan network as defined in my hardhat.config.js which uses an RPC_URL the script deploys and works fine.

async function main() {
    const PriceConsumerV3 = await ethers.getContractFactory("PriceConsumerV3")
    const priceConsumerV3 = await PriceConsumerV3.deploy()
    await priceConsumerV3.deployed()
    console.log("priceConsumerV3 deployed to: ", priceConsumerV3.address)
    ethPrice = await priceConsumerV3.getLatestPrice()
    console.log("Price data for ETH: ", ethPrice.toString())

Any thoughts?

1 Answer 1


So I found out the issue was with kovan. You can currently only fork mainnet.

  • 1
    This will be fixed soon. You can join our discord server to get notified when that release is ready. Commented Jan 29, 2021 at 19:53

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.