Proposers and builders can currently permute pending transactions arbitrarily, enabling reorderâdriven MEV. This EIP introduces a consensus rule that sorts all transactions inside a block by XORâing each transaction hash with fresh slot randomness. The randomness is unknown until the slot starts, so the order is deterministic once known but unpredictable beforehand. The mechanism significantly reduces reorderâbased MEV; latencyâdriven backârunning, censorship, and other classes of MEV remain and should be mitigated through complementary techniques (encrypted mempools, reputation, PBS marketplaces, etc.).
Motivation
Unrestricted ordering is the key enabler of sandwich and classic frontârunning attacks. Deterministic ordering collapses these vectors to latency racing and information asymmetry. Clear candidateâset and bundle semantics preserve fee markets while removing the need for trusted sequencers. Academic works shows deterministic ordering drives sandwich profits toward zero.
References
Julia Ofoegbu, âMaximal Extractable Value (MEV): A Tale As Old As Time,â Medium (2024).
J. Qian etâŻal., âDeterministic Transaction Ordering Without Trusted Sequencers,â arXiv:2411.03327 v1 (2024).
âShutter Network Introduces Plan for First Encrypted Mempool on Ethereum,â GlobeNewswire, 13âŻFebâŻ2025.
Specification
The key words âMUSTâ, âMUST NOTâ, âREQUIREDâ, âSHALLâ, âSHALL NOTâ, âSHOULDâ, âSHOULD NOTâ, âRECOMMENDEDâ, âNOT RECOMMENDEDâ, âMAYâ, and âOPTIONALâ in this document are to be interpreted as described in RFC 2119 and RFC 8174.
Slot Randomness R
We define our randomness R as the randao_reveal of the each slot, after EIP-7998, since this EIP provides slot-by-slot randomness for randao_reveal (only predictable for the builder). This provides enough randomness for our purpose of reducing MEV attacks by MEV bots.
R = body.randao_reveal[0:32] : bytes32
Builder Flow
Candidateâset selection â Builders MAY choose any subset of the mempool based on priority fees, side agreements, or policy. Transactions not chosen are ignored.
Canonical sorting â Sort the chosen set by primary key H(tx) â R ascending, then secondary key H(tx) ascending, in case of collision on the primary key.
Gasâlimit packing â Append items in order until adding the next would exceed the block gas limit.
Bundles (optional crossâaddress atomicity)
Definition â A bundle is a userâsigned list of fullyâsigned transactions. Each child_tx_rlp is the canonical signed RLP encoding, including signature fields (v, r, s). The bundle begins with a feeâpayment transaction that covers gas and builder tip for the entire bundle.
Hashing / sort key â Treat the bundle as a virtual transaction with key H(concat(child_tx_rlps)), where:
child_tx_rlps[i]MUST be the exact bytes that will later appear in the block body for that transaction, i.e. the canonical RLP of the fullyâsigned transaction per EIPâ2718 / EIPâ155 rules (for typed transactions the leading type byte and length prefix are included).
Implementations MUST NOT strip or normalise the signature fields (v,r,s); those 65 bytes are hashed asâis so every participant derives an identical bundle key.
The concatenation order is the authorâdeclared execution order of the child transactions.
Gas accounting â Bundle gas is the sum of the gasLimit fields of all child transactions. Builders use that sum when evaluating step 3.
Fitâorâskip rule â If the bundle (feeâpayment + children) would exceed the remaining gas limit, the bundle is skipped atomically.
Fee dynamics â Priority fees influence membership in the candidate set (step 1) but never override the canonical order once a tx or bundle is selected.
Here is a pseudocode for the above flow:
//---------------------------------------------------------------------
// Inputs
//---------------------------------------------------------------------
// mempool : All pending txs & user-signed bundles visible to the builder
// R : 32-byte slot randomness supplied by randao_reveal
// BLOCK_GAS_LIMIT : Max gas allowed in the block
//---------------------------------------------------------------------
// Helper functions
//---------------------------------------------------------------------
function HASH(obj) â bytes32 // Keccak-256 of the byte sequence
function PRIMARY_KEY(h, R) â bytes32 // h XOR R (bit-wise)
function bundleGas(bundle): // sum of gasLimit of children
total â 0
for childTx in bundle.children:
total â total + childTx.gasLimit
return total
//---------------------------------------------------------------------
// 0. Candidate-set selection (builder policy / side deals / fee filter)
//---------------------------------------------------------------------
candidates â pickSubsetFrom(mempool) // ANY subset is allowed
//---------------------------------------------------------------------
// 1. Compute canonical keys & gas cost for every candidate
//---------------------------------------------------------------------
for item in candidates:
if item.type == "single_tx":
item.gasCost â item.gasLimit
baseHash â HASH(item.RLP) // canonical signed RLP (EIP-2718)
else if item.type == "bundle":
concatRlps â CONCAT(item.child_rlps) // fee-tx + children in author order
item.gasCost â bundleGas(item)
baseHash â HASH(concatRlps)
item.primaryKey â PRIMARY_KEY(baseHash, R)
item.secondaryKey â baseHash
//---------------------------------------------------------------------
// 2. Canonical sorting (primaryKey asc, then secondaryKey asc)
//---------------------------------------------------------------------
sort(candidates, by = (primaryKey ASC, secondaryKey ASC))
//---------------------------------------------------------------------
// 3. Gas-limit packing with fit-or-skip for bundles
//---------------------------------------------------------------------
blockList â empty list
gasUsed â 0
for item in candidates:
if gasUsed + item.gasCost > BLOCK_GAS_LIMIT:
continue // skip whole tx or bundle atomically
append(blockList, item)
gasUsed â gasUsed + item.gasCost
//---------------------------------------------------------------------
// 4. Output â assemble block body & header field
//---------------------------------------------------------------------
block.randomness â R // bytes16 in the payload header
block.txOrderingVersion â 1
block.body â flatten(blockList) // bundles explode into children
return block
Consensus Rule
A block is invalid if the executed list deviates from the canonical order derived from its randomness and the included transactions/bundles. Verification is objective; forkâchoice remains unchanged.
txOrderingVersion = 1 flag: To be compatible with the existing consensus rule and adding compatibility for future rules if needed.
Fork Parameters
ORDERING_FORK_EPOCH: Beaconâchain epoch at which execution clients start to recognise the new fields randomness and txOrderingVersion.
ORDERING_TRANSITION_EPOCHS window activate the rule: 64 epochs (~13.6 h). Length of the transition window during which blocks with either ordering version are accepted.
Both parameters are constants in the fork config and may be tuned during testânet experiments.
Activation Flow
Consensusâlayer upgrade â Beaconâchain fork at ORDERING_FORK_EPOCH activates ELâVRFâexposure (companion EIP) and begins populating the vrf_output_proposer field. Execution clients receiving the ExecutePayload after this epoch expect a nonâzero randomness field.
Executionâlayer handshake â Builders and proposers include the new randomness and txOrderingVersion fields in Engine API engine_newPayloadV3 calls. Legacy nodes that have not upgraded will reject the payload, causing a natural chain split and economic incentive to upgrade.
Transition window â For ORDERING_TRANSITION_EPOCHS after ORDERING_FORK_EPOCH, clients accept:
Version 0 blocks â txOrderingVersion == 0; no randomness; legacy ordering.
Version 1 blocks â txOrderingVersion == 1; valid randomness; canonical ordering enforced. During this period proposers are encouraged (but not forced) to adopt version 1 so that fee markets and MEV supply chains have time to adjust.
Finalisation â At ORDERING_FORK_EPOCH + ORDERING_TRANSITION_EPOCHS the consensus rule changes: blocks MUST set txOrderingVersion == 1 and pass canonicalâorder validation. A versionâ0 block after this point is treated as invalid and will not be considered by forkâchoice.
Rationale
Why randomnessâdriven ordering?
Objective & Verifiable â Using a function of onâchain randomness (R) and a transactionâs own hash gives every validator an identical, cheap check on order validity.
Unpredictable Until Slot Start â The XOR of slotâlevel RANDAO and the proposerâs VRF output ensures that neither users nor builders can know the final sort key before the slot begins, closing the classic frontârun window.
Minimal Surface Area â A single 16âbyte field in the execution payload plus a hash operation keeps consensus changes small and auditable.
Why XOR as the mixing function?
XOR is associative, fast, and requires no extra cryptographic assumptions beyond SHAâ2 already used for H(tx).
Any bias in one entropy component (e.g., RANDAO) is negated unless the attacker also controls the VRF output.
Why allow builders to curate the candidate set first?
Preserves feeâmarket incentives: highâtip transactions still rise to the top of inclusion competition.
Avoids forced inclusion of lowâvalue spam that could bloat blocks if the entire mempool were blindly sorted.
Why a secondary key H(tx) for tieâbreaking?
Guarantees total order with negligible extra cost.
Leverages a value already known to every node; no extra field is needed.
Why optional bundles instead of implicit nonceâchain folding?
Crossâaddress atomicity (e.g., borrower + lender tx pair) cannot be expressed via nonce order alone.
Requiring an explicit feeâpayment transaction embeds pricing for the externality a bundle imposes on ordering neutrality.
Why the âfitâorâskipâ bundle rule?
Ensures all clients compute the same gas impact, preventing divergent execution.
Avoids partial bundle execution, which would undermine user intent.
Why the version flag + transition window?
Prevents accidental consensus splits by giving node operators a grace period.
Mirrors previous successful hard forks (e.g., Londonâs BASE_FEE activation sequence).
Backwards Compatibility
Old nodes â Execution clients that ignore the new fields will treat versionâ1 blocks as malformed and fork away. The short transition window gives operators time to upgrade.
Light clients â No additional work; they track headers chosen by upgraded full nodes.
Security Considerations
Randomness Bias & RANDAO Manipulation
Singleâvalidator bias â A block proposer can not change its randao_reveal output after EIP-7998, only predictable to him.
Coalition bias â Multiple consecutiveâslot proposers could attempt to influence RANDAO by withholding signatures, but the protocol already slashes equivocation and missed attestations. The cost rises exponentially with coalition size, and the added VRF entropy further randomizes R.
Forkable bias â Reâorg attempts longer than depth 1 must overcome the usual consensus finality thresholds. Because R is embedded in the execution payload, any fork conflicts are objectively detectable by all nodes.
Conclusion: Collusion attacks are economically unattractive; the mixed entropy from RANDAO and VRF provides strong unpredictability guarantees.
Hash Grinding
New signatures are required only when calldata changes, but attacks must begin after block is built. Propagation delays and inclusion fees sharply limit profitable grinding to highâvalue trades.
Tie Collisions
Secondary key H(tx) guarantees total order; collision probability (2^{-256}) is negligible.
Bundle Gas Consistency
Explicit summation rule ensures every client computes identical gas usage for bundles, preventing divergent validation.
Residual MEV Vectors
Backârunning & latency â Persist.
Builder discretion â Builders may censor or selectively include transactions while forming the candidate set; exactly like the current status of Ethereum.