EIP-2803 · Stagnant · Core · 2020-07-18
EIP-2803: Rich Transactions
Proposed a special precompile address that, when an EOA sends a transaction to it, runs the transaction data as EVM bytecode in the EOA's own context, enabling batched calls from plain accounts.
What problem does it solve?
Many dApp actions need several transactions from an externally owned account (EOA). The classic example is approving a token and then calling the contract that spends it. Each step costs a signature, a confirmation and gas, and if the second fails the first is left dangling.
Contract wallets can batch calls, but in 2020 they had poor wallet and browser support and required moving funds to a new address. EIP-2803 ("rich transactions") aims to give existing EOAs the ability to run arbitrary logic, including multiple calls, atomically in one transaction.
How it works
A new reserved address x is set aside in the precompile range. When an EOA sends a transaction to x:
- The transaction
datais executed as EVM bytecode, not as calldata to a contract. - It runs as if the EOA itself were the contract:
ADDRESS,CALLERandORIGINall return the EOA.BALANCEis the EOA's balance;CALLs with value spend the EOA's ETH.- Outgoing
CALLs show the EOA asmsg.sender, so tokens see the user, not a wrapper. SLOAD/SSTOREread and write the EOA's own storage, which persists between transactions.
SELFDESTRUCTdoes nothing, and the transaction is invalid if it carries value.- There is no code at
x; a contract callingxgets no special behavior.
The authors chose a precompile address rather than a new EIP-2718 transaction type so that rich execution works with any transaction type.
Sample code
Illustrative only: the address x was never assigned and the EIP was not deployed. The payload is raw bytecode that makes two calls in sequence.
tx = {
from: <user EOA>,
to: x, // reserved rich-transaction address (TBD in spec)
value: 0, // must be zero
data: <bytecode>
}
<bytecode> (pseudo-assembly):
// 1) token.approve(router, amount) -- msg.sender seen by token = user EOA
CALL(gas, token, 0, approveCalldata)
ISZERO -> revert if failed
// 2) router.swap(...) -- pulls the just-approved tokens
CALL(gas, router, 0, swapCalldata)
ISZERO -> revert if failed
STOP
Things to know
- Status is Stagnant. It was never scheduled for a hard fork.
- The goal (letting EOAs batch calls and run custom logic) was later pursued by EIP-3074 (AUTH/AUTHCALL, now Withdrawn) and achieved by EIP-7702, which lets an EOA point to delegate contract code. Smart accounts via ERC-4337 are another route.
- Contracts that assume an EOA cannot do several things atomically (e.g.
require(msg.sender == tx.origin)as a protection) would have been weakened. The authors argued this assumption was already unreliable. - Giving EOAs persistent storage was a notable side effect; it is one of the reasons later designs took a different path.