EIP-7956 Transaction ordering based on block randomness (Tx Ordering via Block-level Randomness)
No call decision · Security & privacy · EIP status Stagnant · created 2025-05-24
Changes the consensus rule so that, to prevent builders from freely choosing the order of transactions within a block, ordering is instead determined by XORing each transaction hash with a randomness value newly revealed each slot.
Why it is needed
Currently, the proposer and builder who construct a block can arrange pending transactions in any order. This freedom is the core cause of reordering-based MEV (maximal extractable value), such as sandwich attacks and frontrunning. Bots see a user's transaction and insert their own transactions before and after it to capture profit. This EIP builds the ordering rule itself into the protocol. Because the order is determined by a randomness value that nobody knows before the slot begins, it becomes difficult to attack by securing an advantageous position in advance. The source cites academic research showing that deterministic ordering drives sandwich profits close to zero, while noting that other kinds of MEV based on latency competition, such as backrunning or censorship, still remain, so complementary techniques such as encrypted mempools are still needed.
What changes
Today
- Builders and proposers can arbitrarily change the order of transactions within a block
- Sandwich attacks and frontrunning that exploit order manipulation are possible
- The protocol does not verify the legitimacy of the ordering
After EIP-7956
- Builders still choose which transactions to include, but once chosen, the order is automatically determined by the randomness value and hash
- Blocks with an order that does not match the rule become invalid, and all nodes objectively filter them out
- Reordering-based MEV is greatly reduced, but other MEV such as backrunning and censorship remains
Who is affected
- Users: Reduces exposure to sandwich attacks and frontrunning that manipulate transaction order to extract profit.
- Builders/MEV bots: Selecting the candidate set remains as free as before, but strategies that profit from reordering after selection can no longer be used.
- Client teams: The randomness and txOrderingVersion fields in the execution payload, along with the ordering verification logic, must be implemented in the consensus and execution clients.
- Node operators: If you do not upgrade within the transition period, your node will reject new-version blocks and fork off the chain.
In depth
Definition of the slot randomness R
R is the first 32 bytes of each slot's randao_reveal (R = body.randao_reveal[0:32], bytes32). This EIP assumes EIP-7998, because after 7998, randao_reveal provides slot-level randomness that is predictable only to the builder. The Rationale section explains that XOR-mixing the slot-level RANDAO with the proposer's VRF output closes the classic frontrunning window, since neither users nor builders can know the final ordering key before the slot starts. XOR was chosen as the mixing function because it is fast, requires no additional cryptographic assumptions beyond the hash already used for H(tx), and cancels out bias in one entropy source (e.g. RANDAO) as long as the attacker cannot also control the VRF output.
Builder flow and the ordering key
The builder MAY first select any subset of the mempool as candidates based on priority fees, side contracts, or its own policy. The chosen set is sorted by the primary key H(tx) XOR R in ascending order, with ties on the primary key broken by the secondary key H(tx) in ascending order. Transactions are then packed in that order until the block gas limit would be exceeded. This design separates the role of fees: priority fees affect whether a transaction enters the candidate set (stage 1), but can never change the ordering once selected. This preserves the fee-market incentive where higher tips win inclusion competition, while avoiding the low-value spam inclusion problem that would arise from force-sorting the entire mempool.
Bundles: atomic execution across addresses
A bundle is a list of user-signed, fully signed transactions that begins with a fee-paying transaction covering the gas and builder tip for the whole bundle. For sorting purposes, the bundle is treated as a single virtual transaction whose key is computed as H(concat(child_tx_rlps)). Each child_tx_rlp must be the canonical RLP of a fully signed transaction per the EIP-2718 and EIP-155 rules exactly as is (including the type byte and length prefix), and the signature fields (v, r, s) MUST NOT be stripped or normalized. The concatenation order is the execution order declared by the author. Bundle gas is the sum of the child transactions' gasLimit, and if it exceeds the remaining gas limit, the entire bundle is atomically skipped (fit-or-skip). This rule ensures every client computes the same gas impact and prevents partial execution that would break user intent. Bundles are made explicit instead of relying on nonce chains because atomicity across transactions from different addresses, such as a lender/borrower pair, cannot be expressed through nonce ordering.
Consensus rule and performance
If the executed transaction list differs from the canonical order derived from the block's randomness and the included transactions and bundles, the block is invalid. Validation is objective, so every validator can cheaply check it against the same value, and fork choice is unaffected. On performance, the source states that sorting 1,500 or fewer transactions is O(n log n), taking under 1ms on current hardware. The secondary tie-breaking key H(tx) requires no additional field since every node already knows it, and the hash collision probability of 2^-256 is negligible, guaranteeing a total order.
Deployment procedure and transition period
A randomness field and a txOrderingVersion = 1 flag are added to the execution payload. There are two fork parameters. ORDERING_FORK_EPOCH is the beacon chain epoch at which execution clients begin recognizing the new fields, and ORDERING_TRANSITION_EPOCHS is the transition period during which both block versions are accepted, set to 64 epochs (about 13.6 hours). Both are fork-configuration constants and may be adjusted through testnet experiments. In the activation flow, the beacon chain fork first turns on the companion EIP EL-VRF-exposure and begins populating the vrf_output_proposer field. Builders and proposers include the new fields in Engine API engine_newPayloadV3 calls. During the transition period, both version-0 blocks (no randomness, legacy ordering) and version-1 blocks (valid randomness, canonical ordering enforced) are accepted. Once the transition period ends, blocks must have txOrderingVersion == 1 and pass canonical order validation, and any subsequent version-0 block is treated as invalid.
Security: randomness manipulation and hash grinding
After EIP-7998, a single validator cannot change its own randao_reveal output, and only that validator can know it in advance. A coalition of consecutive-slot proposers could try to influence RANDAO by withholding signatures, but the protocol already slashes double-signing and missed attestations, the cost grows exponentially with coalition size, and VRF entropy further randomizes R. Reorgs deeper than 1 must clear the normal finality threshold, and because R is embedded in the execution payload, every node can objectively detect a fork conflict. Hash grinding, that is, an attack that reconstructs a transaction until a desired ordering key emerges, requires a new signature only when calldata changes, but it can only begin after the block is already produced, so propagation delay and inclusion fees sharply limit profitability to high-value trades. Meanwhile, backrunning and latency races remain unchanged, and builders can still censor or selectively include transactions when assembling the candidate set, exactly as on Ethereum today.
Current status: Stagnant
This EIP's source status is Stagnant, meaning the proposal has no ongoing activity. There is no record of a core developer call deciding to include it in a fork. If discussion resumes, the specification details (field layout, fork parameter values, etc.) may change, or the proposal itself may be abandoned, so the content here should be read as a proposal-stage design, not a finalized protocol change.