Skip to content

Commit b0c213d

Browse files
authored
caps/eth.md: update for EIP-7642 (eth/69) (#262)
This defines protocol version eth/69, adding changes from https://eips.ethereum.org/EIPS/eip-7642 Also added a few updates to bring the protocol spec up-to-date with the Prague fork.
1 parent 5713591 commit b0c213d

File tree

1 file changed

+123
-65
lines changed

1 file changed

+123
-65
lines changed

caps/eth.md

Lines changed: 123 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Ethereum Wire Protocol (ETH)
22

33
'eth' is a protocol on the [RLPx] transport that facilitates exchange of Ethereum
4-
blockchain information between peers. The current protocol version is **eth/68**. See end
4+
blockchain information between peers. The current protocol version is **eth/69**. See end
55
of document for a list of changes in past protocol versions.
66

77
### Basic Operation
@@ -10,9 +10,9 @@ Once a connection is established, a [Status] message must be sent. Following the
1010
of the peer's Status message, the Ethereum session is active and any other message may be
1111
sent.
1212

13-
Within a session, three high-level tasks can be performed: chain synchronization, block
14-
propagation and transaction exchange. These tasks use disjoint sets of protocol messages
15-
and clients typically perform them as concurrent activities on all peer connections.
13+
Within a session, two high-level tasks can be performed: chain synchronization and
14+
transaction exchange. These tasks use disjoint sets of protocol messages and clients
15+
typically perform them as concurrent activities on all peer connections.
1616

1717
Client implementations should enforce limits on protocol message sizes. The underlying
1818
RLPx transport limits the size of a single message to 16.7 MiB. The practical limits for
@@ -27,32 +27,46 @@ connection.
2727

2828
### Chain Synchronization
2929

30-
Nodes participating in the eth protocol are expected to have knowledge of the complete
31-
chain of all blocks from the genesis block to current, latest block. The chain is obtained
32-
by downloading it from other peers.
33-
34-
Upon connection, both peers send their [Status] message, which includes the Total
35-
Difficulty (TD) and hash of their 'best' known block.
36-
37-
The client with the worst TD then proceeds to download block headers using the
38-
[GetBlockHeaders] message. It verifies proof-of-work values in received headers and
39-
fetches block bodies using the [GetBlockBodies] message. Received blocks are executed
40-
using the Ethereum Virtual Machine, recreating the state tree and receipts.
41-
42-
Note that header downloads, block body downloads and block execution may happen
43-
concurrently.
44-
45-
### State Synchronization (a.k.a. "fast sync")
46-
47-
Protocol versions eth/63 through eth/66 also allowed synchronizing the state tree. Since
48-
protocol version eth/67, the Ethereum state tree can no longer be retrieved using the eth
49-
protocol, and state downloads are provided by the auxiliary [snap protocol] instead.
50-
51-
State synchronization typically proceeds by downloading the chain of block headers,
52-
verifying their validity. Block bodies are requested as in the Chain Synchronization
53-
section but transactions aren't executed, only their 'data validity' is verified. The
54-
client picks a block near the head of the chain (the 'pivot block') and downloads the
55-
state of that block.
30+
The chain is obtained by downloading it from other peers. It is generally expected that
31+
nodes respond to requests for headers, bodies, and receipts across the entire history
32+
range. However, due to the large size of the mainnet, it was decided that early chain
33+
history must be obtained in other ways, outside of the eth protocol, since it may not be
34+
possible for all nodes to store the full mainnet history in perpetuity and provide random
35+
access to it. As such, the protocol also provides means to announce the block range which
36+
is available from a peer. For the Ethereum mainnet, client implementations must deal with
37+
the absence of history on the eth protocol by either not syncing it at all, or by syncing
38+
it via alternative means.
39+
40+
Since Ethereum consensus happens outside of the 'execution chain', there is no builtin
41+
mechanism within this protocol to determine the canonical chain head. It is assumed that
42+
every node is aware of the canonical chain somehow, be it through communication with a
43+
consensus node, or by acting as a light client to the Ethereum consensus protocol.
44+
45+
With a known head of the chain, synchronization typically proceeds as follows: the node
46+
will first fetch headers from the head down to the genesis block, using [GetBlockHeaders].
47+
This process can be parallelized by first fetching a 'skeleton' structure of headers using
48+
the `skip` parameter, then filling in the gaps using multiple peers.
49+
50+
Once headers have been downloaded, the client can proceed to fetching the full blocks
51+
using [GetBlockBodies]. This can also utilize multiple peers since all block hashes are
52+
known from the header chain. Retrieved block bodies must be validated against the headers.
53+
The retrieved blocks are then executed by the EVM to obtain receipts and the state.
54+
55+
### State Synchronization (a.k.a. "fast sync", "snap sync")
56+
57+
Protocol versions eth/63 through eth/66 also allowed synchronizing the state tree.
58+
Starting with version eth/67, the Ethereum state tree can no longer be retrieved using the
59+
eth protocol, and state downloads are provided by the auxiliary [snap protocol] instead.
60+
61+
State synchronization typically proceeds by downloading the chain of block headers as
62+
above, Block bodies are requested as in the Chain Synchronization section but transactions
63+
aren't executed, only their 'data validity' is verified. The client picks a block near the
64+
head of the chain (the 'pivot block') and downloads the state of that block.
65+
66+
Since state synchronization does not execute transactions, the node wouldn't have any of
67+
the receipts of execution available after synchronizing the state. In order to participate
68+
fully in the p2p protocol, receipts also need to be downloaded during state
69+
synchronization using the [GetReceipts] message.
5670

5771
### Block Propagation
5872

@@ -172,12 +186,8 @@ operating under slightly different validation rules.
172186

173187
### Block Encoding and Validity
174188

175-
Ethereum blocks are encoded as follows:
189+
Ethereum block headers are encoded as follows:
176190

177-
block = [header, transactions, ommers]
178-
transactions = [tx₁, tx₂, ...]
179-
ommers = [header₁, header₂, ...]
180-
withdrawals = [withdrawal₁, withdrawal₂, ...]
181191
header = [
182192
parent-hash: B_32,
183193
ommers-hash: B_32,
@@ -196,12 +206,23 @@ Ethereum blocks are encoded as follows:
196206
block-nonce: B_8,
197207
basefee-per-gas: P,
198208
withdrawals-root: B_32,
209+
blob-gas-used: P,
210+
excess-blob-gas: P,
211+
parent-beacon-root: B_32,
212+
requests-hash: B_32,
199213
]
200214

201215
In certain protocol messages, the transaction and ommer lists are relayed together as a
202216
single item called the 'block body'.
203217

204218
block-body = [transactions, ommers, withdrawals]
219+
transactions = [tx₁, tx₂, ...]
220+
ommers = [header₁, header₂, ...]
221+
withdrawals = [withdrawal₁, withdrawal₂, ...]
222+
223+
For the purpose of block propagation (now defunct), full blocks were relayed as a combined item:
224+
225+
block = [header, transactions, ommers]
205226

206227
The validity of block headers depends on the context in which they are used. For a single
207228
block header, only the validity of the proof-of-work seal (`mix-digest`, `block-nonce`)
@@ -220,6 +241,11 @@ headers are processed in sequence during chain synchronization, the following ru
220241
no ommer headers can exist.
221242
- `withdrawals-root` must be present in headers after the [Shanghai fork]. The field must
222243
be absent for blocks before the fork. This rule was added by [EIP-4895].
244+
- `blob-gas-used`, `excess-blob-gas`, `parent-beacon-root`, must be present in headers
245+
after the [Cancun fork], and absent for earlier blocks. This rule was
246+
added by [EIP-4844] and [EIP-4788].
247+
- `requests-hash` must be present in headers after the Prague fork, and absent for
248+
earlier blocks. This rule was added by [EIP-7685].
223249

224250
For complete blocks, we distinguish between the validity of the block's EVM state
225251
transition, and the (weaker) 'data validity' of the block. The definition of state
@@ -251,39 +277,32 @@ disconnect peers sending invalid blocks.
251277

252278
### Receipt Encoding and Validity
253279

254-
Receipts are the output of the EVM state transition of a block. Like transactions,
255-
receipts have two distinct encodings and we will refer to either encoding using the
256-
identifier `receiptₙ`.
257-
258-
receipt = {legacy-receipt, typed-receipt}
280+
Receipts are the output of the EVM state transition of a transaction. They are made
281+
available for the purpose of syncing the chain without re-executing transactions. All
282+
receipts have the same encoding regardless of transaction type.
259283

260-
Untyped, legacy receipts are encoded as follows:
261-
262-
legacy-receipt = [
263-
post-state-or-status: {B_32, {0, 1}},
284+
receiptₙ = [
285+
tx-type: P,
286+
post-state-or-status: B,
264287
cumulative-gas: P,
265-
bloom: B_256,
266-
logs: [log₁, log₂, ...]
288+
logs: [log₁, log₂, ...],
267289
]
268-
log = [
269-
contract-address: B_20,
290+
logₙ = [
291+
address: B_20,
270292
topics: [topic₁: B, topic₂: B, ...],
271-
data: B
293+
data: B,
272294
]
273295

274-
[EIP-2718] typed receipts are encoded as RLP byte arrays where the first byte gives the
275-
receipt type (matching `tx-type`) and the remaining bytes are opaque data specific to the
276-
type.
277-
278-
typed-receipt = tx-type || receipt-data
279-
280296
In the Ethereum Wire Protocol, receipts are always transferred as the complete list of all
281297
receipts contained in a block. It is also assumed that the block containing the receipts
282298
is valid and known. When a list of block receipts is received by a peer, it must be
283299
verified by computing and comparing the merkle trie hash of the list against the
284-
`receipts-root` of the block. Since the valid list of receipts is determined by the EVM
285-
state transition, it is not necessary to define any further validity rules for receipts in
286-
this specification.
300+
`receipts-root` of the block. Note that in order to perform this verification, the
301+
receipts need to be re-encoded into the format used by the Ethereum consensus protocol,
302+
and their bloom filters have to be recomputed.
303+
304+
Since the valid list of receipts is determined by the EVM state transition, it is not
305+
necessary to define any further validity rules for receipts in this specification.
287306

288307
## Protocol Messages
289308

@@ -293,18 +312,24 @@ peer must mirror the value in the `request-id` element of the response message.
293312

294313
### Status (0x00)
295314

296-
`[version: P, networkid: P, td: P, blockhash: B_32, genesis: B_32, forkid]`
315+
`[vsn: P, networkid: P, genesis: B_32, forkid, earliest: P, latest: P, latestHash: B_32]`
297316

298-
Inform a peer of its current state. This message should be sent just after the connection
299-
is established and prior to any other eth protocol messages.
317+
This is the initial message, informing the peer about the local node state and
318+
configuration. This message should be sent just after the connection is established and
319+
prior to any other eth protocol messages.
300320

301-
- `version`: the current protocol version
321+
- `vsn`: the current protocol version
302322
- `networkid`: integer identifying the blockchain, see table below
303-
- `td`: total difficulty of the best chain. Integer, as found in block header.
304-
- `blockhash`: the hash of the best (i.e. highest TD) known block
305323
- `genesis`: the hash of the genesis block
306324
- `forkid`: An [EIP-2124] fork identifier, encoded as `[fork-hash, fork-next]`.
307325

326+
The Status message also announces the available block range. See [BlockRangeUpdate] for
327+
more information.
328+
329+
- `earliest`: number of the earliest available full block
330+
- `latest`: number of the latest available full block number
331+
- `latestHash`: hash of the latest available full block
332+
308333
This table lists common Network IDs and their corresponding networks. Other IDs exist
309334
which aren't listed, i.e. clients should not require that any particular network ID is
310335
used. Note that the Network ID may or may not correspond with the EIP-155 Chain ID used
@@ -464,8 +489,35 @@ contain the complete list of receipts of the block.
464489

465490
The recommended soft limit for Receipts responses is 2 MiB.
466491

492+
### BlockRangeUpdate (0x11)
493+
494+
`[earliest: P, latest: P, latestHash: B_32]`
495+
496+
This is a notification about a change in the available block range on a peer.
497+
498+
With this message, the peer announces that all blocks `b` with `earliest >= b >= latest`
499+
are available via [GetBlockBodies], and also that receipts for these blocks are available
500+
via [GetReceipts]. Headers are always assumed to be available for the full range of blocks
501+
from genesis.
502+
503+
The notification doesn't need to be sent for every update to the node's head block. It is
504+
recommended to send an update about once every two minutes. Clients should validate
505+
received updates.
506+
507+
- If `earliest > latest`, the peer should be disconnected.
508+
- Updates can be used to detect the condition where a node is surrounded by syncing peers.
509+
At the same time, client implementations must take care to not disconnect all syncing
510+
peers purely on the basis of their BlockRangeUpdate.
511+
467512
## Change Log
468513

514+
### eth/69 ([EIP-7642], April 2025)
515+
516+
Version 69 changed the [Status] message to include information about the available block
517+
range. A new [BlockRangeUpdate] message was added to notify peers about changes in block
518+
range. The [Receipts] message was changed to simplify the encoding of typed receipts and
519+
to remove the bloom filter.
520+
469521
### eth/68 ([EIP-5793], October 2022)
470522

471523
Version 68 changed the [NewPooledTransactionHashes] message to include types and sizes of
@@ -556,7 +608,7 @@ Version numbers below 60 were used during the Ethereum PoC development phase.
556608
- `0x1c` for PoC-6
557609

558610
[block propagation]: #block-propagation
559-
[state synchronization]: #state-synchronization-aka-fast-sync
611+
[state synchronization]: #state-synchronization-aka-fast-sync-snap-sync
560612
[snap protocol]: ./snap.md
561613
[Status]: #status-0x00
562614
[NewBlockHashes]: #newblockhashes-0x01
@@ -571,6 +623,7 @@ Version numbers below 60 were used during the Ethereum PoC development phase.
571623
[PooledTransactions]: #pooledtransactions-0x0a
572624
[GetReceipts]: #getreceipts-0x0f
573625
[Receipts]: #receipts-0x10
626+
[BlockRangeUpdate]: #blockrangeupdate-0x11
574627
[RLPx]: ../rlpx.md
575628
[EIP-155]: https://eips.ethereum.org/EIPS/eip-155
576629
[EIP-1559]: https://eips.ethereum.org/EIPS/eip-1559
@@ -581,10 +634,15 @@ Version numbers below 60 were used during the Ethereum PoC development phase.
581634
[EIP-2718]: https://eips.ethereum.org/EIPS/eip-2718
582635
[transaction types]: https://eips.ethereum.org/EIPS/eip-2718
583636
[EIP-2976]: https://eips.ethereum.org/EIPS/eip-2976
637+
[EIP-4788]: https://eips.ethereum.org/EIPS/eip-4788
584638
[EIP-4895]: https://eips.ethereum.org/EIPS/eip-4895
639+
[EIP-4844]: https://eips.ethereum.org/EIPS/eip-4844
585640
[EIP-4938]: https://eips.ethereum.org/EIPS/eip-4938
586641
[EIP-5793]: https://eips.ethereum.org/EIPS/eip-5793
642+
[EIP-7642]: https://eips.ethereum.org/EIPS/eip-7642
643+
[EIP-7685]: https://eips.ethereum.org/EIPS/eip-7685
587644
[The Merge]: https://eips.ethereum.org/EIPS/eip-3675
588645
[London hard fork]: https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/london.md
589646
[Shanghai fork]: https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/shanghai.md
647+
[Cancun fork]: https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/cancun.md
590648
[Yellow Paper]: https://ethereum.github.io/yellowpaper/paper.pdf

0 commit comments

Comments
 (0)