EIPs Explained

EIP-7873 · Stagnant · Core · 2025-01-31

EIP-7873: EOF - TXCREATE and InitcodeTransaction type

Proposed a TXCREATE opcode and a new type-6 InitcodeTransaction carrying initcode blobs, giving EOF a way to deploy contracts since EOF bans classic creation transactions and CREATE/CREATE2.

What problem does it solve?

The EVM Object Format (EOF, EIP-3540) removes code observability. As a result EOF contracts cannot be deployed by the legacy routes: a creation transaction (empty to), CREATE or CREATE2. EIP-7620 adds EOFCREATE, but that only deploys subcontainers already embedded in an existing contract.

Something is still needed for an EOA or a factory to deploy arbitrary EOF code supplied at transaction time, including deterministic, counterfactual addresses that do not depend on nonces. EIP-7873 provides it.

How it works

New transaction type InitcodeTransaction, type 0x06. It is an EIP-1559 transaction plus a field initcodes: a list of 1 to 256 byte strings, each non-empty and at most MAX_INITCODE_SIZE. to must be set: the transaction calls a contract (for example a factory) that uses TXCREATE. Initcode bytes are charged like calldata, including the EIP-7623 floor. They are not EOF-validated at transaction validation time, to avoid mempool DoS.

New instruction TXCREATE (0xed), usable from both EOF and legacy code:

  1. Charges 32000 gas; fails in static context.
  2. Pops tx_initcode_hash, salt, input_offset, input_size, value.
  3. Finds the initcodes entry whose hash matches. If none (or the tx is not type 6), pushes 0 without consuming initcode gas.
  4. Validates that container recursively; on failure pushes 0 (a "light" failure).
  5. Runs it with memory input as calldata. On success it ends with RETURNCODE (from EIP-7620), the deploy container is stored, and the new address is pushed.

The address is keccak256(0xff || sender32 || salt)[12:], the same scheme as EOFCREATE. Whether to mix the initcode hash into salt is up to the caller.

Legacy creation transactions (types 0, 1 and 2 with empty to) do not parse EOF: input starting with 0xEF simply executes the undefined 0xEF opcode and halts.

Sample code

Encoding of the new transaction type (per EIP-2718):

0x06 || rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas,
             gas_limit, to, value, data, access_list, initcodes,
             y_parity, r, s])

signing hash = keccak256(0x06 || rlp([chain_id, nonce, max_priority_fee_per_gas,
             max_fee_per_gas, gas_limit, to, value, data, access_list, initcodes]))

TXCREATE stack usage, pseudocode:

# stack: tx_initcode_hash, salt, input_offset, input_size, value
initcode = find(tx.initcodes, lambda c: keccak256(c) == tx_initcode_hash)
if tx.type != 0x06 or initcode is None or not eof_validate(initcode):
    push(0)                     # light failure
else:
    new_address = keccak256(b"\xff" + pad32(sender) + salt)[12:]
    push(new_address if run_initcode(initcode, memory[input_offset:input_offset+input_size], value) else 0)

Things to know

  • Status: Stagnant, as are EOF itself (EIP-3540, EIP-7620) and the EOF meta EIP EIP-7692. None of this is live on Ethereum mainnet.
  • It would make EIP-7698 (EOF creation transactions) unnecessary; the spec suggests that EIP could be withdrawn.
  • The spec's Security Considerations section is only "Needs discussion."
  • Deployed code is still limited to MAX_CODE_SIZE (24,576 bytes, EIP-170) and is charged 200 gas per byte.

#eof #evm #contract-creation #transactions #stagnant

Details

Authors
Piotr Dobaczewski (@pdobacz), Andrei Maiboroda (@gumb0), Paweł Bylica (@chfast), Alex Beregszaszi (@axic), Danno Ferrin (@shemnon)
Status
Stagnant
Type
Standards Track / Core
Created
2025-01-31
Requires

Machine-readable: Markdown · JSON