{"eip":2481,"title":"eth/66 request identifier","description":"Introduces a request id for all requests of the eth protocol","authors":["Christoph Burgdorf (@cburgdorf)"],"status":"Final","type":"Standards Track","category":"Networking","created":"2020-01-17","requires":[2464],"discussionsTo":"https://ethereum-magicians.org/t/eip-2481-eth-66-request-identifiers/12132","repo":"EIPs","label":"EIP-2481","officialUrl":"https://eips.ethereum.org/EIPS/eip-2481","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2481.md","url":"https://eips.huatuo.xyz/eip-2481/","tldr":{"en":"Introduced the eth/66 wire protocol, which wraps every request and response in the `eth` p2p protocol with a 64-bit request ID so nodes can match replies to requests directly.","ja":"eth/66 ワイヤープロトコルを導入した。`eth` p2p プロトコルのすべてのリクエストとレスポンスに 64 ビットのリクエスト ID を付け、ノードが返信をリクエストと直接対応付けられるようにする。","ko":"eth/66 와이어 프로토콜을 도입했다. `eth` p2p 프로토콜의 모든 요청과 응답에 64비트 요청 ID를 붙여, 노드가 응답을 요청과 바로 대응시킬 수 있게 한다.","zh":"引入了 eth/66 网络协议：为 `eth` p2p 协议中的每个请求和响应都附上 64 位请求 ID，使节点可以直接把回复与请求对应起来。"},"tags":["networking","devp2p","eth-protocol","p2p","client"],"explainers":{"en":{"lang":"en","tldr":"Introduced the eth/66 wire protocol, which wraps every request and response in the `eth` p2p protocol with a 64-bit request ID so nodes can match replies to requests directly.","tags":["networking","devp2p","eth-protocol","p2p","client"],"related":[2464,2976],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-2481/","markdown":"## What problem does it solve?\n\nEthereum nodes talk to each other over the devp2p `eth` sub-protocol. Many messages come in request/response pairs: `GetBlockHeaders` → `BlockHeaders`, `GetReceipts` → `Receipts`, and so on.\n\nBefore eth/66 those messages carried no identifier. A node that sent several `GetBlockHeaders` requests to the same peer could not be sure which response belonged to which request, because replies may arrive out of order. Clients had to compare each response against all pending requests by its contents, which is complex and ambiguous, especially for empty responses. The light-client protocol `les` already had request IDs; `eth` did not.\n\n## How it works\n\neth/66 changes the shape of every request/response message in the same way:\n\n1. Create a two-element list.\n2. The first element is `request_id`, a 64-bit integer chosen by the requester.\n3. The second element is the original message body, unchanged.\n\nThe responder copies the `request_id` from the request into its response. Affected messages are `GetBlockHeaders`/`BlockHeaders`, `GetBlockBodies`/`BlockBodies`, `GetPooledTransactions`/`PooledTransactions`, `GetNodeData`/`NodeData` and `GetReceipts`/`Receipts`.\n\nRequest IDs:\n\n- do not have to be sequential (random is fine), which avoids collisions after reconnects;\n- may repeat, so a simple client could even use one constant ID;\n- are 64-bit to match `les`.\n\nBecause devp2p can run several versions of a sub-protocol side by side, eth/66 rolled out without a hard fork; peers that had not upgraded kept speaking eth/65 ([EIP-2464](/eip-2464/)).\n\n## Sample code\n\nA test vector from the spec, decoded by hand:\n\n```text\nGetBlockHeaders (eth/66), RequestId 1111, origin block 9999, amount 5, skip 5, reverse false\n\nrlp: 0xca 820457 c6 82270f 05 05 80\n      │   │      │  │      │  │  └ reverse = false (empty string)\n      │   │      │  │      │  └── skip = 5\n      │   │      │  │      └───── maxHeaders = 5\n      │   │      │  └──────────── block = 9999 (0x270f)\n      │   │      └─────────────── inner list: the eth/65 message body\n      │   └────────────────────── request_id = 1111 (0x0457)\n      └────────────────────────── outer list\n```\n\nMatching responses in a client becomes a map lookup:\n\n```ts\nconst pending = new Map\u003cbigint, (body: unknown) =\u003e void\u003e();\n\nfunction request(send: (msg: unknown[]) =\u003e void, body: unknown[]) {\n  const id = BigInt.asUintN(64, BigInt(Math.floor(Math.random() * 2 ** 53)));\n  send([id, body]);                          // [request_id, original message]\n  return new Promise((resolve) =\u003e pending.set(id, resolve));\n}\n\nfunction onResponse([id, body]: [bigint, unknown]) {\n  pending.get(id)?.(body);\n  pending.delete(id);\n}\n```\n\n## Things to know\n\n- Status is **Final**. This is a networking change only; it does not affect consensus or smart contracts.\n- Peers can still throttle or disconnect clients that flood them with parallel requests; request IDs make parallelism easier but do not grant more of it.\n- Later `eth` protocol versions keep the request-ID envelope while changing other messages. For example, [EIP-2976](/eip-2976/) defines how typed transactions travel over the same protocol.\n"},"ja":{"lang":"ja","tldr":"eth/66 ワイヤープロトコルを導入した。`eth` p2p プロトコルのすべてのリクエストとレスポンスに 64 ビットのリクエスト ID を付け、ノードが返信をリクエストと直接対応付けられるようにする。","tags":["networking","devp2p","eth-protocol","p2p","client"],"related":[2464,2976],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-2481/","markdown":"## 何を解決するのか\n\nEthereum のノードは、devp2p の `eth` サブプロトコルで互いに通信します。多くのメッセージはリクエストとレスポンスのペアです。`GetBlockHeaders` → `BlockHeaders`、`GetReceipts` → `Receipts` などです。\n\neth/66 より前は、これらのメッセージに識別子がありませんでした。同じピアに複数の `GetBlockHeaders` リクエストを送ったノードは、返信が順不同で届くことがあるため、どの応答がどのリクエストに対応するのか確信できませんでした。クライアントは、保留中のすべてのリクエストと内容を突き合わせて各応答を判別する必要があり、これは複雑で、特に空の応答では曖昧でした。ライトクライアントプロトコルの `les` にはすでにリクエスト ID がありましたが、`eth` にはありませんでした。\n\n## 仕組み\n\neth/66 は、すべてのリクエスト／レスポンスメッセージの形を同じ方法で変更します。\n\n1. 2 要素のリストを作ります。\n2. 最初の要素は `request_id` で、リクエスト側が選ぶ 64 ビット整数です。\n3. 2 番目の要素は、元のメッセージ本体をそのまま入れたものです。\n\n応答側は、リクエストの `request_id` をレスポンスにコピーします。対象となるメッセージは、`GetBlockHeaders`/`BlockHeaders`、`GetBlockBodies`/`BlockBodies`、`GetPooledTransactions`/`PooledTransactions`、`GetNodeData`/`NodeData`、`GetReceipts`/`Receipts` です。\n\nリクエスト ID は次のとおりです。\n\n- 連番である必要はなく（ランダムで構いません）、再接続後の衝突を避けられます。\n- 重複してもよいため、単純なクライアントなら定数の ID を 1 つだけ使うこともできます。\n- `les` に合わせて 64 ビットです。\n\ndevp2p はサブプロトコルの複数バージョンを並行して動かせるため、eth/66 はハードフォークなしで展開されました。アップグレードしていないピアは eth/65（[EIP-2464](/eip-2464/)）で通信を続けました。\n\n## サンプルコード\n\n仕様に載っているテストベクターを手作業でデコードしたものです。\n\n```text\nGetBlockHeaders (eth/66), RequestId 1111, origin block 9999, amount 5, skip 5, reverse false\n\nrlp: 0xca 820457 c6 82270f 05 05 80\n      │   │      │  │      │  │  └ reverse = false (empty string)\n      │   │      │  │      │  └── skip = 5\n      │   │      │  │      └───── maxHeaders = 5\n      │   │      │  └──────────── block = 9999 (0x270f)\n      │   │      └─────────────── inner list: the eth/65 message body\n      │   └────────────────────── request_id = 1111 (0x0457)\n      └────────────────────────── outer list\n```\n\nクライアントでの応答の対応付けは、マップの参照になります。\n\n```ts\nconst pending = new Map\u003cbigint, (body: unknown) =\u003e void\u003e();\n\nfunction request(send: (msg: unknown[]) =\u003e void, body: unknown[]) {\n  const id = BigInt.asUintN(64, BigInt(Math.floor(Math.random() * 2 ** 53)));\n  send([id, body]);                          // [request_id, original message]\n  return new Promise((resolve) =\u003e pending.set(id, resolve));\n}\n\nfunction onResponse([id, body]: [bigint, unknown]) {\n  pending.get(id)?.(body);\n  pending.delete(id);\n}\n```\n\n## 知っておくべきこと\n\n- ステータスは **Final** です。これはネットワーク層だけの変更で、コンセンサスやスマートコントラクトには影響しません。\n- ピアは、並列リクエストを大量に送りつけるクライアントを引き続き制限したり切断したりできます。リクエスト ID は並列化を容易にしますが、並列度を増やす権利を与えるものではありません。\n- 以降の `eth` プロトコルのバージョンも、他のメッセージを変更しながらリクエスト ID のエンベロープを維持しています。たとえば [EIP-2976](/eip-2976/) は、型付きトランザクションが同じプロトコル上をどのように流れるかを定義しています。\n"},"ko":{"lang":"ko","tldr":"eth/66 와이어 프로토콜을 도입했다. `eth` p2p 프로토콜의 모든 요청과 응답에 64비트 요청 ID를 붙여, 노드가 응답을 요청과 바로 대응시킬 수 있게 한다.","tags":["networking","devp2p","eth-protocol","p2p","client"],"related":[2464,2976],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-2481/","markdown":"## 어떤 문제를 해결하나요?\n\n이더리움 노드는 devp2p의 `eth` 서브 프로토콜로 서로 통신합니다. 많은 메시지가 요청/응답 쌍으로 이루어집니다. `GetBlockHeaders` → `BlockHeaders`, `GetReceipts` → `Receipts` 등입니다.\n\neth/66 이전에는 이런 메시지에 식별자가 없었습니다. 같은 피어에 `GetBlockHeaders` 요청을 여러 개 보낸 노드는 응답이 순서가 뒤바뀌어 도착할 수 있어서 어떤 응답이 어떤 요청에 대한 것인지 확신할 수 없었습니다. 클라이언트는 대기 중인 모든 요청과 내용을 비교해 각 응답을 판별해야 했는데, 이는 복잡하고 특히 빈 응답에서는 모호했습니다. 라이트 클라이언트 프로토콜인 `les`에는 이미 요청 ID가 있었지만 `eth`에는 없었습니다.\n\n## 어떻게 동작하나요?\n\neth/66은 모든 요청/응답 메시지의 형태를 같은 방식으로 바꿉니다.\n\n1. 두 개의 원소를 가진 리스트를 만듭니다.\n2. 첫 번째 원소는 `request_id`로, 요청자가 고른 64비트 정수입니다.\n3. 두 번째 원소는 원래 메시지 본문이며 그대로입니다.\n\n응답자는 요청의 `request_id`를 응답에 그대로 복사합니다. 영향을 받는 메시지는 `GetBlockHeaders`/`BlockHeaders`, `GetBlockBodies`/`BlockBodies`, `GetPooledTransactions`/`PooledTransactions`, `GetNodeData`/`NodeData`, `GetReceipts`/`Receipts`입니다.\n\n요청 ID는 다음과 같습니다.\n\n- 순차적일 필요가 없어(무작위여도 됨) 재연결 후의 충돌을 피할 수 있습니다.\n- 중복되어도 되므로, 단순한 클라이언트는 상수 ID 하나만 쓸 수도 있습니다.\n- `les`와 맞추기 위해 64비트입니다.\n\ndevp2p는 서브 프로토콜의 여러 버전을 나란히 실행할 수 있으므로, eth/66은 하드 포크 없이 배포되었습니다. 업그레이드하지 않은 피어는 계속 eth/65([EIP-2464](/eip-2464/))로 통신했습니다.\n\n## 샘플 코드\n\n명세에 있는 테스트 벡터를 직접 디코딩한 것입니다.\n\n```text\nGetBlockHeaders (eth/66), RequestId 1111, origin block 9999, amount 5, skip 5, reverse false\n\nrlp: 0xca 820457 c6 82270f 05 05 80\n      │   │      │  │      │  │  └ reverse = false (empty string)\n      │   │      │  │      │  └── skip = 5\n      │   │      │  │      └───── maxHeaders = 5\n      │   │      │  └──────────── block = 9999 (0x270f)\n      │   │      └─────────────── inner list: the eth/65 message body\n      │   └────────────────────── request_id = 1111 (0x0457)\n      └────────────────────────── outer list\n```\n\n클라이언트에서 응답을 대응시키는 일은 맵 조회가 됩니다.\n\n```ts\nconst pending = new Map\u003cbigint, (body: unknown) =\u003e void\u003e();\n\nfunction request(send: (msg: unknown[]) =\u003e void, body: unknown[]) {\n  const id = BigInt.asUintN(64, BigInt(Math.floor(Math.random() * 2 ** 53)));\n  send([id, body]);                          // [request_id, original message]\n  return new Promise((resolve) =\u003e pending.set(id, resolve));\n}\n\nfunction onResponse([id, body]: [bigint, unknown]) {\n  pending.get(id)?.(body);\n  pending.delete(id);\n}\n```\n\n## 알아둘 점\n\n- 상태는 **Final**입니다. 네트워킹만 바뀐 것이며 합의나 스마트 컨트랙트에는 영향이 없습니다.\n- 피어는 병렬 요청을 쏟아내는 클라이언트를 여전히 제한하거나 연결을 끊을 수 있습니다. 요청 ID는 병렬 처리를 쉽게 해 줄 뿐, 더 많은 병렬 처리를 허용하는 것은 아닙니다.\n- 이후의 `eth` 프로토콜 버전도 다른 메시지는 바꾸면서 요청 ID 봉투는 유지합니다. 예를 들어 [EIP-2976](/eip-2976/)은 타입이 있는 트랜잭션이 같은 프로토콜로 전달되는 방식을 정의합니다.\n"},"zh":{"lang":"zh","tldr":"引入了 eth/66 网络协议：为 `eth` p2p 协议中的每个请求和响应都附上 64 位请求 ID，使节点可以直接把回复与请求对应起来。","tags":["networking","devp2p","eth-protocol","p2p","client"],"related":[2464,2976],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-2481/","markdown":"## 它解决什么问题？\n\n以太坊节点之间通过 devp2p 的 `eth` 子协议通信。许多消息都是请求/响应成对出现：`GetBlockHeaders` → `BlockHeaders`，`GetReceipts` → `Receipts`，等等。\n\n在 eth/66 之前，这些消息没有携带标识符。向同一个对等节点发送了多个 `GetBlockHeaders` 请求的节点，无法确定哪个响应对应哪个请求，因为回复可能乱序到达。客户端只能根据内容把每个响应与所有待处理的请求逐一比对，这既复杂又含糊，空响应尤其如此。轻客户端协议 `les` 早已有请求 ID，而 `eth` 没有。\n\n## 它如何运作\n\neth/66 以同样的方式改变了每个请求/响应消息的结构：\n\n1. 创建一个包含两个元素的列表。\n2. 第一个元素是 `request_id`，由请求方选择的 64 位整数。\n3. 第二个元素是原来的消息体，保持不变。\n\n响应方把请求中的 `request_id` 复制到响应里。受影响的消息有 `GetBlockHeaders`/`BlockHeaders`、`GetBlockBodies`/`BlockBodies`、`GetPooledTransactions`/`PooledTransactions`、`GetNodeData`/`NodeData` 以及 `GetReceipts`/`Receipts`。\n\n请求 ID：\n\n- 不必是连续的（随机即可），这样可以避免重连后发生冲突；\n- 可以重复，所以简单的客户端甚至可以只使用一个固定 ID；\n- 为 64 位，以与 `les` 保持一致。\n\n由于 devp2p 可以同时运行同一子协议的多个版本，eth/66 无需硬分叉即可推出；尚未升级的对等节点继续使用 eth/65（[EIP-2464](/eip-2464/)）。\n\n## 示例代码\n\n规范中的一个测试向量，手工解码如下：\n\n```text\nGetBlockHeaders (eth/66), RequestId 1111, origin block 9999, amount 5, skip 5, reverse false\n\nrlp: 0xca 820457 c6 82270f 05 05 80\n      │   │      │  │      │  │  └ reverse = false (empty string)\n      │   │      │  │      │  └── skip = 5\n      │   │      │  │      └───── maxHeaders = 5\n      │   │      │  └──────────── block = 9999 (0x270f)\n      │   │      └─────────────── inner list: the eth/65 message body\n      │   └────────────────────── request_id = 1111 (0x0457)\n      └────────────────────────── outer list\n```\n\n在客户端中匹配响应变成了一次 map 查找：\n\n```ts\nconst pending = new Map\u003cbigint, (body: unknown) =\u003e void\u003e();\n\nfunction request(send: (msg: unknown[]) =\u003e void, body: unknown[]) {\n  const id = BigInt.asUintN(64, BigInt(Math.floor(Math.random() * 2 ** 53)));\n  send([id, body]);                          // [request_id, original message]\n  return new Promise((resolve) =\u003e pending.set(id, resolve));\n}\n\nfunction onResponse([id, body]: [bigint, unknown]) {\n  pending.get(id)?.(body);\n  pending.delete(id);\n}\n```\n\n## 需要注意\n\n- 状态为 **Final**。这只是网络层的变更，不影响共识或智能合约。\n- 对等节点仍然可以对发送大量并行请求的客户端限流或断开连接；请求 ID 让并行更容易，但并不会赋予更多的并行额度。\n- 之后的 `eth` 协议版本在修改其他消息的同时，仍保留请求 ID 这一封装。例如，[EIP-2976](/eip-2976/) 定义了带类型的交易如何在同一协议上传输。\n"}},"requiredBy":[4938,5793]}
