EIP-7793 · Stagnant · Core · 2024-10-17
EIP-7793: Conditional Transactions
Proposes a transaction type that is only valid at a specific slot and position in the block, plus a TXINDEX opcode, so encrypted mempools can stop builders from reordering decrypted transactions.
What problem does it solve?
Encrypted mempools aim to prevent front-running: transactions are ordered while still encrypted, then decrypted and placed at the top of the block. The weak point is the last step. A block builder who sees the decrypted contents could reorder them or insert its own transactions in between.
EIP-7793 makes the agreed order enforceable by the protocol. A transaction can declare exactly which slot and which index in the block it must land at; anywhere else, it is invalid.
How it works
- New transaction type
0x05(EIP-2718 envelope). Its fields mirror the EIP-4844 blob transaction, with two additions:conditional_slotandconditional_tx_index(bothuint64).blob_versioned_hashesmay be empty. - Validity rule. The transaction is valid only if included in that slot and at that index. The slot check relies on EIP-7843, which adds the slot number to the block header. A value of
-1in either field disables that check. - Signature is over
keccak256(0x05 || rlp([...all fields except y_parity, r, s])), like other typed transactions. TXINDEXopcode (0x4c, 2 gas) pushes the current transaction'sconditional_tx_index, or-1if it is not a conditional transaction.
Why a new transaction type instead of just an opcode returning the current index? Declaring the index up front keeps validity static, so builders do not have to solve complex, execution-dependent placement constraints.
Sample code
RLP payload layout (pseudocode):
COND_TX_TYPE = 0x05
payload = rlp([
chain_id, nonce,
max_priority_fee_per_gas, max_fee_per_gas, gas_limit,
to, value, data, access_list,
max_fee_per_blob_gas, blob_versioned_hashes, # may be []
conditional_slot, # uint64, or -1 = any slot
conditional_tx_index, # uint64, or -1 = any index
y_parity, r, s,
])
raw_tx = bytes([COND_TX_TYPE]) + payload
# Block validity (sketch)
def check(tx, block, index_in_block):
if tx.conditional_slot != -1:
assert tx.conditional_slot == block.header.slot_number # EIP-7843
if tx.conditional_tx_index != -1:
assert tx.conditional_tx_index == index_in_block
Things to know
- Status: Stagnant. It is not scheduled for any upgrade and has no test cases.
- It is aimed at encrypted-mempool designs, not general wallet use: a normal user rarely knows the exact index their transaction should occupy.
- A conditional transaction that misses its slot or index is simply invalid, so it cannot be included later; it must be re-signed.
- The opcode byte and type number are proposals and could collide with other EIPs if this is revived.