2018-03-20 15:10:58 +00:00
|
|
|
---
|
2018-03-21 12:51:05 +00:00
|
|
|
eip: 868
|
|
|
|
title: Node Discovery v4 ENR Extension
|
|
|
|
author: Felix Lange <fjl@ethereum.org>
|
2018-03-21 15:55:18 +00:00
|
|
|
type: Standards Track
|
2018-03-21 12:51:05 +00:00
|
|
|
category: Networking
|
|
|
|
status: Draft
|
|
|
|
created: 2018-02-02
|
2018-03-21 13:10:08 +00:00
|
|
|
requires: 8, 778
|
2018-09-20 19:39:23 +00:00
|
|
|
discussions-to: https://github.com/ethereum/devp2p/issues/44
|
2018-03-20 15:10:58 +00:00
|
|
|
---
|
2018-02-02 13:16:59 +00:00
|
|
|
|
|
|
|
# Abstract
|
|
|
|
|
|
|
|
This EIP defines an extension to Node Discovery Protocol v4 to enable authoritative
|
|
|
|
resolution of Ethereum Node Records (ENR).
|
|
|
|
|
|
|
|
# Motivation
|
|
|
|
|
|
|
|
To bridge current and future discovery networks and to aid the implementation of other
|
|
|
|
relay mechanisms for ENR such as DNS, we need a way to request the most up-to-date version
|
2018-03-26 17:30:59 +00:00
|
|
|
of a node record. This EIP provides a way to request it using the existing discovery
|
|
|
|
protocol.
|
2018-02-02 13:16:59 +00:00
|
|
|
|
|
|
|
# Specification
|
|
|
|
|
2018-03-26 17:30:59 +00:00
|
|
|
Implementations of Node Discovery Protocol v4 should support two new packet types, a
|
|
|
|
request and reply of the node record. The existing ping and pong packets are extended with
|
|
|
|
a new field containing the sequence number of the ENR.
|
2018-02-02 13:16:59 +00:00
|
|
|
|
2018-03-26 17:30:59 +00:00
|
|
|
### Ping Packet (0x01)
|
2018-02-02 13:16:59 +00:00
|
|
|
|
2018-03-26 17:30:59 +00:00
|
|
|
```text
|
|
|
|
packet-data = [version, from, to, expiration, enr-seq]
|
|
|
|
```
|
2018-02-02 13:16:59 +00:00
|
|
|
|
2018-03-26 17:30:59 +00:00
|
|
|
`enr-seq` is the current sequence number of the sending node's record. All other fields
|
|
|
|
retain their existing meaning.
|
|
|
|
|
|
|
|
### Pong Packet (0x02)
|
|
|
|
|
|
|
|
```text
|
|
|
|
packet-data = [to, ping-hash, expiration, enr-seq]
|
|
|
|
```
|
|
|
|
|
|
|
|
`enr-seq` is the current sequence number of the sending node's record. All other fields
|
|
|
|
retain their existing meaning.
|
|
|
|
|
|
|
|
### ENRRequest Packet (0x05)
|
|
|
|
|
|
|
|
```text
|
|
|
|
packet-data = [ expiration ]
|
|
|
|
```
|
|
|
|
|
|
|
|
When a packet of this type is received, the node should reply with an ENRResponse packet
|
2018-02-02 13:16:59 +00:00
|
|
|
containing the current version of its record.
|
|
|
|
|
2018-03-26 17:30:59 +00:00
|
|
|
To guard against amplification attacks, the sender of ENRRequest should have replied to a
|
|
|
|
ping packet recently (just like for FindNode). The `expiration` field, a UNIX timestamp,
|
|
|
|
should be handled as for all other existing packets i.e. no reply should be sent if it
|
|
|
|
refers to a time in the past.
|
2018-02-02 13:16:59 +00:00
|
|
|
|
2018-03-26 17:30:59 +00:00
|
|
|
### ENRResponse Packet (0x06)
|
2018-02-02 13:16:59 +00:00
|
|
|
|
2018-03-26 17:30:59 +00:00
|
|
|
```text
|
|
|
|
packet-data = [ request-hash, ENR ]
|
|
|
|
```
|
2018-02-02 13:16:59 +00:00
|
|
|
|
2018-03-26 17:30:59 +00:00
|
|
|
This packet is the response to ENRRequest.
|
2018-02-02 13:16:59 +00:00
|
|
|
|
2018-03-26 17:30:59 +00:00
|
|
|
- `request-hash` is the hash of the entire ENRRequest packet being replied to.
|
2018-02-02 13:16:59 +00:00
|
|
|
- `ENR` is the node record.
|
|
|
|
|
2018-03-26 17:30:59 +00:00
|
|
|
The recipient of the packet should verify that the node record is signed by node who sent
|
|
|
|
ENRResponse.
|
|
|
|
|
|
|
|
## Resolving Records
|
|
|
|
|
|
|
|
To resolve the current record of a node public key, perform a recursive Kademlia lookup
|
|
|
|
using the FindNode, Neighbors packets. When the node is found, send ENRRequest to it and
|
|
|
|
return the record from the response.
|
2018-02-02 13:16:59 +00:00
|
|
|
|
|
|
|
# Copyright
|
|
|
|
|
|
|
|
Copyright and related rights waived via CC0.
|