About DNS discovery
Understand how a node retrieves peer connection details from an ENR tree published in DNS.
Built upon the foundation of EIP-1459: Node Discovery via DNS, DNS Discovery allows the retrieval of an ENR tree from the TXT field of a domain name. This approach enables the storage of essential node connection details, including IP, port, and multiaddr. This bootstrapping method allows anyone to register and publish a domain name for the network, promoting increased decentralisation.
How DNS discovery works
sequenceDiagram
Node->>DNS Server: (1) Lookup TXT example.com
DNS Server-->>Node: (2) enrtree-root:v1 e=U3...3Y ...
Node->>DNS Server: (3) Lookup TXT U3...3Y.example.com
DNS Server-->>Node: (4) enrtree-branch:DU...VQ,J3..HU,IC...WE
Node->> DNS Server: (5) Lookup TXT DU...VQ.example.com
DNS Server-->>Node: (6) enr:-M-4QLdAB-Kyz...Wt1Mg8
Node ->> Node: (7) Decode ENR: Peer's connection details
- DNS lookup query to retrieve TXT data stored on
example.comdomain. enrtree-rootis returned, and the value ofeis theenr-root, the root hash of the node subtree.- DNS lookup query to retrieve TXT data stored on
<enr-root>.example.comdomain. enrtree-branchis returned; this tree contains hashes of node subtrees.- DNS lookup query to retrieve TXT data stored on
DU...VQ.example.comdomain, the first leaf ofenrtree-branch. enrrecord is returned.- Returned value is decoded, and peer connection details such as IP address and port are learned.
Pros and cons
Pros:
- Low latency, low resource requirements.
- Easy bootstrap list updates by modifying the domain name, eliminating the need for code changes.
- Ability to reference a larger list of nodes by including other domain names in the code or ENR tree.
Cons:
- Vulnerable to censorship: Domain names can be blocked or restricted.
- Limited scalability: The listed nodes are at risk of being overwhelmed by receiving all queries. Also, operators must provide their
ENRto the domain owner for listing.