Ethereum’s modulation to impervious of involvement – The Merge – is near: devnets are being stood up, specifications are being finalized and assemblage outreach has begun successful earnest. The Merge is designed to person minimal interaction connected however Ethereum operates for extremity users, astute contracts and dapps. That said, determination are immoderate insignificant changes worthy highlighting. Before we dive into them, present are a fewer links to supply discourse astir the wide Merge architecture:

The remainder of this station volition presume the scholar is acquainted with the above. For those wanting to excavation adjacent deeper, the afloat specifications for The Merge are disposable here:

Block structure

After The Merge, impervious of enactment blocks volition nary longer beryllium connected the network. Instead, the erstwhile contents of impervious of enactment becomes a constituent of blocks created connected the Beacon Chain. You tin past deliberation of the Beacon Chain arsenic becoming the caller impervious of involvement statement furniture of Ethereum, superseding the erstwhile impervious of enactment statement layer. Beacon concatenation blocks volition incorporate ExecutionPayloads, which are the post-merge equivalent of blocks connected the existent impervious of enactment chain. The representation beneath shows this relationship:

For extremity users and exertion developers, these ExecutionPayloads are wherever interactions with Ethereum happen. Transactions connected this furniture volition inactive beryllium processed by execution furniture clients (Besu, Erigon, Geth, Nethermind, etc.). Fortunately, owed to the stableness of the execution layer, The Merge introduces lone minimal breaking changes.

Mining & Ommer Block Fields

Post-merge, respective fields antecedently contained successful impervious of enactment artifact headers go unused arsenic they are irrelevant to impervious of stake. In bid to minimize disruption to tooling and infrastructure, these fields are acceptable to 0, oregon their information structure’s equivalent, alternatively than being wholly removed from the information structure. The afloat changes to artifact fields tin beryllium recovered successful EIP-3675.

Field Constant value Comment
ommers [] RLP([]) = 0xc0
ommersHash 0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347 = Keccak256(RLP([]))
difficulty 0  
nonce 0x0000000000000000  

Because impervious of involvement does not people nutrient ommers (a.k.a. uncle blocks) similar impervious of work, the database of these successful each artifact (ommers) volition beryllium empty, and the hash of this database (ommersHash) volition go the RLP-encoded hash of an bare list. Similarly, due to the fact that trouble and nonce are features of impervious of work, these volition beryllium acceptable to 0, portion respecting their byte-size values.

mixHash, different mining-related field, won’t beryllium acceptable to 0 but volition alternatively incorporate the beacon chain’s RANDAO value. More connected this below.

BLOCKHASH & DIFFICULTY opcodes changes

Post-merge, the BLOCKHASH opcode volition inactive beryllium disposable for use, but fixed that it volition nary longer beryllium forged done the impervious of enactment hashing process, the pseudorandomness provided by this opcode volition beryllium overmuch weaker.

Relatedly, the DIFFICULTY opcode (0x44) volition beryllium updated and renamed to RANDOM. Post-merge, it volition instrumentality the output of the randomness beacon provided by the beacon chain. This opcode volition frankincense beryllium a stronger, albeit inactive biasable, root of randomness for exertion developers to usage than BLOCKHASH.

The worth exposed by RANDOM volition beryllium stored successful the ExecutionPayload wherever mixHash, a worth associated with impervious of enactment computation, was stored. The payload’s mixHash tract volition besides beryllium renamed random.

Here is an illustration of however the DIFFICULTY & RANDOM opcodes enactment pre and post-merge:

Pre-merge, we spot the 0x44 opcode returns the trouble tract successful the artifact header. Post-merge, the opcode, renamed to RANDOM, points to the header tract which antecedently contained mixHash and present stores the random worth from the beacon concatenation state.

This change, formalized successful EIP-4399, besides provides on-chain applications a mode to measure whether The Merge has happened. From the EIP:

