{"eip":7996,"title":"Contract Feature Detection","description":"Method to publish and detect contract features that lack an ERC-165 interface","authors":["raffy.eth (@adraffy)"],"status":"Draft","type":"Standards Track","category":"ERC","created":"2025-07-07","requires":[165],"discussionsTo":"https://ethereum-magicians.org/t/erc-7996-contract-feature-detection/24975","repo":"ERCs","label":"ERC-7996","officialUrl":"https://eips.ethereum.org/EIPS/eip-7996","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7996.md","url":"https://eips.huatuo.xyz/eip-7996/","tldr":{"en":"Adds supportsFeature(bytes4), an ERC-165 companion that lets contracts advertise capabilities that have no interface of their own, named by reverse domain strings.","ja":"supportsFeature(bytes4) を追加する。ERC-165 の補完として、独自のインターフェースを持たない機能を、逆ドメイン形式の文字列で名付けてコントラクトが公開できるようにする。","ko":"supportsFeature(bytes4)를 추가한다. ERC-165의 보완책으로, 자체 인터페이스가 없는 기능을 컨트랙트가 역방향 도메인 문자열로 이름 붙여 알릴 수 있게 한다.","zh":"新增 supportsFeature(bytes4)，作为 ERC-165 的补充，让合约可以公布那些没有自身接口的能力，能力用反向域名字符串命名。"},"tags":["interface-detection","erc-165","ens","introspection"],"explainers":{"en":{"lang":"en","tldr":"Adds supportsFeature(bytes4), an ERC-165 companion that lets contracts advertise capabilities that have no interface of their own, named by reverse domain strings.","tags":["interface-detection","erc-165","ens","introspection"],"related":[165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7996/","markdown":"## What problem does it solve?\n\n[ERC-165](/eip-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.\n\nENS, which relies heavily on ERC-165 for backwards compatibility, ran into exactly this. ERC-7996 gives such capabilities their own detection method.\n\n## How it works\n\n- A **feature** is any property of a contract that cannot be expressed via ERC-165.\n- Features are named with a reverse domain name, e.g. `eth.ens.resolver.extended.multicall`.\n- The **feature ID** is `bytes4(keccak256(name))`; for that example the spec gives `0x96b62db8`.\n- A contract that publishes features implements:\n\n```solidity\ninterface IERC7996 {\n    function supportsFeature(bytes4 featureId) external view returns (bool);\n}\n```\n\nIts ERC-165 interface ID is `0x582de3e7`.\n\nDetection 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.\n\n## Sample code\n\nPublishing a feature:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ncontract MyResolver {\n    bytes4 constant MULTICALL_FEATURE = bytes4(keccak256(\"eth.ens.resolver.extended.multicall\"));\n\n    function supportsInterface(bytes4 id) external pure returns (bool) {\n        return id == 0x01ffc9a7 /* ERC-165 */ || id == 0x582de3e7 /* ERC-7996 */;\n    }\n\n    function supportsFeature(bytes4 featureId) external pure returns (bool) {\n        return featureId == MULTICALL_FEATURE;\n    }\n}\n```\n\nDetecting it (ethers v6):\n\n```ts\nimport { Contract, id } from \"ethers\";\n\nconst abi = [\n  \"function supportsInterface(bytes4) view returns (bool)\",\n  \"function supportsFeature(bytes4) view returns (bool)\",\n];\nconst c = new Contract(target, abi, provider);\nconst featureId = id(\"eth.ens.resolver.extended.multicall\").slice(0, 10); // bytes4\n\nconst hasFeatures = await c.supportsInterface(\"0x582de3e7\").catch(() =\u003e false);\nconst ok = hasFeatures \u0026\u0026 (await c.supportsFeature(featureId));\n```\n\n## Things to know\n\n- Status is **Draft**.\n- The spec states ENS already implements it.\n- As with ERC-165, returning `true` is a claim, not a guarantee; a contract can lie or be buggy.\n- Use names you control (your own reverse domain) to avoid collisions; a 4-byte ID can still collide in theory.\n- Callers unaware of features see no change in behavior.\n"},"ja":{"lang":"ja","tldr":"supportsFeature(bytes4) を追加する。ERC-165 の補完として、独自のインターフェースを持たない機能を、逆ドメイン形式の文字列で名付けてコントラクトが公開できるようにする。","tags":["interface-detection","erc-165","ens","introspection"],"related":[165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7996/","markdown":"## 何を解決するのか\n\n[ERC-165](/eip-165/) では、呼び出し側が「インターフェース X を実装していますか？」と尋ねられます。X は関数セレクターの XOR です。これは機能が新しい関数を意味する場合にはうまくいきます。しかし、ABI をまったく変えない機能も多くあります。たとえば「このリゾルバーは特定の方式で multicall をサポートする」「このコントラクトはあるエッジケースを処理する」といったものです。現状ではこうした機能を示すために、各プロジェクトが偽の「合成」インターフェース ID を作り出し、ERC-165 の名前空間を汚しています。\n\n後方互換性のために ERC-165 に大きく依存する ENS は、まさにこの問題に直面しました。ERC-7996 は、そのような機能に専用の検出方法を与えます。\n\n## 仕組み\n\n- **機能（feature）** とは、ERC-165 では表現できないコントラクトの性質のことです。\n- 機能には逆ドメイン名で名前を付けます。例: `eth.ens.resolver.extended.multicall`\n- **feature ID** は `bytes4(keccak256(name))` です。この例では仕様上 `0x96b62db8` になります。\n- 機能を公開するコントラクトは次を実装します。\n\n```solidity\ninterface IERC7996 {\n    function supportsFeature(bytes4 featureId) external view returns (bool);\n}\n```\n\nこの ERC-165 インターフェース ID は `0x582de3e7` です。\n\n検出は 2 段階です。まず通常の ERC-165 の手順で `supportsInterface(0x582de3e7)` を確認し、次に `supportsFeature(featureId)` を呼びます。このインターフェースをサポートするコントラクトでも、サポートする機能が 0 個のことがあります。\n\n## サンプルコード\n\n機能を公開する:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ncontract MyResolver {\n    bytes4 constant MULTICALL_FEATURE = bytes4(keccak256(\"eth.ens.resolver.extended.multicall\"));\n\n    function supportsInterface(bytes4 id) external pure returns (bool) {\n        return id == 0x01ffc9a7 /* ERC-165 */ || id == 0x582de3e7 /* ERC-7996 */;\n    }\n\n    function supportsFeature(bytes4 featureId) external pure returns (bool) {\n        return featureId == MULTICALL_FEATURE;\n    }\n}\n```\n\n検出する（ethers v6）:\n\n```ts\nimport { Contract, id } from \"ethers\";\n\nconst abi = [\n  \"function supportsInterface(bytes4) view returns (bool)\",\n  \"function supportsFeature(bytes4) view returns (bool)\",\n];\nconst c = new Contract(target, abi, provider);\nconst featureId = id(\"eth.ens.resolver.extended.multicall\").slice(0, 10); // bytes4\n\nconst hasFeatures = await c.supportsInterface(\"0x582de3e7\").catch(() =\u003e false);\nconst ok = hasFeatures \u0026\u0026 (await c.supportsFeature(featureId));\n```\n\n## 知っておくべきこと\n\n- ステータスは **Draft** です。\n- 仕様によると、ENS はすでにこれを実装しています。\n- ERC-165 と同様、`true` を返すことは主張であって保証ではありません。コントラクトは嘘をつくことも、バグを抱えていることもあります。\n- 衝突を避けるため、自分で管理している名前（自分の逆ドメイン）を使ってください。4 バイトの ID は理論上は衝突し得ます。\n- 機能を意識しない呼び出し側から見て、動作に変化はありません。\n"},"ko":{"lang":"ko","tldr":"supportsFeature(bytes4)를 추가한다. ERC-165의 보완책으로, 자체 인터페이스가 없는 기능을 컨트랙트가 역방향 도메인 문자열로 이름 붙여 알릴 수 있게 한다.","tags":["interface-detection","erc-165","ens","introspection"],"related":[165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7996/","markdown":"## 어떤 문제를 해결하나요?\n\n[ERC-165](/eip-165/)에서는 호출자가 \"인터페이스 X를 구현하고 있나요?\"라고 물을 수 있습니다. X는 함수 셀렉터들의 XOR입니다. 기능이 새 함수를 뜻할 때는 잘 동작합니다. 하지만 ABI를 전혀 바꾸지 않는 기능도 많습니다. 예를 들어 \"이 리졸버는 특정 방식으로 multicall을 지원한다\", \"이 컨트랙트는 특정 엣지 케이스를 처리한다\" 같은 것들입니다. 지금은 이런 기능을 알리려고 프로젝트마다 가짜 \"합성\" 인터페이스 ID를 만들어 ERC-165 네임스페이스를 어지럽히고 있습니다.\n\n하위 호환성을 위해 ERC-165에 크게 의존하는 ENS가 바로 이 문제를 겪었습니다. ERC-7996은 이런 기능에 전용 감지 방법을 제공합니다.\n\n## 어떻게 동작하나요?\n\n- **기능(feature)** 은 ERC-165로 표현할 수 없는 컨트랙트의 모든 속성을 말합니다.\n- 기능은 역방향 도메인 이름으로 이름을 붙입니다. 예: `eth.ens.resolver.extended.multicall`\n- **feature ID**는 `bytes4(keccak256(name))`입니다. 이 예시의 경우 스펙은 `0x96b62db8`을 제시합니다.\n- 기능을 공개하는 컨트랙트는 다음을 구현합니다.\n\n```solidity\ninterface IERC7996 {\n    function supportsFeature(bytes4 featureId) external view returns (bool);\n}\n```\n\n이 ERC-165 인터페이스 ID는 `0x582de3e7`입니다.\n\n감지는 두 단계입니다. 먼저 일반적인 ERC-165 절차로 `supportsInterface(0x582de3e7)`을 확인하고, 그다음 `supportsFeature(featureId)`를 호출합니다. 이 인터페이스를 지원하는 컨트랙트도 지원하는 기능이 0개일 수 있습니다.\n\n## 샘플 코드\n\n기능 공개하기:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ncontract MyResolver {\n    bytes4 constant MULTICALL_FEATURE = bytes4(keccak256(\"eth.ens.resolver.extended.multicall\"));\n\n    function supportsInterface(bytes4 id) external pure returns (bool) {\n        return id == 0x01ffc9a7 /* ERC-165 */ || id == 0x582de3e7 /* ERC-7996 */;\n    }\n\n    function supportsFeature(bytes4 featureId) external pure returns (bool) {\n        return featureId == MULTICALL_FEATURE;\n    }\n}\n```\n\n감지하기(ethers v6):\n\n```ts\nimport { Contract, id } from \"ethers\";\n\nconst abi = [\n  \"function supportsInterface(bytes4) view returns (bool)\",\n  \"function supportsFeature(bytes4) view returns (bool)\",\n];\nconst c = new Contract(target, abi, provider);\nconst featureId = id(\"eth.ens.resolver.extended.multicall\").slice(0, 10); // bytes4\n\nconst hasFeatures = await c.supportsInterface(\"0x582de3e7\").catch(() =\u003e false);\nconst ok = hasFeatures \u0026\u0026 (await c.supportsFeature(featureId));\n```\n\n## 알아둘 점\n\n- 상태는 **Draft**입니다.\n- 스펙에 따르면 ENS는 이미 이를 구현했습니다.\n- ERC-165와 마찬가지로 `true`를 반환하는 것은 주장일 뿐 보장이 아닙니다. 컨트랙트는 거짓말을 하거나 버그가 있을 수 있습니다.\n- 충돌을 피하려면 직접 관리하는 이름(자신의 역방향 도메인)을 사용하세요. 4바이트 ID는 이론상 여전히 충돌할 수 있습니다.\n- 기능을 모르는 호출자에게는 동작 변화가 없습니다.\n"},"zh":{"lang":"zh","tldr":"新增 supportsFeature(bytes4)，作为 ERC-165 的补充，让合约可以公布那些没有自身接口的能力，能力用反向域名字符串命名。","tags":["interface-detection","erc-165","ens","introspection"],"related":[165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7996/","markdown":"## 它解决什么问题？\n\n[ERC-165](/eip-165/) 允许调用者询问“你是否实现了接口 X？”，其中 X 是函数选择器的异或值。当某项能力意味着新增函数时，这很有效。但许多能力根本不改变 ABI：例如“这个解析器以某种特定方式支持 multicall”“这个合约处理某种边界情况”。为了表示这些能力，目前各项目会自造虚假的“合成”接口 ID，污染了 ERC-165 的命名空间。\n\n高度依赖 ERC-165 来保持向后兼容的 ENS 正好遇到了这个问题。ERC-7996 为这类能力提供了专门的检测方法。\n\n## 它如何运作\n\n- **特性（feature）** 指合约中无法通过 ERC-165 表达的任何属性。\n- 特性用反向域名命名，例如 `eth.ens.resolver.extended.multicall`。\n- **特性 ID** 为 `bytes4(keccak256(name))`；对于这个例子，规范给出的值是 `0x96b62db8`。\n- 公布特性的合约需实现：\n\n```solidity\ninterface IERC7996 {\n    function supportsFeature(bytes4 featureId) external view returns (bool);\n}\n```\n\n其 ERC-165 接口 ID 为 `0x582de3e7`。\n\n检测分两步：先按常规 ERC-165 流程检查 `supportsInterface(0x582de3e7)`，再调用 `supportsFeature(featureId)`。支持该接口的合约仍可能支持零个特性。\n\n## 示例代码\n\n公布一个特性：\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ncontract MyResolver {\n    bytes4 constant MULTICALL_FEATURE = bytes4(keccak256(\"eth.ens.resolver.extended.multicall\"));\n\n    function supportsInterface(bytes4 id) external pure returns (bool) {\n        return id == 0x01ffc9a7 /* ERC-165 */ || id == 0x582de3e7 /* ERC-7996 */;\n    }\n\n    function supportsFeature(bytes4 featureId) external pure returns (bool) {\n        return featureId == MULTICALL_FEATURE;\n    }\n}\n```\n\n检测它（ethers v6）：\n\n```ts\nimport { Contract, id } from \"ethers\";\n\nconst abi = [\n  \"function supportsInterface(bytes4) view returns (bool)\",\n  \"function supportsFeature(bytes4) view returns (bool)\",\n];\nconst c = new Contract(target, abi, provider);\nconst featureId = id(\"eth.ens.resolver.extended.multicall\").slice(0, 10); // bytes4\n\nconst hasFeatures = await c.supportsInterface(\"0x582de3e7\").catch(() =\u003e false);\nconst ok = hasFeatures \u0026\u0026 (await c.supportsFeature(featureId));\n```\n\n## 需要注意\n\n- 状态为 **Draft**。\n- 规范指出 ENS 已经实现了它。\n- 与 ERC-165 一样，返回 `true` 只是一种声明，而非保证；合约可能说谎，也可能有 bug。\n- 请使用你自己控制的名称（你自己的反向域名）以避免冲突；4 字节的 ID 理论上仍可能发生碰撞。\n- 不了解特性的调用者不会看到任何行为变化。\n"}}}
