EIP-7702
What Is EIP-7702?
EIP-7702 is a proposal designed to enhance the capabilities of Externally Owned Accounts (EOAs). EOAs are basic accounts on the
Ethereum network, which can send transactions and interact with
smart contracts. However, they lack certain functionalities found in certain crypto wallets, such as transaction batching and
gas sponsorship.
EIP-7702 aims to temporarily allow EOAs to behave like smart contract accounts within a single transaction, thereby introducing features typically reserved for smart contract wallets. EIP-7702 was created in response to some limitations and criticisms of
EIP-3074.
While EIP-7702 is not currently live, it has notable support from the community and many believe it could replace the EIP-3074 proposal. If this happens, EIP-7702 might be implemented in the Ethereum Pectra upgrade, scheduled for late 2024.
How Does EIP-7702 Work?
EIP-7702 presents a new type of transaction on the Ethereum network that includes a special field called contract_code. This gives an EOA certain smart contract properties for the duration of the transaction. Let’s see how it works.
Transaction preparation
The user starts by preparing a transaction, including the usual details like destination
address, gas limit, and any data that needs to be sent. In addition to these details, they include a special piece of smart contract code in the
contract_code field. This code outlines the smart contract functionalities that will be temporarily assigned to their EOA.
Authorization
The user then signs the transaction. This signature is crucial as it authenticates the transaction and includes an authorization list. This list details the contract_code and the conditions under which it should be executed. Essentially, it verifies and authorizes the temporary assignment of the smart contract code to the EOA.
Execution
When the transaction is submitted to Ethereum, the network processes it by temporarily assigning the specified contract_code to the EOA. During this phase, the transaction is processed as if the EOA were a smart contract, utilizing the functionalities provided by the contract_code.
Reversion
After the transaction is completed, the Ethereum network automatically removes the temporary contract_code from the EOA. The EOA reverts to its original state, losing the temporary smart contract capabilities.
Delivery Analogy
Imagine that Bob is a delivery driver with a regular car that can only carry small packages. One day, Bob receives a delivery request for a larger package. So, instead of rejecting the order, Bob decides to rent an extra cargo box to attach to their car. They deliver the package and return the cargo box back to the rental shop, going back to their regular car.
In this analogy:
The regular car is the EOA.
The temporary cargo box is the contract_code that provides additional capabilities.
The delivery trip is the transaction.
Renting and returning the cargo box represents the temporary nature of the contract_code, which is only active during the transaction.
Benefits of EIP-7702
Security
By automatically removing the temporary contract code after the transaction, EIP-7702 would reduce the risk of unauthorized actions. This ensures that the enhancements are only active during the transaction, limiting potential vulnerabilities.
Flexibility
EIP-7702 would allow for various use cases, such as transaction batching, where multiple actions can be combined into a single transaction. It would also support gas sponsorship, enabling one account to pay for another account's transaction fees.
Smart wallet adoption
By enabling EOAs to temporarily function as smart contracts, EIP-7702 could encourage the use of smart wallet features without the security risks associated with permanent changes to EOAs.
Conclusion
EIP-7702 is a proposal that addresses the limitations of EOAs by temporarily granting them smart contract capabilities. This can enhance security by limiting the duration of smart contract functionalities to the length of a single transaction. It can also provide more flexibility through transaction batching, gas sponsorship, and other features.
Although its future is not yet certain, the substantial support for EIP-7702 indicates a strong possibility of its inclusion in the upcoming Ethereum Pectra upgrade, scheduled for late 2024.