EIP-2711 Sponsored, expiring, and batched transactions (Sponsored, expiring and batch transactions.)

No call decision · Fees & gas · EIP status Withdrawn · created 2020-06-11

Proposes a new transaction type (type 2) that separates the sender from the gas payer so transactions can be made without holding ETH, bundles multiple transactions to execute in order in a single batch, and automatically invalidates once past its expiration.

Why it is needed

As more users hold only tokens or stablecoins and no ETH, the rule requiring gas fees to be paid in ETH alone began blocking transactions outright. Solving this at the contract level individually would require every contract to integrate it separately and would still be vulnerable to gas price fluctuations. There was also demand for bundling multiple transactions to execute in order without another transaction being inserted in between, and a problem where transactions with no expiration could sit in the queue for a long time, execute unexpectedly late, or keep being replayed. This EIP proposes addressing all three problems at the protocol level at once by combining gas payer separation, batch execution, and expiration time specification into a single new transaction type.

What changes

Today

After EIP-2711

Who is affected

In depth

Transaction type 2 and its four subtypes

Defined as EIP-2718 TransactionType 2, divided into TransactionSubtype 1 through 4. The subtypes differ in who sets gasLimit and gasPrice. Subtype 1 has the sender set both, with no GasPayerSignature, so the sender pays the gas themselves. Subtype 2 also has the sender set both, but adds a GasPayerSignature so another party pays the gas instead. Subtype 3 has the sender set only gasLimit, while the gas payer sets gasPrice. Subtype 4 has the gas payer set both gasLimit and gasPrice.

SenderPayload and signature structure

SenderPayload takes the form [TransactionSubtype, ChildTransaction[], nonce, ChainId, ValidUntil, (gasLimit), (gasPrice)] depending on the subtype. ChildTransaction is a sub-transaction composed of the three values [to, value, data]. SenderSignature is a [YParity, r, s] signature over secp256k1(keccak256(rlp([TransactionType, SenderPayload]))). If ChainId is 0, it is valid on any chain with no chain restriction.

GAS_PAYER signature and separation of the gas fee

If a GasPayerSignature is present, the address recovered from it pays the gas fee; if not, the address recovered from SenderSignature pays the gas fee as well. The address recovered from SenderSignature is always CALLER (msg.sender), ORIGIN (tx.origin), the nonce owner, and the target of the value deduction. GasPayerSignature signs over the SenderPayload, SenderSignature, and GasPayerPayload together.

Gas cost formula and receipts

The base gas cost for this type is calculated as TRANSACTION_TYPE_2_BASE_GAS_PRICE + TRANSACTION_TYPE_2_CHILD_GAS_PRICE * n (number of child transactions), which differs from the cost formula for type 0 or legacy transactions. The receipt also has a dedicated format, returned as an rlp array containing a [status, cumulativeGasUsed, logsBloom, logs] array for each child transaction.

Why ValidUntil is set as a timestamp instead of a block number

ValidUntil is based on the block timestamp. A value of 0 means no expiration, taking up only 1 byte in RLP. The reason for using Unix time instead of a block number is that clock information is available even in offline signing environments, whereas a block number requires querying chain state, block production time is not fixed at 13 seconds, and it is even more irregular on testnets and private networks. It is also easier for users to understand "by such-and-such a time" than "within so many blocks."

Why the gas payer is not given a separate nonce

Since replay protection for the child transactions is already handled by the sender's single nonce, the gas payer is not given a separate nonce. A separate nonce would enlarge the payload, require replace-by-fee handling when the gas payer tries to swap in a higher gas value, and risk a deadlock where a mismatch between the order of the sender's nonce and the gas payer's nonce prevents either party from completing their signature.

Original status: Withdrawn

This EIP's frontmatter status is Withdrawn, and the Test Cases, Implementation, and Security Considerations sections are all empty. The source does not include any call records.

Original EIP · ← EIPs