EIPs Explained

ERC-7996 · Draft · ERC · 2025-07-07

ERC-7996: Contract Feature Detection

Adds supportsFeature(bytes4), an ERC-165 companion that lets contracts advertise capabilities that have no interface of their own, named by reverse domain strings.

What problem does it solve?

ERC-165 lets a caller ask "do you implement interface X?", where X is the XOR of function selectors. That works when a capability means new functions. But many capabilities don't change the ABI at all: "this resolver supports multicall in a particular way", "this contract handles a certain edge case". To signal those today, projects invent fake "synthetic" interface IDs, polluting the ERC-165 namespace.

ENS, which relies heavily on ERC-165 for backwards compatibility, ran into exactly this. ERC-7996 gives such capabilities their own detection method.

How it works

  • A feature is any property of a contract that cannot be expressed via ERC-165.
  • Features are named with a reverse domain name, e.g. eth.ens.resolver.extended.multicall.
  • The feature ID is bytes4(keccak256(name)); for that example the spec gives 0x96b62db8.
  • A contract that publishes features implements:
interface IERC7996 {
    function supportsFeature(bytes4 featureId) external view returns (bool);
}

Its ERC-165 interface ID is 0x582de3e7.

Detection is two steps: check supportsInterface(0x582de3e7) via the normal ERC-165 procedure, then call supportsFeature(featureId). A contract that supports the interface may still support zero features.

Sample code

Publishing a feature:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract MyResolver {
    bytes4 constant MULTICALL_FEATURE = bytes4(keccak256("eth.ens.resolver.extended.multicall"));

    function supportsInterface(bytes4 id) external pure returns (bool) {
        return id == 0x01ffc9a7 /* ERC-165 */ || id == 0x582de3e7 /* ERC-7996 */;
    }

    function supportsFeature(bytes4 featureId) external pure returns (bool) {
        return featureId == MULTICALL_FEATURE;
    }
}

Detecting it (ethers v6):

import { Contract, id } from "ethers";

const abi = [
  "function supportsInterface(bytes4) view returns (bool)",
  "function supportsFeature(bytes4) view returns (bool)",
];
const c = new Contract(target, abi, provider);
const featureId = id("eth.ens.resolver.extended.multicall").slice(0, 10); // bytes4

const hasFeatures = await c.supportsInterface("0x582de3e7").catch(() => false);
const ok = hasFeatures && (await c.supportsFeature(featureId));

Things to know

  • Status is Draft.
  • The spec states ENS already implements it.
  • As with ERC-165, returning true is a claim, not a guarantee; a contract can lie or be buggy.
  • Use names you control (your own reverse domain) to avoid collisions; a 4-byte ID can still collide in theory.
  • Callers unaware of features see no change in behavior.

#interface-detection #erc-165 #ens #introspection

Details

Authors
raffy.eth (@adraffy)
Status
Draft
Type
Standards Track / ERC
Created
2025-07-07
Requires

Machine-readable: Markdown · JSON