EIPs Explained

EIP-2972 · Withdrawn · Core · 2020-09-12

EIP-2972: Wrapped Legacy Transactions

A withdrawn idea to wrap legacy transactions in two new EIP-2718 typed envelopes (SSZ-encoded signature plus the original RLP payload) so legacy encoding could be retired without invalidating old signatures.

What problem does it solve?

EIP-2718 introduced typed transactions: TransactionType || TransactionPayload. Client developers would have liked every transaction in a block to use that envelope so they could eventually drop the special handling for old-style RLP transactions.

But legacy transactions can't simply be re-signed in a new format: some were signed long ago, by keys or devices that can't produce a new signature, and funds could get stuck. EIP-2972 tried to bridge this by defining typed transactions that are signature-compatible with legacy ones, so any client could re-encode an existing legacy transaction into the new form automatically.

How it works

Two transaction types, matching the two legacy flavours:

Type Encoding Legacy equivalent
0x00 0x00 ‖ ssz(yParity, r, s, rlp([nonce, gasPrice, gasLimit, to, value, data])) Pre-EIP-155, no chain ID
0x01 0x01 ‖ ssz(yParity, r, s, rlp([nonce, gasPrice, gasLimit, to, value, data, chainId, 0, 0])) EIP-155 with chain ID

Key ideas:

  • The inner RLP list is exactly what the legacy signer signed, so the existing signature stays valid.
  • The signature is pulled out to the front as fixed-size SSZ fields (yParity, r, s), so a verifier can check it without first decoding RLP and unpacking chain ID from v.
  • Receipts get matching typed SSZ encodings.
  • After the fork, plain rlp(nonce, …, v, r, s) transactions would no longer be valid in blocks; nodes would convert them on receipt.

Since the same signature produces both the legacy and wrapped encodings, and they share a nonce, only one can ever be included.

Sample code

Pseudocode for wrapping an EIP-155 legacy transaction as type 0x01:

def wrap_legacy_155(tx):
    signed = rlp.encode([tx.nonce, tx.gas_price, tx.gas_limit, tx.to,
                         tx.value, tx.data, tx.chain_id, 0, 0])
    y_parity = (tx.v - 35 - 2 * tx.chain_id)  # recover parity from EIP-155 v
    # SSZ container: yParity (bool), r, s (bytes32), offset to signedData (uint32 LE)
    body = (bytes([y_parity]) + tx.r.to_bytes(32, "big") + tx.s.to_bytes(32, "big")
            + (69).to_bytes(4, "little") + signed)
    return b"\x01" + body

The 4-byte little-endian offset of 69 (0x45000000) is why the spec notes that the SSZ encoding equals yParity ‖ r ‖ s ‖ 0x45000000 ‖ rlp(...).

Things to know

  • Status: Withdrawn. Hashing and Merkleization of these transactions were still marked TODO in the spec.
  • Ethereum went another way: legacy transactions stayed valid in their original RLP form alongside typed ones. Type 0x01 was instead assigned to access-list transactions in EIP-2930, so the type numbers here are historical only.
  • The goal of moving transactions and receipts to SSZ has been pursued by later, separate proposals.

#transactions #typed-transactions #ssz #rlp #withdrawn

Details

Authors
Micah Zoltu (@MicahZoltu)
Status
Withdrawn
Type
Standards Track / Core
Created
2020-09-12
Requires

Machine-readable: Markdown · JSON