Is this possible? I've followed the mainnet forking guide @ https://hardhat.org/hardhat-network/guides/mainnet-forking.html

I'm more than a bit confused about the development environments local fork, even though I'm using alchemy and supposedly forking with a pin at a block where a smart contract should exist, It doesn't seem to exist on my local dev environment.

If someone could provide a straight forward resource to setting up this described environment, I would greatly appreciate it. The hardhat documentation walks through interacting with hardhat deployed contracts, but I'm not sure how to use ethers or web3 to interact with this mainnet fork..

1 Answer 1


Basically it would be like you're running ganache locally, but ganache is actually a copy of the mainnet snapshot at the pinned block you have configured. You could then deploy new contracts to that running instance or connect to already-deployed contracts via their mainnet addresses like:

let contract = new ethers.Contract(contractAddress, abi, provider);

They only way to be sure if mainnet forking was working or not would be to run a script that uses hardhat node and try to connect to a mainnet-forked contract.


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.