An Ethereum Node Record (ENR) is a cryptographically signed, self-contained data structure that defines a network participant's identity and capabilities. It is the successor to the older multiaddr and RLPx discovery formats, providing a more flexible and future-proof standard. Each ENR contains essential information for peer discovery, such as the node's public key, IP address, TCP and UDP ports, and the Ethereum chain ID it supports. The record's signature, created using the node's private key, ensures its authenticity and prevents spoofing.
ENR (Ethereum Node Record)
What is ENR (Ethereum Node Record)?
A standardized format for node identity and network metadata in Ethereum's peer-to-peer layer.
The ENR's structure is defined by a set of key-value pairs, allowing for extensibility. Common keys include id (identity scheme, e.g., v4 for secp256k1), secp256k1 (the compressed public key), ip and tcp/udp for network addresses, and eth (Ethereum fork ID). New key-value pairs can be added to support additional protocols or client features without breaking backward compatibility. This design is crucial for the Ethereum Node Discovery Protocol (v5), or Discv5, which uses ENRs as its fundamental data unit for locating and connecting to peers in the network.
From a practical standpoint, ENRs enable efficient and secure peer discovery. When a node starts, it can share its own ENR and request ENRs from known peers to build its view of the network. The cryptographic signature allows other nodes to verify the origin of the information. This system is more robust than its predecessors, resisting common attacks like eclipse attacks by making it harder to fake node identities or locations. ENRs are therefore a foundational component for maintaining the decentralized and resilient nature of Ethereum's peer-to-peer (p2p) networking stack.
Etymology & Origin
The ENR (Ethereum Node Record) evolved from the foundational discovery protocols of peer-to-peer networks to become the standardized identity format for Ethereum nodes.
The term Ethereum Node Record (ENR) originates from the need to replace the older, less flexible RLPx discovery protocol. The ENR format was formally introduced in EIP-778 as a generalized, extensible way for nodes to advertise their identity and connection details on the network. It draws conceptual lineage from the enode URL scheme but uses a key-value structure signed by the node's private key for verifiable authenticity.
The 'Record' component signifies a self-certifying data structure. Unlike a simple address, an ENR contains signed, attested information such as the node's public key, IP address, TCP and UDP ports, and supported capabilities. This design allows the record to be shared and verified by other peers without a central authority, forming the basis for secure and efficient peer discovery in the Ethereum and Ethereum 2.0 / Consensus Layer networking stacks.
The adoption of ENRs marked a significant shift towards a more modular and future-proof networking layer. By separating the node's identity from its transport protocol, ENRs enabled support for multiple network stacks (like Discv5) and could easily incorporate new key-value pairs for emerging functionalities. This extensibility was crucial for the transition to proof-of-stake, where nodes needed to advertise their roles as execution clients or consensus clients.
How ENR Works
An explanation of the Ethereum Node Record (ENR) format, its cryptographic structure, and its role in the Ethereum peer-to-peer network.
An Ethereum Node Record (ENR) is a standardized, self-certifying data structure used by Ethereum nodes to advertise their identity, network capabilities, and connection endpoints to peers. It is the successor to the older multiaddr-based RLPx discovery protocol, providing a more flexible and extensible format. Each ENR contains a sequence number for versioning, a signature for authentication, and a set of key-value pairs that encode the node's public key, IP address, TCP and UDP ports, and other optional metadata.
The core cryptographic mechanism of an ENR is its self-certification. The record is signed by the node's private key, and the corresponding public key is included within the record itself. This allows any receiving peer to cryptographically verify that the information originated from the holder of that private key, preventing spoofing. The signature covers the entire content, including the sequence number, ensuring data integrity and enabling secure updates—when a node changes its information, it increments the sequence number and re-signs the record.
ENRs are encoded using Recursive Length Prefix (RLP) serialization and are shared through the node discovery protocol, primarily using UDP. When a node joins the network, it queries known bootnodes or uses a Discv5 discovery query to find peers, exchanging ENRs in the process. The key-value pairs within an ENR are extensible; common keys include id (identity scheme, e.g., v4), secp256k1 (the compressed public key), ip/tcp/udp for network addresses, and eth for Ethereum fork compatibility information.
A critical function of the ENR is to support multiple transport protocols and identity schemes. While the secp256k1 key is standard for the current v4 scheme used by execution clients, the format is designed to accommodate future schemes like handshake-based protocols. This extensibility makes ENRs a foundational component for Ethereum's evolving networking stack, including its use in Ethereum 2.0 (Consensus Layer) peer discovery, where nodes advertise their attestation subnet subscriptions.
Key Features of ENR
ENR is a standardized format for node identity and metadata, replacing the older multiaddr-based discovery protocol. It provides a cryptographically verifiable and extensible record for peer-to-peer networking.
Cryptographic Identity
An ENR is signed by a node's cryptographic key, providing verifiable proof of ownership. The signature is created using the node's private key and can be validated by any peer using the corresponding public key. This prevents spoofing and ensures the integrity of the node's advertised information.
Extensible Key-Value Store
At its core, an ENR is a flexible key-value store where keys are predefined strings and values are arbitrary data. This allows for the inclusion of diverse metadata, such as:
- IP address and TCP/UDP ports
- Node capabilities (e.g., supported Ethereum sub-protocols)
- Custom fields for future network upgrades or client-specific data.
Sequence Number for Freshness
Each ENR contains a sequence number, a monotonically increasing integer. When a node updates its metadata (e.g., changes its IP address), it increments this number and re-signs the record. Peers can compare sequence numbers to identify the most recent and valid record, ensuring they have current connection information.
Replaces Multiaddr & RLPx Discovery
ENR supersedes the older multiaddr format used in RLPx discovery v4. Unlike its predecessor, ENR is self-contained (carrying its own signature) and extensible. It is the foundation for Discv5, the current Ethereum node discovery protocol, which improves privacy and efficiency over the v4 system.
Standardized Encoding (RLP & ASCII)
ENRs use two primary encodings for different contexts:
- Binary Encoding: The canonical form is serialized using Recursive Length Prefix (RLP) for efficient network transmission.
- Textual Encoding (enr://): For configuration and sharing, the RLP data is base64url encoded and prefixed with
enr://, creating a compact, shareable URI.
Technical Components of an ENR
An Ethereum Node Record (ENR) is a signed, self-certifying data structure that encodes a node's identity, network endpoints, and capabilities. This section details its core technical fields and cryptographic construction.
Signature & Identity
The signature is the cryptographic proof of ownership, created by signing the ENR's content hash with the node's private key. The public key (or its hash) is included to allow verification. This establishes a verifiable, self-sovereign identity for the node on the network.
Sequence Number
A monotonically increasing sequence number acts as a version counter. Each time a node updates its ENR (e.g., IP address change), it must increment this number and re-sign the record. This prevents replay attacks and ensures peers have the most current information.
Network Addresses (IP & Port)
The IP address and port are the primary network locators for the node, stored as key-value pairs (e.g., udp, tcp). An ENR can contain both IPv4 and IPv6 addresses. This is the essential data for other nodes to establish a direct connection.
Capability Flags (eth, les, snap)
These key-value pairs advertise the node's supported protocols and chain data. Common flags include:
eth: The Ethereum Wire Protocol version.les: Light Ethereum Subprotocol support.snap: Support for the snap sync protocol. This allows for efficient, compatible peer discovery.
Fork ID & Chain Metadata
The forkid is a hash derived from the genesis block and past forks. It allows nodes to quickly identify if they are on the same chain and compatible fork history, preventing connections to nodes on a different network (e.g., a testnet).
RLP Serialization
The ENR is serialized using Recursive Length Prefix (RLP), Ethereum's standard serialization format. The structure is: [signature, sequence_number, k1, v1, k2, v2, ...]. The signature covers the RLP encoding of all subsequent elements, ensuring data integrity.
ENR vs. Previous Node Identity Format
A technical comparison of the Ethereum Node Record (ENR) with the legacy node identity format used in earlier versions of the Ethereum peer-to-peer (devp2p) protocol.
| Feature | ENR (Ethereum Node Record) | Legacy devp2p Node Identity |
|---|---|---|
Format Standard | RLP-encoded key-value store | Fixed 512-bit ECDSA secp256k1 public key |
Extensibility | ||
Self-Certification | Signed by node key, includes signature | Unsigned, identity derived from connection handshake |
Dynamic Data Support | ||
Protocol Versioning | Explicit 'id' field (e.g., 'v4') | Implicit via handshake |
Network Identity Separation | Supports multiple networks via 'eth' field | Single network identity |
Transport Address Updates | Supports dynamic IP/port via 'udp'/'tcp' fields | Static, requires rediscovery on change |
Ecosystem Usage & Protocols
ENR (Ethereum Node Record) is a standardized format for node identity and discovery in Ethereum and other Ethereum Virtual Machine (EVM) networks. It replaced the older multiaddr format to provide a more extensible, self-certifying, and secure way for nodes to share their connectivity information.
Core Definition & Structure
An Ethereum Node Record (ENR) is a signed, self-certifying data structure that contains a node's public key, IP address, TCP/UDP ports, and other arbitrary key-value pairs. Its primary components are:
- Signature: A cryptographic signature from the node's private key.
- Sequence Number: A version counter that increments with each update.
- Key-Value Pairs: Core fields like
id(identity scheme, e.g.,v4),secp256k1(public key),ip,tcp,udp, and optional custom attributes. This structure allows any peer to verify the record's authenticity and integrity.
Discovery v5 (Discv5) Protocol
ENR is the fundamental data unit of the Discv5 peer-to-peer node discovery protocol. Discv5 uses a distributed hash table (DHT) and a Kademlia-like routing algorithm to help nodes find each other without centralized trackers. Key functions include:
- Ping/Pong: To verify liveness and exchange ENRs.
- FindNode: To locate peers closest to a given Node ID.
- Topic Advertisement: For discovering nodes interested in specific network sub-protocols (e.g.,
eth,les). This creates a resilient and decentralized network overlay.
Extensibility & Custom Attributes
A key advantage of ENR over its predecessor is its extensible key-value store. Nodes can advertise capabilities beyond basic connectivity, enabling protocol negotiation and network partitioning. Common Ethereum-specific extensions include:
eth: The node's supported Ethereum network and fork ID.les: Light client synchronization protocol version.snap: Support for the snap sync protocol.- Custom Chain IDs: For other EVM-based networks. This allows clients to efficiently find peers that support the required protocols.
Node Identity & Security
ENR provides a cryptographically verifiable identity for each node. The Node ID is derived from a hash of the node's public key (e.g., using the secp256k1 scheme). This enables:
- Authentication: Any peer can verify the ENR's signature matches the advertised public key.
- Persistent Identity: A node's ID remains stable even if its IP address changes, as long as its key pair is unchanged.
- Trust in Peer Lists: Clients can cache and share signed ENRs, knowing they cannot be tampered with without detection.
Client Implementation & Usage
ENR handling is built into major Ethereum execution and consensus clients. Geth, Nethermind, Besu, and Erigon all implement Discv5 and use ENRs for peer discovery. In practice:
- Bootstrapping: Clients start with a list of bootstrap nodes (provided as ENRs or multiaddrs) to join the DHT.
- Peer Exchange: Nodes share ENRs of other peers they know about.
- Logs: The
enode://URL format is still commonly used in configuration, but clients internally convert and use the ENR for discovery. Tools likedevp2pcan inspect and generate ENRs for testing.
Comparison with Multiaddr & enode://
ENR succeeded the older enode:// URL scheme and multiaddr format used in Discovery v4. Key improvements are:
- Self-Certification: ENR is signed;
enode://was just plain text. - Extensibility: ENR's key-value pairs allow for new attributes;
enode://was limited to IP, ports, and public key. - Agility: The sequence number allows for secure, versioned updates to a node's information.
While
enode://is still used for static configuration, the active discovery protocol relies entirely on ENRs within Discv5.
Security Considerations
While ENRs are a core component of Ethereum's peer-to-peer networking, they introduce specific attack vectors and privacy concerns that node operators must manage.
Sybil Attacks & Identity Spoofing
An ENR's self-signed nature makes it vulnerable to Sybil attacks, where an adversary creates many fake node identities to eclipse a target or manipulate the network. Without a robust peer discovery and reputation system, malicious nodes can flood the network. Mitigation relies on protocols like Discv5, which includes distance-based routing to limit the impact of localized malicious peers.
Network Topology Exposure
ENRs publicly broadcast a node's IP address, TCP/UDP ports, and supported capabilities (e.g., eth, snap). This exposes the physical location and software stack, enabling:
- DDoS targeting of specific clients or geographies.
- Fingerprinting to track node activity over time.
- Eclipse attacks by attackers who map the network to surround a victim.
Privacy & Metadata Leakage
The optional eth field in an ENR can contain the node's current block hash and total difficulty. This metadata leak allows passive observers to:
- Determine chain synchronization status.
- Correlate node activity with blockchain events.
- Identify nodes on minority forks. Operators may omit this field for increased privacy.
Record Tampering & Replay Attacks
Although ENRs are cryptographically signed, the record itself is not encrypted in transit. Adversaries can:
- Intercept and replay old ENRs to present outdated network information.
- Man-in-the-Middle (MitM) attacks during the initial handshake if the connection is not secured (e.g., before TLS/Noise encryption is established in RLPx).
Implementation Bugs & Client Diversity
Vulnerabilities in ENR parsing or Discv5 implementation can lead to critical failures. Historical examples include memory exhaustion attacks via malformed packets. Client diversity is a security feature; an exploit affecting one client (e.g., Geth's ENR handling) has reduced impact if the network uses multiple clients like Nethermind, Besu, or Erigon.
Best Practices for Node Operators
To harden node security:
- Use firewalls to restrict P2P port access to known peers or trusted IP ranges.
- Regularly update client software to patch discovery protocol vulnerabilities.
- Consider using a proxy or anonymization network (like Tor) for the P2P layer, though this may impact latency.
- Monitor peer connections for sudden changes or suspicious ENR data.
Frequently Asked Questions (FAQ)
Ethereum Node Records (ENRs) are the standard format for node identity and metadata in the Ethereum network. This FAQ addresses common questions about their purpose, structure, and usage.
An Ethereum Node Record (ENR) is a standardized, self-certifying data structure that uniquely identifies a network node and advertises its capabilities and connection endpoints. It is the successor to the older RLPx discovery protocol's node information format. An ENR contains a cryptographic signature from the node's key, ensuring the data's authenticity and integrity. Core fields include the node's public key, IP address, TCP and UDP ports for discovery and communication, and a sequence number that increments with each update. ENRs are a foundational component of the Ethereum Node Discovery Protocol (Discv5), enabling secure and efficient peer discovery without central coordination.
Get In Touch
today.
Our experts will offer a free quote and a 30min call to discuss your project.