|
| 1 | +# EIP 7702 |
| 2 | + |
| 3 | +This Workspace template presents one of the updates that shipped with the Pectra upgrade - occuring in May 2025. |
| 4 | + |
| 5 | +### Basics |
| 6 | + |
| 7 | +In the Ethereum blockchain there are two different types of accounts: |
| 8 | +- Externally Owned Account (EOA): which require a private key and could initiate transactions. |
| 9 | +- Smart Contract Account: which represents code deployed in the blockchain. |
| 10 | + |
| 11 | +These two concepts are separated. Until now EOAs could not have code associated to them. |
| 12 | +But with the Pectra upgrade, EOAs can now host and directly run code. |
| 13 | + |
| 14 | +For more information please see [this page](https://eip7702.io) |
| 15 | + |
| 16 | +### Demo of a batched transaction |
| 17 | + |
| 18 | +In this demo, we'll deploy a contract and assign it to an EOA. Then we'll run a script that will deploy a token and another contract. The script will also prepare the data to batch a transaction so that it will contain the approval for the transfer and as well as the transfer. |
| 19 | + |
| 20 | +This section explains how to run this project. Let's first assign a piece of code to an EOA: |
| 21 | + |
| 22 | + - Compile MyToken.sol, Example7702.sol, and Spender.sol using Solidity version 0.8.28. |
| 23 | + - In Deploy & Run, in the CONTRACT select box, choose Simple7702Account and deploy it to the Remix VM (Prague) network. |
| 24 | + - Copy the deployed contract's address. |
| 25 | + - Click the Authorize Delegation button and paste the contract's address into the modal. |
| 26 | + - In Deploy and Run, check the new "deployed". It has the same address as the EOA that was assigned to SIMPLE7702ACCOUNT. |
| 27 | + - Run the script `run-eip7702.ts`. |
| 28 | + - In the terminal, copy the logged data from console.log(executeBatch) |
| 29 | + - Back in Deploy & Run, find the DELEGATED SIMPLE7702ACCOUNT and open it up to see its functions. |
| 30 | + - In the executeBatch function , paste the data and then run the transaction. |
| 31 | + - Go to the the deployed token's balanceOf function. Input the first and then the second account to check that each address' balance has been updated. |
| 32 | + - This is possible because of the 7702 connection between the contract and the first EOA address. |
| 33 | + |
| 34 | + |
| 35 | + |
0 commit comments