EIP-5081 Expirable transactions (Expirable Transaction)
No call decision · Fees & gas · EIP status Stagnant · created 2022-05-06
Introduces a new transaction type that sets an expiration point based on block number (expire_by), so the transaction is not executed once that block has passed.
Why it is needed
If a user sets a low gas fee and sends a transaction (tx0), it won't settle during network congestion and remains pending indefinitely. This tx0 can settle at any time until another transaction using the same nonce is executed, creating a risk that it executes unexpectedly even after the user has already achieved the same goal through another means. A transaction sent with a much higher gas fee than usual during an urgent situation gets executed all the more easily once gas fees return to normal levels. The only way to cancel it is to preempt it by sending a new transaction with the same nonce and a higher gas fee, but if a high gas fee was already used, the preemption cost is very high and the outcome is uncertain. For trades that are meaningless unless settled within a certain time, such as AMM swaps, there is currently no way to express that time condition within the transaction itself.
What changes
Today
- A transaction sent with a low gas fee has no predictable execution time and waits indefinitely until another tx with the same nonce executes
- The only way to cancel a transaction is to preempt it by sending a new tx with the same nonce and a higher gas fee, which is costly and can fail
- There is no way to express within a transaction a time condition for trades that are meaningless unless settled within a certain time (e.g., AMM swaps)
After EIP-5081
- The new transaction type (TX_TYPE) includes expire_by (a block number), after which it is not executed
- When current_block_num exceeds expire_by, clients drop the transaction and stop propagating it
- When creating a transaction, users can embed 'valid only until this block' in the signature, letting it naturally expire without cancellation or preemption
Who is affected
- Wallet & app developers: A new transaction type with an expire_by field must be supported, which can be used for time-sensitive trades such as AMM swaps.
- Users: Reduces the risk that a transaction sent with a high gas fee during an urgent situation later settles unexpectedly.
- Client (node) developers: Must implement handling of the new TransactionType, dropping and halting propagation of expired transactions, and gossip_ttl logic.
- Miners and validators: Advised to check current_block_num so as not to waste work on already-expired transactions.
In depth
Transaction payload structure
After FORK_BLOCK_NUMBER, a new EIP-2718 transaction with TransactionType = TX_TYPE (TBD) is introduced. The TransactionPayload takes the form rlp([chain_id, expire_by, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, destination, amount, data, access_list, signature_y_parity, signature_r, signature_s]). All fields except expire_by carry the same meaning as in EIP-1559.
Meaning of expire_by
expire_by is the latest block number at which this transaction can be executed. No block with block_num > expire_by MUST execute this transaction.
Intrinsic gas cost calculation
The intrinsic gas cost for this transaction reuses the formula from EIP-2930 as is: 21000 + 16 * number of nonzero calldata bytes + 4 * number of zero calldata bytes + 1900 * number of access list storage keys + 2400 * number of access list addresses.
Signature scheme
signature_y_parity, signature_r, and signature_s are a secp256k1 signature over keccak256(0x02 || rlp([chain_id, expire_by, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, destination, amount, data, access_list])).
Receipt payload
The EIP-2718 ReceiptPayload for this transaction is rlp([status, cumulative_transaction_gas_used, logs_bloom, logs]).
Dropping expired transactions and halting propagation
A client that knows current_block_num MUST drop and stop propagating any transaction where transaction_type == TX_TYPE and current_block_num > expire_by. It is also recommended that current_block_num itself be made available to clients, with the goal of mitigating denial-of-service attacks by ensuring nodes that spend mining effort on already-expired transactions needlessly suffer a loss.
Safeguard via gossip_ttl
Clients are recommended to maintain a gossip_ttl (in block-number units) and propagate a transaction only when current_block_num + gossip_ttl <= expire_by. Existing nodes that don't support current_block_num or gossip_ttl treat this value as 0. Propagating clients are recommended to reduce gossip_ttl appropriately to fit the network environment.
What remains undecided
This EIP's status is Stagnant. The values FORK_BLKNUM, CHAIN_ID, and TX_TYPE are all TBD, and the Rationale and Backwards Compatibility sections are also empty, marked TODO, so concrete rationale and compatibility analysis have not yet been filled in. No call records regarding fork inclusion have been found either.