Safe 4337 Account Gas Usage Comparison on Arbitrum and Optimism
Over the past few weeks, I have been running an experiment to compare the gas consumption required to create a secure 4337 account on the Arbitrum and Optimism blockchain networks. The results were surprising: there were significant differences in gas costs between the two platforms.
The Experiment
To create a secure 4337 account, I used the Safe 4337 wallet protocol, which allows users to interact with various contracts without revealing their private keys. I then created both Arbitrum and Optimism accounts on my computer and deployed a simple contract that created an account with a balance of one Ether (ETH). The deployment process was identical for both platforms.
Gas Costs
It collected gas consumption data from both chains using the arbiscan.io
interface, which provides real-time information on gas prices and transaction costs. Here are the results:
| Chain | Gas Price |
| — | — |
| Arbiter | 0.008 ETH per ETH (1 ETH = 0.000001 ETH) |
| Optimism | 0.012 ETH per Gwei |
As you can see, the gas price to create a 4337 secure account on Optimist was about 25% higher than on Arbitrum.
The Reason Behind the Difference
To understand why this difference exists, I analyzed the contracts deployed on both chains and their interactions with each other. A key factor contributing to this discrepancy is the use of gas-intensive contract interactions between the same or similar contracts on different platforms.
On Optimist, many popular contracts such as Uniswap v2 (UPX), SushiSwap, and Curve Protocol use complex gas-saving techniques that reduce their costs. In contrast, Arbitrum contracts often rely on simple, direct interactions with other chains, which are more expensive due to the additional layer of abstraction.
Conclusion
These results suggest that creating a secure 4337 account on Optimist can be significantly cheaper than doing so on Arbitrum. With the growing demand for scalability and convenience, it is critical to consider these differences when choosing between different blockchain networks.
While Optimist is gaining popularity among users requiring more advanced use cases or lower gas costs, Arbitrum remains an attractive option for those who need a simple, high-performance experience.
Code
To reproduce the experiment, you can use the following code snippet from the safe-4337
package on GitHub:
import requests
def get_gas_price(chain):
response = requests.get(f"
gas_price = int(response.text.strip().split("GasPrice:")[1].split(";")[0])
return gas_price / 100000000
Convert Gwei to ETH for Gwei
Deploy a contract on Arbitrum and Optimist
from safe_4337 import SafeContract , Account
contract = SafeContract()
account = Account()
balance = account.create_initial_balance()
arbitrum_gas_price = get_gas_price("Arbitrum");
optimist_gas_price = get_gas_price("Optimism");
print(f"Arbitrary gas price: {arbitrary_gas_price} ETH per Gwei")
print(f"Optimist gas price: {optimist_gas_price} ETH per Gwei")
Please note that this code snippet is for illustration purposes only and should not be used in production.
Disclaimer
The results of this experiment are based on a simple example and may not reflect real-world scenarios. Gas costs can vary significantly depending on several factors, such as network congestion, smart contract complexity, and transaction frequency. Always consult a trusted blockchain expert or resource before making any decisions about implementing your application.
Leave a Reply