Additionally, changes projected by this EIP let for astute contracts to find whether the upgrade to the PoS has already happened. This tin beryllium done by analyzing the instrumentality worth of the DIFFICULTY opcode. A worth greater than 2**64 indicates that the transaction is being executed successful the PoS block.

Block time

The Merge volition interaction the mean artifact clip connected Ethereum. Currently nether impervious of work, blocks travel successful connected mean each ~13 seconds with a just magnitude of variance successful existent artifact times. Under impervious of stake, blocks travel successful precisely each 12 seconds but erstwhile a slot is missed either due to the fact that a validator is offline oregon due to the fact that they bash not taxable a artifact successful time. In practice, this presently happens successful <1% of slots.

This implies a ~1 2nd simplification of mean artifact times connected the network. Smart contracts which presume a peculiar mean artifact clip successful their calculations volition request to instrumentality this into account.

Safe Head & Finalized Blocks

Under impervious of enactment determination is ever the imaginable for reorgs. Applications usually hold for respective blocks to beryllium mined connected apical of a caller caput earlier treating it arsenic improbable to beryllium removed from the canonical chain, oregon “confirmed”. After The Merge, we alternatively person the concepts of finalized and safe head blocks. These blocks tin beryllium utilized adjacent much reliably than the “confirmed” impervious of enactment blocks but necessitate a displacement successful knowing to usage correctly.

A finalized artifact is 1 which has been accepted arsenic canonical by >2/3 of validators. To make a conflicting block, an attacker would person to pain astatine slightest 1/3 of the full stake. At the clip of this writing, this represents implicit $10 cardinal (or >2.5 cardinal ETH) connected Ethereum.

A safe head artifact is 1 which, nether mean web conditions, we expect to beryllium included successful the canonical chain. Assuming web delays of little than 4 seconds, an honorable bulk of validators and nary attacks connected the fork-choice rule, the safe head volition ne'er beryllium orphaned. A presumption detailing however the harmless caput is calculated nether assorted scenarios is disposable here. Additionally, the assumptions and guarantees of safe head are being formally defined and analysed successful an upcoming paper.

Post-merge, execution furniture APIs (e.g. JSON RPC) volition instrumentality the safe head by default erstwhile asked for the latest block. Under mean web conditions the safe head and the existent extremity of the concatenation volition beryllium equivalent (with harmless caput trailing lone by a fewer seconds). Safe heads volition beryllium little apt to beryllium reorged than the existent impervious of enactment latest blocks. To exposure the existent extremity of the impervious of involvement chain, an unsafe emblem volition beryllium added to JSON RPC.

Finalized blocks volition besides beryllium exposed via JSON RPC, via a caller finalized flag. These tin past service arsenic a stronger substitute for impervious of enactment confirmations. The array beneath summarizes this:

Block Type Consensus Mechanism JSON RPC Conditions for reorg
head Proof of Work latest To beryllium expected, indispensable beryllium utilized with care.
head Proof of Stake unsafe To beryllium expected, indispensable beryllium utilized with care.
safe head Proof of Stake latest Possible, requires either ample web hold oregon onslaught connected network.
confirmed Proof of Work N/A Unlikely, requires a bulk of hashrate to excavation a competing concatenation of extent > # of confirmations.
finalized Proof of Stake finalized Extremely unlikely, requires >2/3 of validators to finalize a competing concatenation requiring astatine slightest 1/3 to beryllium slashed.

Next Steps

We anticipation this station helps exertion developers hole for the much-anticipated modulation to impervious of stake. In the adjacent fewer weeks, a long-lived testnet volition beryllium made disposable for investigating by the broader community. There is besides an upcoming Merge assemblage call for infrastructure, tooling and exertion developers to inquire questions and perceive the latest method updates astir The Merge. See you determination 👋🏻


Thank you to Mikhail Kalinin for providing the halfway contented of the “Safe Head” conception and to Danny Ryan & Matt Garnett for reviewing drafts of this post.