I'm trying to call a function of my contract using ethers.js. If I call the function on a contract deployed on my localhost network I get this error:

  Error: Transaction reverted: function selector was not recognized and there's no fallback function

The error doesn't occur if I switch to a real network.

Since I want to test my contract on my local hardhat network, do you know how to solve this problem?

1 Answer 1


What is your setup for calling the function? Make sure you aren't trying to use the mainnet address to call the contract deployed on your local network, as it will likely have a different address.

  • Thanks for answering. I'm using the right address on the local network.
    – xcsob
    Nov 6, 2022 at 12:57

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.