EIPs Explained

EIP-1459 · Stagnant · Networking · 2018-09-26

EIP-1459: Node Discovery via DNS

Lets Ethereum clients fetch large, signed, regularly updated lists of peer nodes from ordinary DNS TXT records instead of relying only on hard-coded bootnodes.

What problem does it solve?

A new node needs some first peers to join the network. Clients traditionally ship a short, hard-coded list of bootstrap nodes; changing it requires a software release, and a small list gives little choice of entry point.

EIP-1459 publishes node lists through DNS. DNS works almost everywhere, even on restrictive networks, is cached by resolvers, and needs no custom server. Lists can hold hundreds of nodes, be updated at any time, and are authenticated with a signature, so the DNS operator or a resolver cannot tamper with the contents.

How it works

  • A list is referenced by an enrtree:// URL: the username part is the base32-encoded compressed secp256k1 public key of the list signer, and the host is the DNS name.
  • The list is a Merkle tree stored in TXT records. The root record looks like
    enrtree-root:v1 e=<enr-root> l=<link-root> seq=<n> sig=<signature>
    and is signed by the list key. seq must increase on every update, which blocks rollback to an old list.
  • Every other entry lives at a subdomain named after the base32 of its (abbreviated) keccak-256 hash, so the client can verify each record against its parent:
    • enrtree-branch:<h1>,<h2>,... points to child entries.
    • enr:<base64> is a leaf holding an EIP-778 node record.
    • enrtree://<key>@<domain> is a link to another list (only under link-root), enabling federated lists.
  • Each TXT record is kept small enough for a 512-byte UDP DNS response. Only the root needs a short TTL; the rest can be cached for a long time.

Clients resolve the root, check the signature and sequence number, then walk the tree lazily, in random order, only as far as needed to find peers.

Sample code

Zone file layout (example structure from the spec, truncated values):

; name                        ttl    class type content
@                             60     IN    TXT  enrtree-root:v1 e=JWXYDBPXYWG6FX3GMDIBFA6CJ4 l=C7HRFPF3BLGF3YR4DY5KX3SMBE seq=1 sig=o908Wm...
C7HRFPF3BLGF3YR4DY5KX3SMBE    86900  IN    TXT  enrtree://AM5FCQLWIZX2QFPNJAP7VUERCCRNGRHWZG3YYHIUV7BVDQ5FDPRT2@morenodes.example.org
JWXYDBPXYWG6FX3GMDIBFA6CJ4    86900  IN    TXT  enrtree-branch:2XS2367YHAXJFGLZHVAWLQD4ZY,H4FHT4B454P6UXFD7JCYQ5PWDY
2XS2367YHAXJFGLZHVAWLQD4ZY    86900  IN    TXT  enr:-HW4QOFzoVLaFJnNhbgMoDXPnOvcdVuj7pDpqRvh6BRDO68...

Client traversal, as pseudocode:

def sync(domain, pubkey):
    root = parse_root(dns_txt(domain))
    assert verify(root.sig, keccak256(root.text_without_sig), pubkey)
    assert root.seq >= last_seen_seq(domain)
    visit(root.enr_root, domain, seen=set())

def visit(h, domain, seen):
    if h in seen: return
    seen.add(h)
    rec = dns_txt(f"{h}.{domain}")
    assert base32(keccak256(rec))[:len(h)] == h      # integrity check
    if rec.startswith("enrtree-branch:"):
        for child in shuffled(rec[len("enrtree-branch:"):].split(",")):
            visit(child, domain, seen)
    elif rec.startswith("enr:"):
        import_node(decode_enr(rec))

Things to know

  • Status: Stagnant as an EIP, though the scheme is implemented in clients such as go-ethereum.
  • DNS discovery trusts the list publisher. A malicious publisher could eclipse new nodes by listing only nodes it controls, so it is best used alongside DHT discovery.
  • Resolvers can block or freeze a list but cannot forge its contents, thanks to the signed root and hash-named records.

#networking #devp2p #discovery #dns #enr

Details

Authors
Felix Lange (@fjl), Péter Szilágyi (@karalabe)
Status
Stagnant
Type
Standards Track / Networking
Created
2018-09-26
Requires

Machine-readable: Markdown · JSON