{"eip":3220,"title":"Crosschain Identifier Specification","description":"A self-verifying unique blockchain identifier that deals with forks.","authors":["Weijia Zhang (@weijia31415)","Peter Robinson (@drinkcoffee)"],"status":"Stagnant","type":"Standards Track","category":"Core","created":"2020-10-21","discussionsTo":"https://ethereum-magicians.org/t/eip-3220-crosschain-id-specification/5446","repo":"EIPs","label":"EIP-3220","officialUrl":"https://eips.ethereum.org/EIPS/eip-3220","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-3220.md","url":"https://eips.huatuo.xyz/eip-3220/","tldr":{"en":"A 32-byte crosschain identifier built from a truncated genesis (or fork) block hash plus chain ID, chain type and a checksum, so chains can be told apart even when they share a chain ID or fork.","ja":"切り詰めたジェネシス（またはフォーク）ブロックハッシュに、チェーン ID、チェーンタイプ、チェックサムを組み合わせた 32 バイトのクロスチェーン識別子。チェーン ID やフォークが同じでも、チェーンを区別できる。","ko":"잘라낸 제네시스(또는 포크) 블록 해시에 체인 ID, 체인 유형, 체크섬을 붙여 만든 32바이트 크로스체인 식별자. 체인 ID나 포크가 같더라도 체인을 구별할 수 있다.","zh":"一个 32 字节的跨链标识符，由截断的创世（或分叉）区块哈希加上链 ID、链类型和校验和构成，因此即使链共享同一个链 ID 或同一次分叉，也能区分开来。"},"tags":["crosschain","interoperability","chain-id","identifier"],"explainers":{"en":{"lang":"en","tldr":"A 32-byte crosschain identifier built from a truncated genesis (or fork) block hash plus chain ID, chain type and a checksum, so chains can be told apart even when they share a chain ID or fork.","tags":["crosschain","interoperability","chain-id","identifier"],"related":[155,2124,1344],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-3220/","markdown":"## What problem does it solve?\n\n[EIP-155](/eip-155/) gave Ethereum chains an integer chain ID to stop transactions being replayed across networks. That number has limits when you work across many heterogeneous chains:\n\n- it is just a number, so two unrelated chains can pick the same one,\n- it relies on a public registry rather than anything verifiable from the chain itself,\n- after a contentious fork, both sides may keep the same ID,\n- many non-Ethereum chains have no chain ID concept at all.\n\nThe Enterprise Ethereum Alliance's Crosschain Interoperability Task Force wanted an identifier that is unique, self-verifying against the chain's own data, and carries a little descriptive metadata. EIP-3220 proposes one.\n\n## How it works\n\nThe crosschain ID is 32 bytes, laid out as:\n\n| Field | Bytes | Meaning |\n| --- | --- | --- |\n| Truncated block hash | 16 | The 16 least-significant bytes of the genesis block hash, or of the block just before a fork for a forked chain |\n| Native chain ID | 8 | The chain ID used when signing transactions; `0` if the chain has none |\n| Chain type | 2 | `0x00` undefined, `0x01` mainnet, `0x1[0-A]` testnet, `0x2[0-A]` private dev network |\n| Governance identifier | 2 | Optional \"owner\" of a new chain, to help settle fork disputes; `0` for existing chains |\n| Reserved | 3 | All zero for now |\n| Checksum | 1 | Least-significant byte of SHA-256 over the other 31 bytes |\n\nBecause the first field comes from a real block hash, anyone with access to the chain can check that an ID really belongs to it. If it matches neither the genesis hash nor a known fork-point hash, the ID cannot be verified and a crosschain application should reject it. The checksum only catches typing mistakes (1 in 256 false positive).\n\nThe EIP also mentions a registration and lookup service for chain metadata but does not specify it.\n\n## Sample code\n\nBuilding and checking an ID (TypeScript, ethers v6 helpers; illustrative, field encoding as described above):\n\n```ts\nimport { concat, dataSlice, sha256, toBeHex, zeroPadValue } from \"ethers\";\n\nfunction crosschainId(blockHash: string, chainId: bigint, chainType: number, gov = 0): string {\n  const body = concat([\n    dataSlice(blockHash, 16, 32),     // 16 least-significant bytes\n    toBeHex(chainId, 8),              // native chain ID\n    toBeHex(chainType, 2),            // e.g. 0x0001 = mainnet\n    toBeHex(gov, 2),                  // governance identifier\n    \"0x000000\",                       // reserved\n  ]);\n  const checksum = dataSlice(sha256(body), 31, 32); // least-significant byte\n  return concat([body, checksum]);\n}\n\nfunction checksumOk(id: string): boolean {\n  return dataSlice(sha256(dataSlice(id, 0, 31)), 31, 32) === dataSlice(id, 31, 32);\n}\n```\n\n## Things to know\n\n- **Status: Stagnant.** It never became a finalized standard; Ethereum tooling identifies chains by EIP-155 chain IDs.\n- The crosschain ID is not signed into transactions. Its replay protection relies on applications checking it against block hashes.\n- The spec says the field is the \"block hash immediately prior to the fork\", but does not define which fork-point to use when a chain forks multiple times.\n- For peer-to-peer detection of which fork a node is on, Ethereum uses the fork identifier from [EIP-2124](/eip-2124/), which also hashes the genesis block together with fork block numbers.\n"},"ja":{"lang":"ja","tldr":"切り詰めたジェネシス（またはフォーク）ブロックハッシュに、チェーン ID、チェーンタイプ、チェックサムを組み合わせた 32 バイトのクロスチェーン識別子。チェーン ID やフォークが同じでも、チェーンを区別できる。","tags":["crosschain","interoperability","chain-id","identifier"],"related":[155,2124,1344],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-3220/","markdown":"## 何を解決するのか\n\n[EIP-155](/eip-155/) は、ネットワーク間でトランザクションがリプレイされるのを防ぐために、Ethereum チェーンに整数のチェーン ID を与えました。この数値は、多種多様なチェーンをまたいで扱う場面で限界があります。\n\n- ただの数値なので、無関係な 2 つのチェーンが同じ値を選ぶことがあります。\n- チェーン自体から検証できるものではなく、公開レジストリに頼っています。\n- 論争を呼ぶフォークのあと、両側が同じ ID を維持することがあります。\n- Ethereum 以外の多くのチェーンには、チェーン ID という概念自体がありません。\n\nEnterprise Ethereum Alliance の Crosschain Interoperability Task Force は、一意で、チェーン自身のデータに照らして自己検証でき、少しの説明的なメタデータを持つ識別子を求めていました。EIP-3220 はそれを提案します。\n\n## 仕組み\n\nクロスチェーン ID は 32 バイトで、次のように配置されます。\n\n| フィールド | バイト数 | 意味 |\n| --- | --- | --- |\n| 切り詰めたブロックハッシュ | 16 | ジェネシスブロックハッシュ（フォークしたチェーンではフォーク直前のブロックのハッシュ）の下位 16 バイト |\n| ネイティブのチェーン ID | 8 | トランザクション署名に使うチェーン ID。チェーンに無ければ `0` |\n| チェーンタイプ | 2 | `0x00` 未定義、`0x01` メインネット、`0x1[0-A]` テストネット、`0x2[0-A]` プライベート開発ネットワーク |\n| ガバナンス識別子 | 2 | 新しいチェーンの任意の「オーナー」。フォーク紛争の解決を助ける。既存のチェーンでは `0` |\n| 予約 | 3 | 現時点ではすべてゼロ |\n| チェックサム | 1 | 残りの 31 バイトに対する SHA-256 の下位 1 バイト |\n\n最初のフィールドは実際のブロックハッシュに由来するため、チェーンにアクセスできる人なら誰でも、ID が本当にそのチェーンのものかを確認できます。ジェネシスハッシュにも既知のフォーク地点のハッシュにも一致しなければ、その ID は検証できず、クロスチェーンアプリケーションは拒否すべきです。チェックサムが検出できるのは入力ミスだけです（偽陽性は 256 分の 1）。\n\nこの EIP は、チェーンのメタデータの登録・検索サービスにも触れていますが、その仕様は定めていません。\n\n## サンプルコード\n\nID の構築と検証（TypeScript、ethers v6 のヘルパー。説明用で、フィールドのエンコードは上記のとおり）:\n\n```ts\nimport { concat, dataSlice, sha256, toBeHex, zeroPadValue } from \"ethers\";\n\nfunction crosschainId(blockHash: string, chainId: bigint, chainType: number, gov = 0): string {\n  const body = concat([\n    dataSlice(blockHash, 16, 32),     // 16 least-significant bytes\n    toBeHex(chainId, 8),              // native chain ID\n    toBeHex(chainType, 2),            // e.g. 0x0001 = mainnet\n    toBeHex(gov, 2),                  // governance identifier\n    \"0x000000\",                       // reserved\n  ]);\n  const checksum = dataSlice(sha256(body), 31, 32); // least-significant byte\n  return concat([body, checksum]);\n}\n\nfunction checksumOk(id: string): boolean {\n  return dataSlice(sha256(dataSlice(id, 0, 31)), 31, 32) === dataSlice(id, 31, 32);\n}\n```\n\n## 知っておくべきこと\n\n- **ステータス: Stagnant（停滞）。** 確定した標準にはなりませんでした。Ethereum のツールは、EIP-155 のチェーン ID でチェーンを識別します。\n- クロスチェーン ID はトランザクションには署名されません。そのリプレイ保護は、アプリケーションがブロックハッシュと照合することに依存します。\n- 仕様ではこのフィールドを「フォーク直前のブロックハッシュ」としていますが、チェーンが複数回フォークした場合にどのフォーク地点を使うかは定めていません。\n- ノードがどのフォークにいるかをピアツーピアで検出するために、Ethereum は [EIP-2124](/eip-2124/) のフォーク識別子を使います。これもジェネシスブロックとフォークのブロック番号をまとめてハッシュします。\n"},"ko":{"lang":"ko","tldr":"잘라낸 제네시스(또는 포크) 블록 해시에 체인 ID, 체인 유형, 체크섬을 붙여 만든 32바이트 크로스체인 식별자. 체인 ID나 포크가 같더라도 체인을 구별할 수 있다.","tags":["crosschain","interoperability","chain-id","identifier"],"related":[155,2124,1344],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-3220/","markdown":"## 어떤 문제를 해결하나요?\n\n[EIP-155](/eip-155/)는 네트워크 사이에서 트랜잭션이 재전송되는 것을 막기 위해 이더리움 체인에 정수 체인 ID를 부여했습니다. 이 숫자는 이질적인 여러 체인에 걸쳐 작업할 때 한계가 있습니다.\n\n- 그저 숫자이므로 서로 무관한 두 체인이 같은 값을 고를 수 있습니다.\n- 체인 자체에서 검증할 수 있는 것이 아니라 공개 레지스트리에 의존합니다.\n- 논쟁이 된 포크 이후 양쪽이 같은 ID를 유지할 수 있습니다.\n- 이더리움이 아닌 많은 체인에는 체인 ID라는 개념 자체가 없습니다.\n\nEnterprise Ethereum Alliance의 Crosschain Interoperability Task Force는 고유하고, 체인 자체 데이터와 대조해 스스로 검증할 수 있으며, 약간의 설명용 메타데이터를 담은 식별자를 원했습니다. EIP-3220이 이를 제안합니다.\n\n## 어떻게 동작하나요?\n\n크로스체인 ID는 32바이트이며 다음과 같이 구성됩니다.\n\n| 필드 | 바이트 | 의미 |\n| --- | --- | --- |\n| 잘라낸 블록 해시 | 16 | 제네시스 블록 해시의 하위 16바이트(포크된 체인은 포크 직전 블록의 해시) |\n| 네이티브 체인 ID | 8 | 트랜잭션 서명에 쓰는 체인 ID. 체인에 없으면 `0` |\n| 체인 유형 | 2 | `0x00` 미정의, `0x01` 메인넷, `0x1[0-A]` 테스트넷, `0x2[0-A]` 프라이빗 개발 네트워크 |\n| 거버넌스 식별자 | 2 | 새 체인의 선택적 \"소유자\"로, 포크 분쟁을 해결하는 데 도움. 기존 체인은 `0` |\n| 예약 | 3 | 현재는 모두 0 |\n| 체크섬 | 1 | 나머지 31바이트에 대한 SHA-256의 최하위 바이트 |\n\n첫 번째 필드가 실제 블록 해시에서 오므로, 체인에 접근할 수 있는 사람이라면 누구나 ID가 정말 그 체인의 것인지 확인할 수 있습니다. 제네시스 해시나 알려진 포크 지점 해시와 일치하지 않으면 ID를 검증할 수 없으며, 크로스체인 애플리케이션은 이를 거부해야 합니다. 체크섬은 오타만 잡아냅니다(오탐 확률 256분의 1).\n\n이 EIP는 체인 메타데이터의 등록·조회 서비스도 언급하지만 그 명세는 정하지 않습니다.\n\n## 샘플 코드\n\nID 만들기와 확인(TypeScript, ethers v6 헬퍼. 설명용이며 필드 인코딩은 위 설명과 같음):\n\n```ts\nimport { concat, dataSlice, sha256, toBeHex, zeroPadValue } from \"ethers\";\n\nfunction crosschainId(blockHash: string, chainId: bigint, chainType: number, gov = 0): string {\n  const body = concat([\n    dataSlice(blockHash, 16, 32),     // 16 least-significant bytes\n    toBeHex(chainId, 8),              // native chain ID\n    toBeHex(chainType, 2),            // e.g. 0x0001 = mainnet\n    toBeHex(gov, 2),                  // governance identifier\n    \"0x000000\",                       // reserved\n  ]);\n  const checksum = dataSlice(sha256(body), 31, 32); // least-significant byte\n  return concat([body, checksum]);\n}\n\nfunction checksumOk(id: string): boolean {\n  return dataSlice(sha256(dataSlice(id, 0, 31)), 31, 32) === dataSlice(id, 31, 32);\n}\n```\n\n## 알아둘 점\n\n- **상태: Stagnant(정체).** 확정된 표준이 된 적이 없으며, 이더리움 도구는 EIP-155 체인 ID로 체인을 식별합니다.\n- 크로스체인 ID는 트랜잭션에 서명으로 포함되지 않습니다. 재전송 방지는 애플리케이션이 블록 해시와 대조해 확인하는 데 의존합니다.\n- 명세는 이 필드를 \"포크 직전의 블록 해시\"라고 하지만, 체인이 여러 번 포크했을 때 어느 포크 지점을 쓸지는 정하지 않습니다.\n- 노드가 어느 포크에 있는지 피어 투 피어로 감지하기 위해 이더리움은 [EIP-2124](/eip-2124/)의 포크 식별자를 사용하며, 이것도 제네시스 블록과 포크 블록 번호를 함께 해시합니다.\n"},"zh":{"lang":"zh","tldr":"一个 32 字节的跨链标识符，由截断的创世（或分叉）区块哈希加上链 ID、链类型和校验和构成，因此即使链共享同一个链 ID 或同一次分叉，也能区分开来。","tags":["crosschain","interoperability","chain-id","identifier"],"related":[155,2124,1344],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-3220/","markdown":"## 它解决什么问题？\n\n[EIP-155](/eip-155/) 为以太坊链提供了整数链 ID，以防止交易在不同网络间被重放。当你跨多种异构链工作时，这个数字有其局限：\n\n- 它只是一个数字，所以两条互不相关的链可能选了同一个，\n- 它依赖公开的注册表，而不是任何能从链本身验证的东西，\n- 在有争议的分叉之后，双方可能保留相同的 ID，\n- 许多非以太坊链根本没有链 ID 的概念。\n\n企业以太坊联盟（Enterprise Ethereum Alliance）的跨链互操作性工作组希望有一种标识符：唯一、可对照链自身数据自我验证，并携带少量描述性元数据。EIP-3220 提出了这样一种方案。\n\n## 它如何运作\n\n跨链 ID 为 32 字节，布局如下：\n\n| 字段 | 字节数 | 含义 |\n| --- | --- | --- |\n| 截断的区块哈希 | 16 | 创世区块哈希的最低 16 字节；对于分叉出来的链，则取分叉前一个区块的哈希 |\n| 原生链 ID | 8 | 签署交易时使用的链 ID；如果链没有则为 `0` |\n| 链类型 | 2 | `0x00` 未定义，`0x01` 主网，`0x1[0-A]` 测试网，`0x2[0-A]` 私有开发网络 |\n| 治理标识符 | 2 | 新链可选的\"所有者\"，用于帮助解决分叉争议；已有的链为 `0` |\n| 保留 | 3 | 目前全为零 |\n| 校验和 | 1 | 其余 31 个字节的 SHA-256 的最低字节 |\n\n由于第一个字段来自真实的区块哈希，任何能访问该链的人都可以检查某个 ID 是否真的属于它。如果它既不匹配创世哈希，也不匹配已知的分叉点哈希，这个 ID 就无法验证，跨链应用应当拒绝它。校验和只能发现输入错误（误报率为 256 分之一）。\n\n该 EIP 还提到了一个链元数据的注册和查询服务，但没有对其进行规定。\n\n## 示例代码\n\n构建并检查 ID（TypeScript，ethers v6 辅助函数；示意性质，字段编码如上所述）：\n\n```ts\nimport { concat, dataSlice, sha256, toBeHex, zeroPadValue } from \"ethers\";\n\nfunction crosschainId(blockHash: string, chainId: bigint, chainType: number, gov = 0): string {\n  const body = concat([\n    dataSlice(blockHash, 16, 32),     // 16 least-significant bytes\n    toBeHex(chainId, 8),              // native chain ID\n    toBeHex(chainType, 2),            // e.g. 0x0001 = mainnet\n    toBeHex(gov, 2),                  // governance identifier\n    \"0x000000\",                       // reserved\n  ]);\n  const checksum = dataSlice(sha256(body), 31, 32); // least-significant byte\n  return concat([body, checksum]);\n}\n\nfunction checksumOk(id: string): boolean {\n  return dataSlice(sha256(dataSlice(id, 0, 31)), 31, 32) === dataSlice(id, 31, 32);\n}\n```\n\n## 需要注意\n\n- **状态：Stagnant（停滞）。** 它从未成为最终确定的标准；以太坊工具通过 EIP-155 链 ID 识别链。\n- 跨链 ID 不会签入交易。它的重放保护依赖于应用对照区块哈希进行检查。\n- 规范称该字段是\"分叉前紧邻的区块哈希\"，但没有定义当链多次分叉时应使用哪个分叉点。\n- 对于点对点地检测节点处于哪个分叉，以太坊使用 [EIP-2124](/eip-2124/) 中的分叉标识符，它同样会把创世区块和分叉区块号一起哈希。\n"}}}
