EIP-4938 · Final · Networking · 2022-03-23
EIP-4938: eth/67 - Removal of GetNodeData
Defines eth/67, the version of Ethereum's peer-to-peer wire protocol that removes the GetNodeData and NodeData messages, because modern clients no longer store state in a way that can serve them.
What problem does it solve?
Ethereum clients talk to each other over the eth wire protocol. Since eth/63, it included GetNodeData / NodeData: ask a peer for any state trie node or contract code by its hash. This powered "fast sync", which downloads state node by node instead of executing every historical block.
To answer such a request, a client must keep a database that maps every trie node hash to the node itself. Newer storage designs keep state in a different layout (for example, flat or path-based storage) and simply cannot look nodes up by hash. Some clients therefore could not serve GetNodeData at all. The protocol should only contain messages every client can implement.
How it works
eth/67 is eth/66 minus two messages:
| Message | Code | eth/66 shape |
|---|---|---|
GetNodeData |
0x0d |
[request_id, [hash_0, hash_1, ...]] |
NodeData |
0x0e |
[request_id, [value_0, value_1, ...]] |
Nothing else changes. The replacement lives in the separate snap protocol: GetByteCodes fetches contract code and GetTrieNodes fetches trie nodes by path. Snap can implement fast sync, though the spec recommends using it for snap sync.
Because devp2p negotiates protocol versions per connection, peers can support eth/66 and eth/67 side by side. Older clients are not cut off immediately; they keep talking eth/66.
Sample code
Capability negotiation as a client might advertise it during the devp2p Hello handshake (illustrative):
{
"capabilities": [
{ "name": "eth", "version": 66 },
{ "name": "eth", "version": 67 },
{ "name": "snap", "version": 1 }
]
}
Handling an incoming message on an eth/67 session (illustrative pseudocode; exact peer handling is client-specific):
GET_NODE_DATA = 0x0d
NODE_DATA = 0x0e
def on_eth_message(session, code, payload):
if session.eth_version >= 67 and code in (GET_NODE_DATA, NODE_DATA):
session.disconnect("invalid message for eth/67")
return
dispatch(code, payload)
Things to know
- Status: Final. It is a networking change only: no consensus rules change and no hard fork is required.
- It builds on EIP-2464 (eth/65) and EIP-2481 (eth/66 request IDs). The next version, eth/68 (EIP-5793), adds transaction types to transaction announcements.
- Any tooling that fetched state with
GetNodeDataneeds to switch to the snap protocol or to RPC. - The
ethprotocol specification itself lives in the devp2p repository; the EIP records the change.