|
1 | 1 | # EIP 7702
|
2 | 2 |
|
3 |
| -This Workspace template presents one of the updates that shipped with the Pectra upgrade - occuring in May 2025. |
| 3 | +This Workspace template presents EIP-7701, one of the updates that shipped with the Pectra upgrade (May 2025). |
4 | 4 |
|
5 | 5 | ### Basics
|
6 | 6 |
|
7 | 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. |
| 8 | +- Externally Owned Account (EOA): which require a private key and can initiate transactions |
| 9 | +- Smart Contract Account: which represents code deployed on the blockchain |
10 | 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) |
| 11 | +Until now EOAs could not have code associated with them. |
| 12 | +But with the Pectra upgrade, EOAs can now host and can directly run code. |
15 | 13 |
|
16 | 14 | ### Demo of a batched transaction
|
17 | 15 |
|
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. |
| 16 | +This demo will show an example of a batched (not botched) transaction. Before batching, sending a token required two transactions: one to allow the transfer and another to send the token. With batching, these function calls can be done in a single transaction. |
| 17 | + |
| 18 | +Assign a piece of code to an EOA: |
| 19 | + |
| 20 | +- Compile `MyToken.sol`, `Example7702.sol`, and `Spender.sol` using Solidity version 0.8.28. |
| 21 | +- In Deploy & Run's **CONTRACT** select box, choose **Simple7702Account** and deploy it to the Remix VM (Prague) network. |
| 22 | +- Copy the deployed contract's address. |
| 23 | +- Click the **Authorize Delegation** button and paste the contract's address into the modal. |
| 24 | +- In Deploy and Run, check the new deployed contract. It has the same address as the EOA that was assigned to SIMPLE7702ACCOUNT. |
| 25 | + |
| 26 | +Setting up the data for the batch: |
| 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 | + |
| 32 | +Executing the batched transaction: |
| 33 | +- Go to the the deployed token's **balanceOf** function. |
| 34 | +- Input the first and then the second account to check that each address' token balance has been updated. |
| 35 | +- The is possible because of the 7702 connection between the contract and the first EOA address. |
| 36 | + |
33 | 37 |
|
34 | 38 |
|
35 | 39 |
|
0 commit comments