Solidity has this wonderful way to quickly get the interface id from an interface. Suppose I have the interface

interface undernose {
    function overmouth() external;

then solidity (at least in version 0.8.0 and above) has this wonderful function type(...).interfaceId, which can be applied to our interface bytes4 id = type(undernose).interfaceId to yield id = 0x963ca2ef.

Is there a convenient way in ethers js to achieve the same thing. Or maybe hardhat has some sort of abstraction that does it?

1 Answer 1


I made a simple app with the objective of making this easier, https://interfaceid.lucasgrasso.com.ar/ , you just have to paste the interface ABI, hope its useful!

  • Doesn't seem to be working. Dec 7, 2022 at 14:37
  • @stevyhacker, fixed it. It was failing because of the change in Heroku pricing plans. Sorry for the inconvenience.
    – LucasG
    Dec 8, 2022 at 16:13

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.