# How to save on 80% of fees in Ethereum?
📌 **This article is aimed at the setup that most CeFi platforms currently have with EVM.** We will explore how the internal gas fees can be dramatically reduced by implementing [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702)⚡ in their setup.
🏢 **This article is not related to a particular company or entity**, but a **general approach** based on the available setups.
📖 **Prerequisites**: Some basic understanding of EVM networks and familiarity with terms such as transaction and gas are required.
## 📌What is EIP-7702 ?
[EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) introduces a major upgrade that allows Ethereum’s Externally Owned Accounts (EOAs) to execute smart contract code directly. This enhancement brings smart account functionalities to EOAs, enabling features like multi-signature approvals, threshold-based security, transaction batching, sponsorship, and modular extensions.
Under this model, an EOA can reference a "delegation designator" address pointing to a specific smart contract. To enable this functionality, an EOA owner must sign an authorization, which can be submitted by anyone as part of a new transaction type - only required once per authorization.
When a transaction is sent to the EOA alongside its authorization, it executes the contract’s code via a delegate call, effectively transforming the EOA into a programmable smart account. This authorization remains valid until replaced and can apply to a single blockchain or multiple chains simultaneously.
Despite these upgrades, the security and control of the EOA remain tied to its private key, which is essential for signing both on-chain transactions and off-chain messages. Protecting this private key is crucial to prevent unauthorized access and maintain the integrity of the account.
## 🏢 CeFi Classical Model
Most CeFi platforms have setups which we will refer to as the 'Classical Model'. It consists of the following:
- Each user gets a separate deposit address to which assets are deposited.
- Transfer ("*sweep*") of assets is performed based on criteria to hot or cold wallets.
- Dust transfers are performed when deposit addresses do not have native assets.
This allows the CeFi platform to operate with the funds for their strategies but also improves security as assets are kept in wallets which are protected by multi-signature requirements.
```plantuml
@startuml
actor User
participant "Deposit Address" as DA
participant "Blockchain Network" as BN
participant "CeFi Platform" as CP
participant "Hot Wallet" as HW
participant "Cold Wallet" as CW
User -> DA: Send crypto deposit
DA -> BN: Broadcast transaction
BN -> CP: Confirm transaction
CP -> CP: Update user balance
CP -> HW: Sweep small deposits
CP -> CW: Sweep large deposits
@enduml
```
## 🤦♂️ The Problem
As some of you might have noticed, the sweeps to hot or cold wallets are blockchain transactions. These transactions cost gas units on the blockchain and are a financial nuisance to the CeFi platform.
The situation gets worse if we are transferring from a Deposit Address which does not have native assets, but only holds ERC-20s. This is where the Dust transfers come into play.
To move the ERC-20s out of the EOA, we need to supply it with native assets for a small amount called "dust", to pay for the transfer. Great? No, the situation has worsened.
Now we have two blockchain transactions which incur costs:
| Transaction | Gas Units | Description |
| -------- | -------- | -------- |
| ERC-20 Sweep | 35,000 - 65,000 | Cost varies based on ERC-20 [[1](https://etherscan.io/tx/0x1ccb0dbe65ea51d4d1ec3a4071695223ccfdf73cfa41a180e54e01fe14ac1390)], [[2](https://etherscan.io/tx/0xa5e01b05d6b5f6105bc0a3beb9ade46e748f8162667b102ed1124a047ddb526b)]. Technically can be as much as a block gas limit. The lower end can be seen on a new ERC-20 without extra functionality if this is not the first transaction for the address. |
| Dust Transfer | 21,000 | Native transfers have a fixed cost of 21,000 gas units.
For our example, let's take the lower end of 35k gas units for ERC-20 transfer and an additional 21k to send dust to the EOA - a total of around 56k gas units.
The final price in USD dollars is determined by the current gas price at the time of transaction and the native asset's USD value. This varies based on various factors like congestion of the network.
---
[Based on data from Etherscan](https://etherscan.io/chart/gasprice) - the average gas price for 2024 was just under 20 gwei**. This results in (20 gwei * 56,000 gas units) = 0.00112 ETH on fees. At the time of writing with the current price of USD 2653.25 per Ether this results in a $2.97 fee.
If our CeFi platform had **one million** ERC-20 deposits per year and we assume that 80% of the addresses do not have native assets at the time when the *sweep* is done, in reality it would be higher percentage - that is a **USD 2,376,000** for fees yearly. This is a BIG PROBLEM. 😵💫
## 🦾 Enter EIP-7702
As we mentioned, we can introduce sponsorship with EIP-7702 if we set up our EOAs as smart accounts. This means that someone else can pay for the transaction. In our scenario, we can have the Dust address send the transaction for a sweep of assets from the EOA.
This removes the need for a Dust Transfer transaction, which already saves 21,000 gas units.
Another improvement is batching, if the EOA has more than one ERC-20, we can sweep them all in a single transaction instead of multiple further reducing the cost. At least 21,000 gas would be saved for each ERC-20 batched.
```plantuml
@startuml
actor "EOA 1" as EOA1
actor "EOA 2" as EOA2
participant "ERC-20 Token A" as TKA
participant "ERC-20 Token B" as TKB
participant "ERC-20 Token C" as TKC
participant "Dust Address (Sponsor)" as DA
participant "Cold Wallet" as CW
EOA1 -> DA: Authorization signature
EOA2 -> DA: Authorization signature
DA -> EOA1 : Sweep
DA -> EOA2 : Sweep
EOA1 -> TKA: Transfer tokens for EOA1
EOA1 -> TKB: Transfer tokens for EOA1
EOA1 -> TKC: Transfer tokens for EOA1
TKA -> CW: Transfer tokens
TKB -> CW: Transfer tokens
TKC -> CW: Transfer tokens
EOA2 -> TKA: Transfer tokens for EOA2
EOA2 -> TKB: Transfer tokens for EOA2
EOA2 -> TKC: Transfer tokens for EOA2
TKA -> CW: Transfer tokens
TKB -> CW: Transfer tokens
TKC -> CW: Transfer tokens
@enduml
```
---
If we batch three ERC-20 and remove the dust transfer we get the following saving in gas units.
| Transaction | Gas Units | Description |
| ------------------------------------------ | ------------------------------------------------------------------ |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Normal: 3 ERC-20 Sweeps, 1 Dust Transfer | 35,000 * 3 = 105,000 + 21,000 = 126,000 (tests: 124,359) | Each separate transfer costs 35k and the dust is 21k if the platform can anticipate the required dust for all transfers. |
| EIP-7702: 3 ERC-20 Sweeps, 0 Dust Transfer | 0 (dust) + 3 * (35,000 - 21,000) + 21,000 = 63,000 (tests: 52,404) | The saving comes from the absence of separate transactions and dust transaction. Each transaction incurs the cost of at least 21k gas units. For the batching transaction, we still have a 21k cost. The percentage decrease is 57.87% :rocket: :money_mouth_face: |
---
*Tests are done on the local development network where we are transferring the same ERC-20 to the same address multiple times. This has some internal gas saving so the result might be skewed to the lower end, but in reality, it will be around the numbers above.*
We managed to save on gas fees by around 60% which is incredible already, but can we do better? 🤔
## 🤖 Dust Address as Batcher
What if we set our Dust Address as a Batcher Contract that can call all of our EOAs?
Somewhat like the [ERC-4337](https://www.erc4337.io/) (Account Abstraction) where we have a Batcher and an Entry Point. If our Dust Address is a Smart Account that can call EOAs, we can batch sweeps across different accounts in a single transaction.
We can also apply some additional security so that the assets can be transferred.
```plantuml
@startuml
actor "EOA 1" as EOA1
actor "EOA 2" as EOA2
participant "ERC-20 Token A" as TKA
participant "ERC-20 Token B" as TKB
participant "ERC-20 Token C" as TKC
participant "Dust Address (Sponsor)" as DA
participant "Cold Wallet" as CW
EOA1 -> DA: Authorization signature
EOA2 -> DA: Authorization signature
DA -> DA: Sweep All
DA -> EOA1 : Transfer Tokens
EOA1 -> TKA: Transfer tokens for EOA1
EOA1 -> TKB: Transfer tokens for EOA1
EOA1 -> TKC: Transfer tokens for EOA1
TKA -> CW: Transfer tokens
TKB -> CW: Transfer tokens
TKC -> CW: Transfer tokens
DA -> EOA2: Transfer Tokens
EOA2 -> TKA: Transfer tokens for EOA2
EOA2 -> TKB: Transfer tokens for EOA2
EOA2 -> TKC: Transfer tokens for EOA2
TKA -> CW: Transfer tokens
TKB -> CW: Transfer tokens
TKC -> CW: Transfer tokens
@enduml
```
Okay, this should be good, but how much does it save? We will compare the sweeps without the proposals, with EIP-7702 and with ERC-4337, but let's make things interesting - we still have 3 ERC-20s per address, but we are working with 10 addresses.
*Please note, that we are using the already calculated value from the previous table for each address.*
| Transaction | Gas Units | Description |
| ------------------------------------------------------------------ | --------------------- |:-------------------------------------------------------------------------------------------------------------------------------------------- |
| Normal: 10 Addresses, 3 ERC-20s , 10 Dust Transfers | 10 * 124,359 =~ 1.24M | |
| EIP-7702: 10 Addresses, 3 ERC-20s, 0 Dust Transfers | 10 * 52,404 = 524k | Since ERC-20 can be swept in a single transaction for each address, we only need 10 Transactions each sweeping 3 ERC-20 from the address. This is a reduction of 58.08% :star: |
| EIP-7702 + Dust Batcher: 10 Addresses, 3 ERC-20s, 0 Dust Transfers | 255,473 | A single transaction with instruction to sweep 3 ERC-20 from each address. We have managed to reduce the original cost by 79.40%. 🤩 |
How do we have such a reduction? The fact that we save 21k (initial cost) on each address and batch multiple addresses allows us to save a considerable amount. The following chart represents how the gas cost rises for the different approaches, based on the addresses involved if they only had a single ERC-20 in them.

## 👋 Closing Remarks
It is obvious that we if batch more ERC-20s and addresses, the higher the savings will be. This proposal is a huge improvement for both DeFi and CeFi with the capabilities it provides.
If you are a CeFi and EIP-7702 is not on your horizon, I would suggest you dedicate the time to explore and implement it
*Feel free to contact me to discuss EIP-7702 and its capabilities more.*
<!-- ### Part 2
In the next part, we will provide and explore the code for this proposal and cover the following:
- What are the specific steps to implement EIP-7702 in a CeFi platform?
- How does the security of the EOA change with the implementation of EIP-7702?
- What potential risks or challenges could arise when transitioning from the Classical Model to the updated setup with EIP-7702?
- Inspect the Smart Contracts which were used to verify the data. -->
---
'*' - the value is calculated based on the current price of ETH (USD 2653.25), in reality, the final price will be different, and it can vary in every direction.
'**' - the value is calculated as the average based on the data. In reality, CeFi platforms can have strategies to execute when the gas price is lower than the average, but for simplicity, the average is chosen.