Solidity get interface id and ERC165

To get interface id, use


Remember interfaceId = xor of all selectors (methods) name and param type, don't care to return type

For example:

  • Return zero with empty interface
=> bytes4: 0x00000000// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Centralize control with Shared VPC

How to Create a Writing Portfolio When You Have Zero Experience

Java Functional Programming — Part 3

Agile HR Management: How to Get Started

A Guide for Javascript to Go

Advantages of Content Management System (CMS) in Technical Writing

What fuels the “Girl on Fire” LED wearable dress?

Responsive PowerApps with Horizontal and Vertical Layout container

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nhan Cao

Nhan Cao

More from Medium

Solidity Smart Contract Convention X

Gas estimation and large strings in the Ethereum virtual machine feat. Remix and Klaytn

Testing a Smart Contract with HardHat 👷‍♂️

How to Send Ethereum Transactions Using Web3