Ethereum: Gas usage of same/similar contract interaction on arbitrum vs optimism

·

Comparing Gas usage of Safe 4337 Accounts on Arbitrum and Optimism

Account on both the Arbitrum and optimism blockchain networks. The results were surprising, with significant differentences in gas costs between the two platforms.

The Experiment

Wallet protocol, which allows users to interact with various contracts without revealing their private key. 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 both chains using the arbiscan.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 weai (1 wee = 0.000001 eth) |

| Optimism 0.012 eth per Gwei |

As you can see,

The Reason Behind the Difference

Contracts, I Analyzed One key factor controling to

V2 (UPX), Sushiswap, and Curve Protocol Use Complex Gas-Saving Techniques that Reduce Gas Costs. Simple, direct interactions with other chains, which are more expensive due to the additional layer of abstraction.

Conclusion

The optimist can be significantly cheaper than doing so on arbitrum. As the demand for scalability and cost-effectiveness grows,

While optimist is gaining popularity among users who require more advanced use cases or lower gas costs

code

Package on Github:

`python

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 WEI to eth per weai

Deploy and 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: {ABITRUM_GAS_PRICE} ETH PER WEI")

Print (F "Gas Price Optimist: {Optimist_gas_price} eth per weai")

Note that this code snippet is for illustration purposes only and should not be used in production.

Disclaimer

. Gas Costs can vary significantly depending on various factors, such as Network congestion, smart contract complexity, and transaction frequency. Deploying your application.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *