Comparion Gas Usage of Safe 4337 Accounts on Arbitrum and Optimism
In recent weeks, I conducted an experiment to compare the gas usage of creating a safe 4337 account on both the arbitum and optimism blockchain networks. The results were surprising, with significant differentials in gas costs between the two platforms.
The Experiment
To create a safe 4337 account, I used the Safe 4337 Wallet Protocol, which allows users to interact with various contracts without their private keys. I then set up 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
I collected gas usage data from bothscan.io interface, which provides real-time information about gas prices and transaction costs. Here are the results:
| Chain | Gas Price |
| --- | --- |
| Arbitrum | 0.008 ETH per Gwei (1 GWEI = 0.000001 ETH) |
| Optimism | 0.012 ETH per Gwei |
As you can see, the gas price for creating a safe 4337 account on optimist was approximately 25% higher than that on arbitrum.
the reason behind the difference
To understand why this difference exists, I analyzed the contracts deployed on bothins and their interactions with each other. One key factor contributing to the discrepancy is the use of gas-intensive contract interactions between SAME/similar contracts on different platforms.
On Optimist, many popular contracts like Uniswap V2 (UPX), Sushiswap, and Curve Protocol Use Complex Gas-Saving Techniques that Reduce Gas Costs. In contrast, arbitrator's contracts of rely heavily on simple, direct interactions with other chains, which are more expensive due to the additional layer of abstraction.
Conclusion
These findings suggest that creating a safe 4337 account on optimist can be significant cheaper than doing so on arbitrum. As the demand for scalability and cost-effectiveness grows, it's essential to consumed these differentences when chosing between different blockchain networks.
While optimist is gaining popularity among users who require more advanced use cases or lower gas costs, arbitration 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 theSafe-4337 ‘Package on GitHub:
`Python
Import Requests
Def Get_Gas_Price (Chain):
Response = Requests.get (f "
Gas_price = int (response.text.strip () Split ("GasSrice:") [1]. Split (";") [0])
Return Gas_price / 100000000
Convert Gwei To ETH Per 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 "Arbitrum gas price: {Arbitrum_gas_price} Eth by Gwei")
Print (F "Optimist Gas Price: {Optimist_gas_price} Eth by Gwei")
Note that this code snippet is for illustration purposes only and should not be used in production.
Disclaimer
The results of this experience are based on a simple example and may not reflect real-world scenarios. Gas costs can vary significantly depending on various factors, such as network constion, smart contract complexity, and transaction frequency. Always consult with a reliable blockchain resource or expert before making any decisions about deploying your application.