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

Drink Tea with Envoy Proxy

Ruby to Rails Evolution

Govrn White Paper Announcement!

Easy UITests for your iOS app

📢📢 xFarmer will host an AMA with PokeMine on Friday 8pm (UTC+8) on Telegram.

December Development Recap — CTSI Reserve Mining Finishing Touches

Setup your first Gradle project

Must know programming terminologies

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

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

Smart Contract Development with Solidity (4) — Bank

Upgrading smart contracts with Openzeppelin Upgradable Plugin