{"eip":7785,"title":"Onchain registration of chain identifiers","description":"Derive chain identifiers by hashing their chain name and use ENS to map chain names to these identifiers","authors":["Marco Stronati (@paracetamolo)","Jeff Lau (@jefflau)"],"status":"Draft","type":"Standards Track","category":"ERC","created":"2024-09-26","requires":[2304],"discussionsTo":"https://ethereum-magicians.org/t/on-chain-registration-of-chain-identifiers/21299","repo":"ERCs","label":"ERC-7785","officialUrl":"https://eips.ethereum.org/EIPS/eip-7785","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7785.md","url":"https://eips.huatuo.xyz/eip-7785/","tldr":{"en":"Proposes deriving new chain IDs as a 32-byte hash of the chain's name and registering name-to-ID mappings in ENS, replacing the centrally maintained chain list and preventing spoofed chain names.","ja":"新しいチェーン ID をチェーン名の 32 バイトのハッシュとして導出し、名前と ID の対応を ENS に登録することで、中央管理されているチェーンリストを置き換え、チェーン名のなりすましを防ぐ提案。","ko":"새 체인 ID를 체인 이름의 32바이트 해시로 만들고 이름과 ID의 매핑을 ENS에 등록해, 중앙에서 관리하는 체인 목록을 대체하고 체인 이름 사칭을 막자고 제안한다.","zh":"提议把新的链 ID 定为链名称的 32 字节哈希，并在 ENS 中登记名称到 ID 的映射，以取代集中维护的链列表，防止链名称被冒用。"},"tags":["chain-id","ens","l2","registry","interoperability"],"explainers":{"en":{"lang":"en","tldr":"Proposes deriving new chain IDs as a 32-byte hash of the chain's name and registering name-to-ID mappings in ENS, replacing the centrally maintained chain list and preventing spoofed chain names.","tags":["chain-id","ens","l2","registry","interoperability"],"related":[2304,155,3770,7930],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7785/","markdown":"## What problem does it solve?\n\nEvery EVM chain has a numeric chain ID (mainnet is `1`), used for replay protection since [EIP-155](/eip-155/). The mapping from names to IDs lives in a community-maintained list on GitHub. With the number of L2s growing fast, that list:\n\n- does not scale well, and\n- makes its maintainers a single point of failure.\n\nThe list does one important job: it keeps names and IDs **one-to-one**. Without that, an attacker could register an innocent-looking name such as `my-testnet` pointing at chain ID `1`, trick a user into signing what they think is a testnet transaction, then replay it on mainnet.\n\nERC-7785 aims for censorship-resistant registration, trustless resolution and a unique name-to-ID mapping.\n\n## How it works\n\n**Hash-derived IDs.** New chain IDs grow to 32 bytes and are computed with a cryptographic hash whose input must include the chain name, and may include more. The spec's example for an L2:\n\n```\nchain_id = keccak256(CHAIN_NAME, SETTLEMENT_CHAIN_ID, VERSION, DEPLOYER_CONTRACT_ADDRESS, SALT)\n```\n\nBecause the ID is a digest of the name, nobody can register a different name that maps to an existing ID.\n\n**ENS resolution.** An ENS name resolves to the chain ID using the multichain resolution scheme of [ERC-2304](/eip-2304/), together with the extra inputs needed to recompute it, e.g. `rollup.eth → {version, bridge, chain_id}`. A client verifies by recomputing the hash and checking it matches.\n\n**Legacy IDs.** Existing short IDs cannot be recomputed, so the spec uses a reverse record under `chainid.reverse`: resolve `legacy-rollup.eth → 0x123`, then resolve `0x123` in `chainid.reverse` and check it returns `legacy-rollup`. It sketches a bootstrap in which the Ethereum Foundation seeds `l2.eth` and `chainid.reverse` from the existing lists and hands records over to each rollup.\n\n## Sample code\n\nVerifying a hash-derived chain ID (illustrative; the exact encoding of the hash inputs is not fixed by the spec):\n\n```ts\nimport { solidityPackedKeccak256 } from \"ethers\";\n\n// Record fetched from ENS for \"rollup.eth\"\nconst record = { version: 1n, bridge: \"0x1234...abcd\", chainId: \"0x…32-byte id…\" };\n\nconst expected = solidityPackedKeccak256(\n  [\"string\", \"uint256\", \"uint256\", \"address\"],\n  [\"rollup\", 1n /* settlement chain: mainnet */, record.version, record.bridge],\n);\n\nif (expected.toLowerCase() !== record.chainId.toLowerCase()) {\n  throw new Error(\"chain id does not match name: possible spoofing\");\n}\n```\n\n## Things to know\n\n- **Status: Draft.** The Rationale section is still \"TBD\", and the exact hash input encoding is not yet specified.\n- Hash-derived IDs are much larger than today's short IDs, so wallets and tools that assume small integer chain IDs would need checking before relying on them.\n- Domain squatting on chain names is possible, though the spec notes the GitHub list faces the same issue.\n- Related work on naming chains and addresses: [ERC-3770](/eip-3770/) (chain-specific address prefixes) and [ERC-7930](/eip-7930/) (interoperable addresses).\n- [ERC-2304](/eip-2304/), used for resolution, is itself Stagnant.\n"},"ja":{"lang":"ja","tldr":"新しいチェーン ID をチェーン名の 32 バイトのハッシュとして導出し、名前と ID の対応を ENS に登録することで、中央管理されているチェーンリストを置き換え、チェーン名のなりすましを防ぐ提案。","tags":["chain-id","ens","l2","registry","interoperability"],"related":[2304,155,3770,7930],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7785/","markdown":"## 何を解決するのか\n\nすべての EVM チェーンには数値のチェーン ID があり（メインネットは `1`）、[EIP-155](/eip-155/) 以降、リプレイ保護に使われています。名前から ID への対応は、GitHub 上のコミュニティ管理のリストにあります。L2 の数が急速に増える中、このリストは次の問題を抱えています。\n\n- スケールしにくい\n- 管理者が単一障害点になる\n\nこのリストは、名前と ID を**一対一**に保つという重要な役割を果たしています。それがなければ、攻撃者は `my-testnet` のような無害に見える名前をチェーン ID `1` に向けて登録し、ユーザーをだましてテストネットのトランザクションだと思い込ませて署名させ、それをメインネットでリプレイできてしまいます。\n\nERC-7785 は、検閲耐性のある登録、トラストレスな解決、名前と ID の一意な対応を目指します。\n\n## 仕組み\n\n**ハッシュから導出する ID。** 新しいチェーン ID は 32 バイトに拡張され、チェーン名を必ず入力に含む（それ以外を含めてもよい）暗号学的ハッシュで計算されます。仕様にある L2 の例:\n\n```\nchain_id = keccak256(CHAIN_NAME, SETTLEMENT_CHAIN_ID, VERSION, DEPLOYER_CONTRACT_ADDRESS, SALT)\n```\n\nID は名前のダイジェストなので、既存の ID に対応する別の名前を誰かが登録することはできません。\n\n**ENS による解決。** ENS 名は、[ERC-2304](/eip-2304/) のマルチチェーン解決方式を使って、再計算に必要な追加入力とともにチェーン ID に解決されます。たとえば `rollup.eth → {version, bridge, chain_id}` です。クライアントはハッシュを再計算し、一致することを確認して検証します。\n\n**レガシー ID。** 既存の短い ID は再計算できないため、仕様は `chainid.reverse` 配下の逆引きレコードを使います。`legacy-rollup.eth → 0x123` を解決し、次に `chainid.reverse` で `0x123` を解決して、`legacy-rollup` が返ることを確認します。仕様は、Ethereum Foundation が既存のリストから `l2.eth` と `chainid.reverse` に初期データを登録し、各ロールアップにレコードを引き渡すブートストラップ案も示しています。\n\n## サンプルコード\n\nハッシュから導出したチェーン ID の検証（説明用。ハッシュ入力の正確なエンコードは仕様で固定されていません）:\n\n```ts\nimport { solidityPackedKeccak256 } from \"ethers\";\n\n// Record fetched from ENS for \"rollup.eth\"\nconst record = { version: 1n, bridge: \"0x1234...abcd\", chainId: \"0x…32-byte id…\" };\n\nconst expected = solidityPackedKeccak256(\n  [\"string\", \"uint256\", \"uint256\", \"address\"],\n  [\"rollup\", 1n /* settlement chain: mainnet */, record.version, record.bridge],\n);\n\nif (expected.toLowerCase() !== record.chainId.toLowerCase()) {\n  throw new Error(\"chain id does not match name: possible spoofing\");\n}\n```\n\n## 知っておくべきこと\n\n- **ステータス: Draft。** Rationale セクションはまだ「TBD」で、ハッシュ入力の正確なエンコードも未定です。\n- ハッシュから導出した ID は現在の短い ID よりはるかに大きいため、小さな整数のチェーン ID を前提とするウォレットやツールは、頼る前に確認が必要です。\n- チェーン名のドメインスクワッティングは起こり得ますが、仕様は GitHub のリストも同じ問題を抱えていると指摘しています。\n- チェーンやアドレスの命名に関する関連作業: [ERC-3770](/eip-3770/)（チェーン固有のアドレスプレフィックス）と [ERC-7930](/eip-7930/)（相互運用可能なアドレス）。\n- 解決に使われる [ERC-2304](/eip-2304/) 自体も Stagnant です。\n"},"ko":{"lang":"ko","tldr":"새 체인 ID를 체인 이름의 32바이트 해시로 만들고 이름과 ID의 매핑을 ENS에 등록해, 중앙에서 관리하는 체인 목록을 대체하고 체인 이름 사칭을 막자고 제안한다.","tags":["chain-id","ens","l2","registry","interoperability"],"related":[2304,155,3770,7930],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7785/","markdown":"## 어떤 문제를 해결하나요?\n\n모든 EVM 체인에는 숫자 체인 ID가 있으며(메인넷은 `1`), [EIP-155](/eip-155/) 이후 리플레이 방지에 쓰입니다. 이름에서 ID로의 매핑은 커뮤니티가 관리하는 GitHub 목록에 있습니다. L2 수가 빠르게 늘어나면서 이 목록은 다음과 같은 문제가 있습니다.\n\n- 확장성이 좋지 않고,\n- 관리자가 단일 장애점이 됩니다.\n\n이 목록은 중요한 역할을 하나 합니다. 이름과 ID를 **일대일**로 유지하는 것입니다. 그렇지 않으면 공격자가 `my-testnet`처럼 무해해 보이는 이름을 체인 ID `1`에 연결해 등록하고, 사용자가 테스트넷 트랜잭션이라고 믿게 속여 서명하게 한 뒤, 그것을 메인넷에서 재생할 수 있습니다.\n\nERC-7785는 검열에 저항하는 등록, 신뢰 불필요한 해석, 고유한 이름-ID 매핑을 목표로 합니다.\n\n## 어떻게 동작하나요?\n\n**해시에서 파생된 ID.** 새 체인 ID는 32바이트로 커지며, 입력에 체인 이름을 반드시 포함하고 더 포함해도 되는 암호학적 해시로 계산합니다. 명세가 든 L2 예시는 다음과 같습니다.\n\n```\nchain_id = keccak256(CHAIN_NAME, SETTLEMENT_CHAIN_ID, VERSION, DEPLOYER_CONTRACT_ADDRESS, SALT)\n```\n\nID가 이름의 다이제스트이므로, 누구도 다른 이름을 등록해 기존 ID에 연결할 수 없습니다.\n\n**ENS 해석.** ENS 이름은 [ERC-2304](/eip-2304/)의 멀티체인 해석 방식을 이용해, 다시 계산하는 데 필요한 추가 입력과 함께 체인 ID로 해석됩니다. 예: `rollup.eth → {version, bridge, chain_id}`. 클라이언트는 해시를 다시 계산해 일치하는지 확인하는 방식으로 검증합니다.\n\n**기존 ID.** 기존의 짧은 ID는 다시 계산할 수 없으므로, 명세는 `chainid.reverse` 아래의 역방향 레코드를 사용합니다. `legacy-rollup.eth → 0x123`을 해석한 다음 `chainid.reverse`에서 `0x123`을 해석해 `legacy-rollup`이 반환되는지 확인합니다. 명세는 이더리움 재단이 기존 목록으로 `l2.eth`와 `chainid.reverse`를 초기화한 뒤 각 롤업에 레코드를 넘기는 부트스트랩 방안도 대략 제시합니다.\n\n## 샘플 코드\n\n해시에서 파생된 체인 ID 검증(예시용이며, 해시 입력의 정확한 인코딩은 명세에서 고정되지 않았습니다):\n\n```ts\nimport { solidityPackedKeccak256 } from \"ethers\";\n\n// Record fetched from ENS for \"rollup.eth\"\nconst record = { version: 1n, bridge: \"0x1234...abcd\", chainId: \"0x…32-byte id…\" };\n\nconst expected = solidityPackedKeccak256(\n  [\"string\", \"uint256\", \"uint256\", \"address\"],\n  [\"rollup\", 1n /* settlement chain: mainnet */, record.version, record.bridge],\n);\n\nif (expected.toLowerCase() !== record.chainId.toLowerCase()) {\n  throw new Error(\"chain id does not match name: possible spoofing\");\n}\n```\n\n## 알아둘 점\n\n- **상태: Draft.** Rationale 섹션은 아직 \"TBD\"이고, 해시 입력의 정확한 인코딩도 아직 정해지지 않았습니다.\n- 해시에서 파생된 ID는 현재의 짧은 ID보다 훨씬 크므로, 체인 ID가 작은 정수라고 가정하는 지갑과 도구는 의존하기 전에 확인이 필요합니다.\n- 체인 이름에 대한 도메인 선점이 가능하지만, 명세는 GitHub 목록도 같은 문제를 겪는다고 언급합니다.\n- 체인과 주소의 이름 붙이기에 관한 관련 작업: [ERC-3770](/eip-3770/)(체인별 주소 접두사)과 [ERC-7930](/eip-7930/)(상호 운용 가능한 주소).\n- 해석에 쓰이는 [ERC-2304](/eip-2304/) 자체도 Stagnant입니다.\n"},"zh":{"lang":"zh","tldr":"提议把新的链 ID 定为链名称的 32 字节哈希，并在 ENS 中登记名称到 ID 的映射，以取代集中维护的链列表，防止链名称被冒用。","tags":["chain-id","ens","l2","registry","interoperability"],"related":[2304,155,3770,7930],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7785/","markdown":"## 它解决什么问题？\n\n每条 EVM 链都有一个数字形式的链 ID（主网是 `1`），自 [EIP-155](/eip-155/) 起用于重放保护。名称到 ID 的映射存放在 GitHub 上由社区维护的列表中。随着 L2 数量快速增长，这份列表：\n\n- 扩展性不佳，并且\n- 让维护者成为单点故障。\n\n这份列表承担着一项重要工作：保证名称和 ID **一一对应**。否则，攻击者可以注册一个看似无害的名称（如 `my-testnet`），让它指向链 ID `1`，诱骗用户签署自以为是测试网的交易，再在主网上重放。\n\nERC-7785 的目标是抗审查的注册、无需信任的解析，以及唯一的名称到 ID 映射。\n\n## 它如何运作\n\n**由哈希派生的 ID。** 新的链 ID 扩展到 32 字节，通过加密哈希计算得出，哈希输入必须包含链名称，也可以包含更多内容。规范中针对 L2 的示例：\n\n```\nchain_id = keccak256(CHAIN_NAME, SETTLEMENT_CHAIN_ID, VERSION, DEPLOYER_CONTRACT_ADDRESS, SALT)\n```\n\n因为 ID 是名称的摘要，所以没有人能注册一个不同的名称去对应已有的 ID。\n\n**ENS 解析。** ENS 名称使用 [ERC-2304](/eip-2304/) 的多链解析方案解析出链 ID，同时附带重新计算所需的额外输入，例如 `rollup.eth → {version, bridge, chain_id}`。客户端通过重新计算哈希并检查是否一致来完成验证。\n\n**旧版 ID。** 现有的短 ID 无法重新计算，因此规范使用 `chainid.reverse` 下的反向记录：先解析 `legacy-rollup.eth → 0x123`，再在 `chainid.reverse` 中解析 `0x123`，检查它返回 `legacy-rollup`。规范还勾勒了一个引导方案：由以太坊基金会根据现有列表初始化 `l2.eth` 和 `chainid.reverse`，然后把记录移交给各个 rollup。\n\n## 示例代码\n\n验证由哈希派生的链 ID（仅作示意；哈希输入的具体编码方式规范中并未固定）：\n\n```ts\nimport { solidityPackedKeccak256 } from \"ethers\";\n\n// Record fetched from ENS for \"rollup.eth\"\nconst record = { version: 1n, bridge: \"0x1234...abcd\", chainId: \"0x…32-byte id…\" };\n\nconst expected = solidityPackedKeccak256(\n  [\"string\", \"uint256\", \"uint256\", \"address\"],\n  [\"rollup\", 1n /* settlement chain: mainnet */, record.version, record.bridge],\n);\n\nif (expected.toLowerCase() !== record.chainId.toLowerCase()) {\n  throw new Error(\"chain id does not match name: possible spoofing\");\n}\n```\n\n## 需要注意\n\n- **状态：Draft。** Rationale 一节仍是\"TBD\"，哈希输入的具体编码方式也尚未确定。\n- 由哈希派生的 ID 比现在的短 ID 大得多，因此假定链 ID 是小整数的钱包和工具，在依赖它之前需要检查。\n- 链名称的域名抢注是可能的，不过规范指出 GitHub 列表同样面临这个问题。\n- 关于链和地址命名的相关工作：[ERC-3770](/eip-3770/)（链专属地址前缀）和 [ERC-7930](/eip-7930/)（可互操作地址）。\n- 用于解析的 [ERC-2304](/eip-2304/) 本身也是 Stagnant 状态。\n"}}}
