EIP-2242 Transaction postdata
No call decision · Scaling & data · EIP status Stagnant · created 2019-08-16
A proposal to add a 'postdata' field to transactions, which the EVM does not read, allowing sidechain data to be recorded on-chain more cheaply.
Why it is needed
Today, putting data into a transaction requires using calldata, which is expensive because the EVM directly reads and processes it. EIP-2028 lowered the gas cost of calldata, but there are cases, such as sidechains, where the EVM never needs to look at the content at all. In a fraud-proof-based sidechain, the block proposer only needs to prove that 'this data exists,' and verification by fraud proof only happens after the fact if the data turns out to be wrong. In other words, the data ends up paying the same cost as calldata even though the EVM has no reason to read it right away. Following the principle of 'not paying for what isn't used,' a separate, cheaper path is needed for recording on-chain data that the EVM does not process.
What changes
Today
- To leave data on-chain, it must be put into calldata, which the EVM reads and processes in its entirety.
- Even when a sidechain only needs the fact that the data exists, it must pay the same expensive cost as calldata.
- The transaction format has no separate place for data the EVM does not use.
After EIP-2242
- Placing data in a new field called postdata means the EVM does not read it; it is only recorded on the chain.
- postdata costs 1 gas per byte, letting data be posted at a cheaper cost than calldata.
- The sidechain proposer only guarantees the fact that the data exists, and if a problem arises, it is verified after the fact via a fraud proof.
Who is affected
- Users: Since this is not a field ordinary users directly handle in their wallets, there is almost no perceptible change.
- Sidechain and layer 2 developers: Data for data availability proofs can be left on-chain at a cheaper cost.
- Client teams: The transaction format, signing method, and gas calculation logic must be changed via a hard fork.
- Validators and full nodes: The newly added postdata field must be parsed and stored.
In depth
Addition of the postdata field
From FORK_BLKNUM onward, an optional field called postdata is added to transactions. It is appended after the existing from, to, startGas, gasPrice, value, data, and nonce fields, and the signature (witness) is made over the RLP encoding that includes this entire set of fields.
The structure of postdata: version and data
postdata itself is an RLP tuple of the form (version: uint64, data: bytes). The current version is 0, and data is an RLP-encoded list of binary data. This EIP does not interpret the content of data at all, treating it purely as a binary blob, and leaves room for future EIPs to introduce different interpretation schemes based on the version value.
Gas cost: 1 gas per byte
Data posted via postdata costs 1 gas per byte, and this cost is deducted from startGas. If the remaining gas drops to 0 or below, the transaction immediately reverts with an out-of-gas exception. Even compared to the calldata gas cost lowered by EIP-2028, this is designed to be cheaper since the data is never read by the EVM at all.
Motivation: 'don't pay for what isn't used'
EIP-2028 lowered the gas cost of calldata, but calldata is still data the EVM can read. In cases such as Eth 2.0's Execution Environment or discussions of stateless clients, where the blockchain is used purely as a 'data availability and dispute arbitration layer,' the EVM has no need to read that data at all. This EIP creates a separate path, for such uses, for data that the EVM does not process.
Applies to: fraud-proof sidechains. Excludes: validity-proof sidechains
Trust-minimized sidechains based on fraud proofs only need the block proposer to prove that 'the data exists'; if the data is wrong, this is only certified after the fact via a fraud proof. Validity-proof-based sidechains, by contrast, must certify posted data immediately, so they cannot use this EIP's structure, and the original text leaves this as the topic of a future separate EIP.
Backward Compatibility and Hard Forks
Since postdata is an optional field appended to the end of an existing transaction, it is backward compatible with the existing transaction format. However, this change is not forward compatible, and a hard fork is required for the entire network to recognize the new format.
Current status: Stagnant
This EIP's status is Stagnant, with both the Test Cases and Implementation sections left as TODO, meaning no concrete implementation or tests have been written. There is no call record addressing fork inclusion either, so whether it will actually be adopted and applied cannot be determined from the original text alone.