EIPs Explained

EIP-2242 · Stagnant · Core · 2019-08-16

EIP-2242: Transaction Postdata

A proposal to add an optional 'postdata' field to transactions: data posted on-chain for layer-2 systems to retrieve later, never readable by the EVM, and charged a flat 1 gas per byte.

What problem does it solve?

Optimistic side chains and rollups with fraud proofs need to publish their block data on Ethereum so anyone can check it later. They do not need the EVM to read that data; they only need it to be available in the chain's history.

In 2019 the only way to publish data was calldata, which the EVM can access and which is priced accordingly. EIP-2028 made calldata cheaper, but it is still paying for a capability these systems do not use. EIP-2242 follows "don't pay for what you don't use": add a separate place for data that is stored on-chain but invisible to execution.

How it works

From a fork block, transactions may carry one extra, optional field at the end, postdata, and the signature covers it along with the other fields.

  • postdata is an RLP-encoded pair (version, data).
  • version is 0 for this EIP; future EIPs can define other versions with different interpretations.
  • data is an RLP list of binary blobs. The protocol does not interpret it.
  • The cost is 1 gas per byte, deducted from the transaction's gas limit up front. If that leaves no gas, the transaction fails with out-of-gas.
  • No opcode can read postdata. Layer-2 software reads it from the transaction history instead.

Because the field is optional and appended, existing transactions remain valid, but nodes need a hard fork to accept the new form. The author notes it only helps systems using fraud proofs: validity-proof (zk) systems need the data authenticated immediately, which this does not provide.

Sample code

Transaction layout and gas charge as pseudocode:

# signed payload = RLP([nonce, gasPrice, startGas, to, value, data, postdata?])
postdata = rlp.encode([0, [batch_1_bytes, batch_2_bytes]])   # (version, list of blobs)

def intrinsic_postdata_gas(tx):
    return len(tx.postdata) * 1        # 1 gas per byte of postdata

def apply(tx):
    gas_left = tx.start_gas - intrinsic_postdata_gas(tx)
    if gas_left <= 0:
        raise OutOfGas()
    # execute tx.data as usual; tx.postdata is never exposed to the EVM

Things to know

  • Status is Stagnant; it was never adopted.
  • The underlying idea, cheap data for layer 2 that the EVM cannot read, shipped later in a different form: blob transactions in EIP-4844, which use a separate fee market and keep blob data only for a limited time rather than in permanent history.
  • The spec uses an older field naming (startGas, from in the serialized list) and leaves test cases and implementation as TODO.

#data-availability #layer2 #transactions #core

Details

Authors
John Adler (@adlerjohn)
Status
Stagnant
Type
Standards Track / Core
Created
2019-08-16

Machine-readable: Markdown · JSON