How Expensive Are ERC-4337 Gas Fees?

One disadvantage of smart accounts over traditional wallets is that fees can be higher. But how much?

Each blockchain has its own fee structure. In the case of Ethereum, the amount of effort—computation and storage—required to make the transaction is calculated. When a transaction is submitted to the blockchain, it includes a price it is willing to pay for each computation unit. The effort required to make ititself is called “gas,” and the amount a transaction pays for each unit is called “gas price.”

fee = gas × price

Fees themselves are paid in the native currency of the blockchain. In the case of Ethereum, this is ETH.

Many blockchains that are based on Ethereum use this basic logic, and even calculate gas pretty much the same way. That makes it really easy to estimate the cost of each transaction, since you can calculate gas and then just multiply it by what you think the price will be when you make the transaction. A lot goes into estimating the gas price each transaction should propose, but the gas is always the same.

Some blockchains that charge fees this way are Polygon and BnB Smart Chain. But this isn’t the only way to do it. Some blockchains are actually built on top of other blockchains! They run their own network, which processes transactions themselves, and then posts data back to the main blockchain. These blockchains are called “rollups.”

Rollup fees

Why would you want to build a blockchain on top of another blockchain?

Well, Ethereum is optimized to be really secure. But in order to have a really secure blockchain you need a really big network. And in order to have a really big network, normal people with normal computers need to be able to run the blockchain’s software. It turns out the best way to do this is to have a blockchain optimized for big, slow(ish) transactions.

But there are a lot of use cases where you instead want to process a lot of small transactions really quickly.

Rollups basically perform transactions on a smaller, faster blockchain and then post data back to another blockchain like Ethereum to prove that it was done correctly. This means you can have really fast, cheap transactions while still using the security of a large network. All of the transactions on the blockchain split the cost of posting the data.

This makes fees a lot lower, but also more complicated. A user not only pays the rollup, but also the main blockchain! And the price for the main blockchain is split amongst other users of the rollup.

fee = rollup fee + primary blockchain fee

There are different ways to split the fee of posting data back to the network. Arbitrum splits the cost by multiplying the Arbitrum network’s gas price times the relative size of the transaction. Optimism estimates the cost of posting to the main blockchain by estimating the gas price directly then adding some buffer. But from a user’s point of view, the costs are about the same.

Estimating gas fees

Stackup’s ERC-4337-Examples repository was used to get gas estimates for transactions on popular blockchains. All transactions were conducted multiple times on testnets and once on mainnet to verify consistency, and each of the UserOperations were submitted to the audited 0x0576a174D229E3cFA37253523E645A78A0C91B57 EntryPoint using Stackup’s hosted bundler. Each UserOperation was the sole UserOperation in the bundle.

Gas

To make the below estimates, the following assumptions are used:

  • ERC-4337 accounts are created as a proxy from the Ethereum Foundation simpleAccountFactory.sol reference implementation.
  • Native token transfers send 0.1 of the native token.
  • ERC-20 token transfers send 0.1 of the ERC-20 token.

Table 1. Gas for ERC-4337 transactions

ERC-4337 Traditional Wallet
Create Account 385,266 0
Simple Transfer 88,710 21,000
ERC-20 Token Transfer 90,803 65,000

Simple transfers with ERC-4337 is much more expensive than simple transfers with a traditional wallet (often called an EOA) because a contract call has to be made with ERC-4337. Transactions that already make contract calls, such as an ERC-20 token transfer, have a smaller difference. In fact you can see that ERC-20 token transfers are only 2,000 gas more expensive than a simple native token transfer.

ERC-4337 fees

A range of fees can now be estimated from historical gas and token prices. The gas price range is reported as the daily average gas price for the first 90 days of 2023 ± one standard deviation.

Table 2. Gas fee estimates for ERC-4337 transactions

Gas Price Range Token Price Create ERC-4337 Account Simple Transfer ERC-20 Transfer
Ethereum1 30.5 ± 10.6 gwei $2000 $23.50 ± $8.17 $5.41 ± $1.88 $5.54 ± $1.93
Polygon2 224 ± 108 gwei $1.10 $0.09 ± $0.05 $0.02 ± $0.01 $0.02 ± $0.01
Optimism3,4 0.0013 ± 0.008 gwei $2000 $0.50 ± $0.18 $0.45 ± $0.16 $0.46 ± $0.17
Avalanche5,6 36.4 ± 4.5 nAVAX $20 $0.29 ± $0.04 $0.06 ± $0.01 $0.07 ± $0.01
BnB Smart Chain7 7.05 ± 0.53 gwei $350 $0.95 ± $0.07 $0.22 ± $0.02 $0.22 ± $0.02

1https://etherscan.io/chart/gasprice
2https://polygonscan.com/chart/gasprice
3https://optimistic.etherscan.io/chart/gasprice
4Optimism fee range is estimated by applying one standard deviation to both Ethereum Mainnet and Optimism gas fees.
5https://snowtrace.io/chart/gasprice
6Avalanche gas is slightly different than Table 1. This table uses the measured gas on Avalanche to compute the fee.
7https://bscscan.com/chart/gasprice

Fees are higher using ERC-4337 simply because gas is higher. On Ethereum Mainnet the difference is large—$5 more expensive to do an ETH transfer for example—but on rollups the absolute difference is only cents. Whether these differences make a difference to end-users is dependent on the application.

But it turns out ERC-4337 has some tricks that allows us to reduce gas fees so that they are actually below their EOA counterparts.

ERC-4337 can be cheaper than EOAs on rollups

The majority of the gas cost on rollups like Optimism and Arbitrum is the storage of data back to Ethereum Mainnet. Because ERC-4337 allows flexible authentication logic from Smart Accounts, we can significantly reduce the amount of data that needs to be stored on Mainnet by aggregating signatures together.

Signature Aggregation

The core concept is this: if you have signatures that can be aggregated together into a single signature in the same block, only the single signature needs to be stored on Mainnet. This data compression can significantly reduce the cost.

Vitalik Buterin tweeted the below figure in October 2022 to demonstrates how signature aggregation, plus other compression techniques, can lead to lower costs with ERC-4337 accounts than traditional wallets. It’s pretty dense, but the bottom line is this: ERC-4337 is flexible enough to solve the gas issues it creates.

In Practice

Actually implementing this compression is well beyond the scope of this post. But it is feasible, and already incorporated into the design of ERC-4337. This is done through a special class of actors called Aggregators that - you guessed it - aggregate signatures.

The most popular way to compress this is with BLS signature aggregation. From a user’s point of view they don’t see anything different, but the developer they will need to implement BLS signature logic into the Smart Account. Luckily the Ethereum Foundation already has created a template:

https://github.com/eth-infinitism/account-abstraction/tree/develop/contracts/samples/bls

The volume of ERC-4337 transactions is not yet high enough to have the benefits of signature aggregation, but it is growing quickly.