{"eip":868,"title":"Node Discovery v4 ENR Extension","description":"This EIP defines an extension to Node Discovery Protocol v4 to enable authoritative resolution of Ethereum Node Records (ENR).","authors":["Felix Lange \u003cfjl@ethereum.org\u003e"],"status":"Final","type":"Standards Track","category":"Networking","created":"2018-02-02","requires":[8,778],"discussionsTo":"https://github.com/ethereum/devp2p/issues/44","repo":"EIPs","label":"EIP-868","officialUrl":"https://eips.ethereum.org/EIPS/eip-868","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-868.md","url":"https://eips.huatuo.xyz/eip-868/","tldr":{"en":"Extends Ethereum's discv4 peer discovery with packets to request a node's signed Ethereum Node Record (ENR), so peers can always fetch the latest, authoritative info about a node.","ja":"Ethereum の discv4 ピア探索を拡張し、ノードの署名付き Ethereum Node Record（ENR）を要求するパケットを追加。ピアはノードに関する最新で信頼できる情報をいつでも取得できる。","ko":"이더리움의 discv4 피어 탐색을 확장해 노드의 서명된 Ethereum Node Record(ENR)를 요청하는 패킷을 추가한다. 피어는 노드에 대한 최신의 신뢰할 수 있는 정보를 언제든 가져올 수 있다.","zh":"扩展以太坊的 discv4 节点发现协议，增加请求节点已签名的以太坊节点记录（ENR）的数据包，使对等节点始终能获取某个节点最新、权威的信息。"},"tags":["networking","devp2p","discovery","enr"],"explainers":{"en":{"lang":"en","tldr":"Extends Ethereum's discv4 peer discovery with packets to request a node's signed Ethereum Node Record (ENR), so peers can always fetch the latest, authoritative info about a node.","tags":["networking","devp2p","discovery","enr"],"related":[778,8,1459,2124],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-868/","markdown":"## What problem does it solve?\n\nEthereum nodes find each other with the Node Discovery Protocol v4 (discv4), a Kademlia-style UDP protocol. Originally a discv4 entry held only an IP, ports and public key. [EIP-778](/eip-778/) introduced **Ethereum Node Records (ENR)**: signed, versioned, extensible records that can also advertise things like which chain or fork a node is on.\n\nBut discv4 had no way to ask a node \"send me your current record\". Without that, ENRs could not be resolved reliably over the existing discovery network, or bridged to other channels such as DNS. EIP-868 adds the missing request and response.\n\n## How it works\n\nTwo existing packets gain a field, and two new packets are added:\n\n| Packet | Type | Data |\n| --- | --- | --- |\n| Ping | `0x01` | `[version, from, to, expiration, enr-seq]` |\n| Pong | `0x02` | `[to, ping-hash, expiration, enr-seq]` |\n| ENRRequest | `0x05` | `[expiration]` |\n| ENRResponse | `0x06` | `[request-hash, ENR]` |\n\n- **`enr-seq`** in Ping and Pong is the sender's current ENR sequence number. If you see a higher number than the one you have cached, the node's record has changed and is worth re-fetching.\n- **ENRRequest** asks for the record. To prevent UDP amplification attacks, a node should only answer if the requester has recently completed a ping/pong exchange, as for `FindNode`. Expired requests are ignored.\n- **ENRResponse** returns the record and the hash of the request it answers. The receiver must check that the ENR is signed by the node that sent it.\n\n**Resolving a record by public key:** run the normal recursive Kademlia lookup (`FindNode` / `Neighbors`) to locate the node, then send it an ENRRequest.\n\n## Sample code\n\nPseudocode for keeping a peer's record fresh:\n\n```python\ndef on_pong(peer, pong):\n    # pong.enr_seq was added by EIP-868\n    if pong.enr_seq \u003e cache.get_seq(peer.id):\n        send(peer, ENRRequest(expiration=now() + 20))\n\ndef on_enr_response(peer, resp):\n    assert resp.request_hash == last_request_hash(peer)\n    record = rlp_decode(resp.enr)\n    assert record.verify_signature(peer.public_key)   # must be signed by sender\n    assert record.seq \u003e= cache.get_seq(peer.id)\n    cache.store(peer.id, record)\n```\n\nENRs are often shared as text, base64 with an `enr:` prefix:\n\n```text\nenr:-IS4QHCYrYZbAKWCBRlAy5zzaDZXJBGkcnh4MHcBFZntXNFrdvJjX04jRzjzCBOonrkTfj499SZuOh8R33Ls8RRcy5wBgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQPKY0yuDUmstAHYpMa2_oxVtw0RW_QAdpzBQA8yWM0xOIN1ZHCCdl8\n```\n\n(This is the example record from EIP-778.)\n\n## Things to know\n\n- This EIP is **Final** and implemented in execution clients that run discv4.\n- ENRs can carry an `eth` entry with the fork identifier from [EIP-2124](/eip-2124/), which helps nodes skip peers on the wrong chain early.\n- Records fetched this way can also be published through DNS lists ([EIP-1459](/eip-1459/)).\n- Its successor protocol, discv5, uses ENRs natively and is what consensus-layer clients use for discovery.\n"},"ja":{"lang":"ja","tldr":"Ethereum の discv4 ピア探索を拡張し、ノードの署名付き Ethereum Node Record（ENR）を要求するパケットを追加。ピアはノードに関する最新で信頼できる情報をいつでも取得できる。","tags":["networking","devp2p","discovery","enr"],"related":[778,8,1459,2124],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-868/","markdown":"## 何を解決するのか\n\nEthereum のノードは、Node Discovery Protocol v4（discv4）で互いを見つけます。これは Kademlia 方式の UDP プロトコルです。もともと discv4 のエントリは IP、ポート、公開鍵だけを保持していました。[EIP-778](/eip-778/) は **Ethereum Node Record（ENR）** を導入しました。署名付き・バージョン付きで拡張可能なレコードで、ノードがどのチェーンやフォークにいるかといった情報も告知できます。\n\nしかし discv4 には、ノードに「現在のレコードを送って」と尋ねる手段がありませんでした。そのままでは、既存のディスカバリーネットワーク上で ENR を確実に解決したり、DNS など他のチャネルに橋渡ししたりできませんでした。EIP-868 は、足りなかった要求と応答を追加します。\n\n## 仕組み\n\n既存の 2 つのパケットにフィールドが追加され、新しいパケットが 2 つ加わります。\n\n| パケット | 種別 | データ |\n| --- | --- | --- |\n| Ping | `0x01` | `[version, from, to, expiration, enr-seq]` |\n| Pong | `0x02` | `[to, ping-hash, expiration, enr-seq]` |\n| ENRRequest | `0x05` | `[expiration]` |\n| ENRResponse | `0x06` | `[request-hash, ENR]` |\n\n- Ping と Pong の **`enr-seq`** は、送信者の現在の ENR シーケンス番号です。キャッシュしている番号より大きい値を見たら、そのノードのレコードが変わっているので、再取得する価値があります。\n- **ENRRequest** はレコードを要求します。UDP 増幅攻撃を防ぐため、ノードは `FindNode` と同様に、要求者が最近 ping/pong のやり取りを完了している場合にのみ応答するべきです。期限切れの要求は無視されます。\n- **ENRResponse** は、レコードと、応答対象の要求のハッシュを返します。受信者は、その ENR が送信元のノードによって署名されていることを確認しなければなりません。\n\n**公開鍵でレコードを解決する:** 通常の再帰的な Kademlia 探索（`FindNode` / `Neighbors`）でノードを見つけ、そのノードに ENRRequest を送ります。\n\n## サンプルコード\n\nピアのレコードを最新に保つための擬似コード:\n\n```python\ndef on_pong(peer, pong):\n    # pong.enr_seq was added by EIP-868\n    if pong.enr_seq \u003e cache.get_seq(peer.id):\n        send(peer, ENRRequest(expiration=now() + 20))\n\ndef on_enr_response(peer, resp):\n    assert resp.request_hash == last_request_hash(peer)\n    record = rlp_decode(resp.enr)\n    assert record.verify_signature(peer.public_key)   # must be signed by sender\n    assert record.seq \u003e= cache.get_seq(peer.id)\n    cache.store(peer.id, record)\n```\n\nENR は、`enr:` プレフィックス付きの base64 というテキスト形式で共有されることがよくあります。\n\n```text\nenr:-IS4QHCYrYZbAKWCBRlAy5zzaDZXJBGkcnh4MHcBFZntXNFrdvJjX04jRzjzCBOonrkTfj499SZuOh8R33Ls8RRcy5wBgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQPKY0yuDUmstAHYpMa2_oxVtw0RW_QAdpzBQA8yWM0xOIN1ZHCCdl8\n```\n\n（これは EIP-778 の例のレコードです。）\n\n## 知っておくべきこと\n\n- この EIP は **Final** で、discv4 を実行する実行クライアントに実装されています。\n- ENR は、[EIP-2124](/eip-2124/) のフォーク識別子を持つ `eth` エントリを運べるため、ノードは間違ったチェーンのピアを早い段階で除外できます。\n- この方法で取得したレコードは、DNS リスト（[EIP-1459](/eip-1459/)）経由で公開することもできます。\n- 後継のプロトコルである discv5 は ENR をネイティブに使い、コンセンサスレイヤーのクライアントがディスカバリーに使っています。\n"},"ko":{"lang":"ko","tldr":"이더리움의 discv4 피어 탐색을 확장해 노드의 서명된 Ethereum Node Record(ENR)를 요청하는 패킷을 추가한다. 피어는 노드에 대한 최신의 신뢰할 수 있는 정보를 언제든 가져올 수 있다.","tags":["networking","devp2p","discovery","enr"],"related":[778,8,1459,2124],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-868/","markdown":"## 어떤 문제를 해결하나요?\n\n이더리움 노드는 Node Discovery Protocol v4(discv4)로 서로를 찾습니다. 이는 Kademlia 방식의 UDP 프로토콜입니다. 원래 discv4 항목에는 IP, 포트, 공개 키만 들어 있었습니다. [EIP-778](/eip-778/)은 **Ethereum Node Record(ENR)**를 도입했습니다. 서명되고, 버전이 있으며, 확장 가능한 레코드로, 노드가 어떤 체인이나 포크에 있는지 같은 정보도 알릴 수 있습니다.\n\n그러나 discv4에는 노드에게 \"현재 레코드를 보내 달라\"고 요청할 방법이 없었습니다. 그래서 기존 탐색 네트워크에서 ENR을 안정적으로 조회하거나 DNS 같은 다른 채널로 연결할 수 없었습니다. EIP-868은 빠져 있던 요청과 응답을 추가합니다.\n\n## 어떻게 동작하나요?\n\n기존 패킷 두 개에 필드가 추가되고, 새 패킷 두 개가 더해집니다.\n\n| 패킷 | 타입 | 데이터 |\n| --- | --- | --- |\n| Ping | `0x01` | `[version, from, to, expiration, enr-seq]` |\n| Pong | `0x02` | `[to, ping-hash, expiration, enr-seq]` |\n| ENRRequest | `0x05` | `[expiration]` |\n| ENRResponse | `0x06` | `[request-hash, ENR]` |\n\n- Ping과 Pong의 **`enr-seq`**는 발신자의 현재 ENR 시퀀스 번호입니다. 캐시해 둔 번호보다 큰 값을 보면 그 노드의 레코드가 바뀐 것이므로 다시 가져올 만합니다.\n- **ENRRequest**는 레코드를 요청합니다. UDP 증폭 공격을 막기 위해, 노드는 `FindNode`와 마찬가지로 요청자가 최근에 ping/pong 교환을 마친 경우에만 응답해야 합니다. 만료된 요청은 무시됩니다.\n- **ENRResponse**는 레코드와, 응답 대상 요청의 해시를 반환합니다. 수신자는 그 ENR이 보낸 노드에 의해 서명되었는지 확인해야 합니다.\n\n**공개 키로 레코드 조회하기:** 일반적인 재귀 Kademlia 탐색(`FindNode` / `Neighbors`)으로 노드를 찾은 다음, 그 노드에 ENRRequest를 보냅니다.\n\n## 샘플 코드\n\n피어의 레코드를 최신으로 유지하는 의사 코드:\n\n```python\ndef on_pong(peer, pong):\n    # pong.enr_seq was added by EIP-868\n    if pong.enr_seq \u003e cache.get_seq(peer.id):\n        send(peer, ENRRequest(expiration=now() + 20))\n\ndef on_enr_response(peer, resp):\n    assert resp.request_hash == last_request_hash(peer)\n    record = rlp_decode(resp.enr)\n    assert record.verify_signature(peer.public_key)   # must be signed by sender\n    assert record.seq \u003e= cache.get_seq(peer.id)\n    cache.store(peer.id, record)\n```\n\nENR은 `enr:` 접두사가 붙은 base64 텍스트로 공유되는 경우가 많습니다.\n\n```text\nenr:-IS4QHCYrYZbAKWCBRlAy5zzaDZXJBGkcnh4MHcBFZntXNFrdvJjX04jRzjzCBOonrkTfj499SZuOh8R33Ls8RRcy5wBgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQPKY0yuDUmstAHYpMa2_oxVtw0RW_QAdpzBQA8yWM0xOIN1ZHCCdl8\n```\n\n(EIP-778의 예시 레코드입니다.)\n\n## 알아둘 점\n\n- 이 EIP는 **Final** 상태이며 discv4를 실행하는 실행 클라이언트에 구현되어 있습니다.\n- ENR은 [EIP-2124](/eip-2124/)의 포크 식별자를 담은 `eth` 항목을 실을 수 있어, 노드가 잘못된 체인의 피어를 일찍 건너뛸 수 있습니다.\n- 이 방식으로 가져온 레코드는 DNS 목록([EIP-1459](/eip-1459/))을 통해 게시할 수도 있습니다.\n- 후속 프로토콜인 discv5는 ENR을 네이티브로 사용하며, 합의 계층 클라이언트가 탐색에 사용합니다.\n"},"zh":{"lang":"zh","tldr":"扩展以太坊的 discv4 节点发现协议，增加请求节点已签名的以太坊节点记录（ENR）的数据包，使对等节点始终能获取某个节点最新、权威的信息。","tags":["networking","devp2p","discovery","enr"],"related":[778,8,1459,2124],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-868/","markdown":"## 它解决什么问题？\n\n以太坊节点通过节点发现协议 v4（discv4）互相寻找，这是一种 Kademlia 风格的 UDP 协议。最初，discv4 的条目只包含 IP、端口和公钥。[EIP-778](/eip-778/) 引入了**以太坊节点记录（ENR）**：已签名、带版本、可扩展的记录，还可以宣告节点处于哪条链或哪个分叉等信息。\n\n但 discv4 没有办法向节点询问\"把你当前的记录发给我\"。因此，ENR 无法在现有的发现网络上被可靠地解析，也无法桥接到 DNS 等其他渠道。EIP-868 补上了缺失的请求和响应。\n\n## 它如何运作\n\n两种现有数据包新增了字段，并新增了两种数据包：\n\n| 数据包 | 类型 | 数据 |\n| --- | --- | --- |\n| Ping | `0x01` | `[version, from, to, expiration, enr-seq]` |\n| Pong | `0x02` | `[to, ping-hash, expiration, enr-seq]` |\n| ENRRequest | `0x05` | `[expiration]` |\n| ENRResponse | `0x06` | `[request-hash, ENR]` |\n\n- Ping 和 Pong 中的 **`enr-seq`** 是发送方当前的 ENR 序列号。如果你看到的序号高于缓存中的序号，说明该节点的记录已变化，值得重新获取。\n- **ENRRequest** 用于请求记录。为防止 UDP 放大攻击，与 `FindNode` 一样，节点只应在请求方最近完成过 ping/pong 交换时才作出响应。过期的请求会被忽略。\n- **ENRResponse** 返回记录以及它所响应的请求的哈希。接收方必须检查该 ENR 是由发送它的节点签名的。\n\n**通过公钥解析记录：** 先执行常规的递归 Kademlia 查找（`FindNode` / `Neighbors`）定位节点，然后向它发送 ENRRequest。\n\n## 示例代码\n\n保持对等节点记录最新的伪代码：\n\n```python\ndef on_pong(peer, pong):\n    # pong.enr_seq was added by EIP-868\n    if pong.enr_seq \u003e cache.get_seq(peer.id):\n        send(peer, ENRRequest(expiration=now() + 20))\n\ndef on_enr_response(peer, resp):\n    assert resp.request_hash == last_request_hash(peer)\n    record = rlp_decode(resp.enr)\n    assert record.verify_signature(peer.public_key)   # must be signed by sender\n    assert record.seq \u003e= cache.get_seq(peer.id)\n    cache.store(peer.id, record)\n```\n\nENR 常以文本形式分享，即带 `enr:` 前缀的 base64：\n\n```text\nenr:-IS4QHCYrYZbAKWCBRlAy5zzaDZXJBGkcnh4MHcBFZntXNFrdvJjX04jRzjzCBOonrkTfj499SZuOh8R33Ls8RRcy5wBgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQPKY0yuDUmstAHYpMa2_oxVtw0RW_QAdpzBQA8yWM0xOIN1ZHCCdl8\n```\n\n（这是 EIP-778 中的示例记录。）\n\n## 需要注意\n\n- 本 EIP 状态为 **Final**，并已在运行 discv4 的执行层客户端中实现。\n- ENR 可以携带 `eth` 条目，其中含有 [EIP-2124](/eip-2124/) 的分叉标识符，帮助节点尽早跳过处于错误链上的对等节点。\n- 以这种方式获取的记录也可以通过 DNS 列表（[EIP-1459](/eip-1459/)）发布。\n- 其后继协议 discv5 原生使用 ENR，共识层客户端用它来做节点发现。\n"}}}
