Ethereum essentials: How to onboard to layer 2 roll-ups and measure transaction fees
Part 2 of the Ethereum essential series: what are roll ups, how to read an L2 transaction, fees and the role of roll-ups in DeFi wealth creation using Arbitrum
Dear frontrunners,
Our journey to wealth in crypto is measured in knowledge (learning) and conviction (doing). Conviction without knowledge is arrogance (YOLO) and knowledge without conviction is insecurity: think of all the people who are smarter than you but have not realized their full potential. Is this you? Why does this happen?
Our goal is to avoid this mental trap, our goal is to frontrun - to have high knowledge and high conviction. We do this by rejecting participation inequality, we do this through hands-on experience in the defi ecosystem.
This guide is part 2 of 3 in the Frontrun Ethereum-essentials handbook:
Guide 2 - layer 2 roll-ups and corresponding fees - ππ you are here
Guide 3 - Lend, borrow and borrow again: an introduction to leverage
These guides will collectively serve as your foundation for mastering the future of decentralized finance and the next generation of wealth creation.
π This guide will cover
Why you should care about roll-ups
Why roll-ups are the foundation for all retail decentralized finance activities
How to interact with roll-ups
Why transaction costs are the single most important reason to use a layer 2
π§° Tools you will need
A spreadsheet - I use google sheets
Hop exchange - Cross chain bridge to transfer tokens
aave - A borrow/lending platform on Ethereum
Arbitrum - Our layer 2 of choice for this guide
Etherscan - blockchain explorer to assess fees and contract interactions on mainnet
Arbiscan - blockchain explorer to assess fees and contract interaction on Arbitrum
Hop exchange - to move Ethereum from mainnet to Arbitrum
A web wallet like metamask
The web wallet needs to have eth in it
if this is not your case you will need to purchase Ethereum on a centralized like coinbase and move the eth to your web wallet
A basic understanding of eth gas fees (gwei, base, max, tip) and how they are all interconnected
π If the last two bullet point sounds unfamiliar, stop reading this guide and complete all activities outlined in βEthereum fundamentals - gas fees, etherscan and coinbaseβ first. We will be here when youβre ready, promise.
βFees are the reason you should care about roll-ups
We frame this guide by outlining why you should care about layer-2s before explaining what it actually is because humans are more inclined to pay attention if framed in a βwhats-in-it-for-meβ type of answer. There are many technical benefits to layer-2s like speed, security, and application-specific use cases (chains built for minting NFTs, chains built for social media, chains built for defi, etc) but the reason we, frontrunners, care about layer-2s is that transaction fees are between 3x and 100x cheaper than the Ethereum layer-1.
At the time of this writing, trading tokens yields a transaction fee of $4.99USD on Ethereum vs $0.22USD on Arbitrum. We can see the very real implications in transaction fee variance by performing identical transactions on AAVE with Ethereum vs AAVE Arbitrum. Below we are lending .02 eth on AVE to be used as collateral which generates yield.
We acknowledge that this transaction is a web wallet executing a smart contract that lends eth to an AAVE protocol. Not just a simple βperson-to-personβ transaction, but we reject the idea that it should cost $25 to lend $31.
There was a time when it was financially neutral to buy, sell, lend, borrow and trade on Ethereum layer-1 but that was pre-2020, not 2022β¦.
β¦and low fees were a byproduct of low user adoption as measured by transaction volume. In Q12020 aggregate daily transaction volume on layer 1 was approximately ~$168M. Even post-2022 bull-run, layer-1 is transacting north of $3 billion per day. An increase of 30x, as depicted below.
The Ethereum foundation does have a vision for the future which includes increased throughput via scalability and data compression through proposals like:
EIP-4844 Proto danksharding - introduction of BLOB data types to increase storage
EIP-4444 Danksharding- Decoupling of historical data from the EVM to reduce required storage and improve network utilization
β¦all of which could lead to reduced transaction costs, but the reality is that retail users will never realize optimal transaction fees on layer 1. The future of layer 1 is as the settlement layer through which institutional players and layer 2 protocols submit batches of transactions to be validated by stakers while concurrently benefitting from the security provided via ethereumβs virtual machine.
βοΈ Side bar - Ethereum virtual machine vs java virtual machine?
For those uncertain about the βEthereum virtual machineβ, a popular comparison that draws parity to a legacy web2 technology is the βJava virtual machineβ. In the 90s a company called Sun Microsystem (acquired by Oracle) developed a development framework called the βJava Virtual Machineβ which served as the execution layer through which developers could build βJava applicationsβ leveraging a set of pre-built libraries which inherit the security and interoperability of the most popular programming language of the early web2 era - Java. Developers would code apps in java which the compiler would convert to βjava bytecodeβ that would run on the JVM.
I see parallels to the Ethereum virtual machine in that developers build βapplicationsβ on the EVM which leverage a set of pre-built libraries to inherit the security (stakers verifying blocks) and interoperability (moving tokens across the Ethereum ecosystem) of the most used platform in the web3 era.
A very brief speed-run on layer 2s
Layer 2s, also called βrollupsβ, are protocols built on top of Ethereum layer 1 which aggregate transactions such that transaction volume increases while cost decreasesβ¦as depicted below.
Ethereum is constrained in that it can only process ~15 transactions per second or 1 million transactions per day, with the cost of transacting (gas) increasing as blockchain utilization increases.
L2s like optimism increase throughput from 15 transactions per second to > 500 transactions per second
L2βs like zksync push 50x faster by providing infrastructure to process > 20,000 transactions per second
Layer 2 technologies like optimistic and zksync provide the infrastructure for us to βbuy, sell, trade, borrow, lend and leverageβ with lower transaction costs. For frontrunners, we believe Ethereum is the ecosystem for a decentralized finance future, and our goal is to actively engage in this technology while reducing associated transaction fees. That is why we need rollups.
Now that we understand the purpose of L2s (increase transaction volume and reduce transaction costs) and how L2s work (by rolling up transactions into batches), itβs time to enter the rollup ecosystem.
π Transacting on layer 2 using AAVE + Arbitrum
Step 1 - Deploy the spreadsheets and take note of existing token balances
Navigate to aave
Switch the βmarketβ to version 3 - arbitrum
Open Arbiscan
Open Etherscan
Open your spreadsheet
In your first 100 days, every transaction you perform should be accompanied by a spreadsheet that outlines the transaction to be performed, the wallet balance before transaction execution, and the estimated wallet balance after the transaction execution. We must learn to love the details as it will enable us to become hyper-aware of fee implications and the movement of money across the blockchain.
Yes - we can start by reviewing the AAVE market UI to see a βdashboardβ of available tokensβ¦
..but letβs be sure.
Review the arbiscan blockchain explorer and create a table that outlines all of the tokens in your web wallet. Take note of the actual tokens and how AAVE delineates between supplied eth βaArbWETHβ vs borrowed eth βvariableDebtArbWETHβ, if youβve already supplied collateral.
π STOP - Does the balance of your arbiscan blockchain wallet explorer match the balance in AAVE? It should. Do not proceed until youβve documented the tokens used to derive the AAVE dashboard.
Note at its core, the value of AAVEβs borrow/lending platform is measured with the βaTokenβ . The aToken tokenomics (how tokens are created and how they accurate value) burns (destroys) and mints (creates) tokens relative to the underlying asset:
When you lend Ethereum on AAVE mainnet you receive βAAVE wrapped Ethereumβ tokens
When you lend Ethereum on AAVE Arbitrum you receive βAAVE Arbitrum wrapped Ethereumβ tokens
When you borrow variable debt eth against your collateral using AAVE Arbitrum you receive βVariable Debt Arbitrum wrapped Ethereumβ tokens
These tokens and their underlying asset are pegged to the value of the collateral you deposit.
Using table 1 as an example:
AAVE minted an βaArbWBTCβ of .00487135 which denotes the amount of wrapped bitcoin I supplied in a previous transaction
AAVE minted a βvariableDebtArbWETHβ token of 0.0300117328003628 which denotes the amount of eth I borrowed at AAVEβs prevailing variable interest rate
The aToken supplied/borrowed tokens are not actually exposed in the UI (you just see a screen that says you supplied some ETH and borrowed some in return) but should be noted and understood on the backdrop of a larger discussion related to how lending/borrow platforms work under the hood. We will cover AAVEβs tokenomics and how mint/burning works in parts 3 and part 4.
Action - before moving onto step 2, re-create table 1 using your web wallet balance.
Step 2 - Migrate eth from mainnet to arbitrum and analyze blockchain results
Open hop exchange
Only after youβve created a spreadsheet to track pre-transfer balances, are you ready to start the trade. We are using hop exchange as the token bridge from layer 1 Ethereum mainnet to layer 2 Arbitrum.
Hop exchange is one of many bridge technologies we can use to move eth from l1 to l2 but is by far the most popular. During Arbitrumβs odyssey summer 2022 event (which was paused due to over-participation), hop exchange was used for almost 8,000 transactions, it 2xβed its closest competitor, across.to .
DeFi portfolio managers like Zerion and Zapper also offer bridging technology that automatically routes the trade to the cheapest exchange. As frontrunners, we need to make sure to understand that we are moving eth tokens from βlayer 1β (mainnet) to layer 2β (Arbitrum) using bridge technology and our goal is to always leverage the bridge which offers the lowest transaction fee.
π STOP - Take note of the nominal eth amounts referenced in hop and cross-check against your web wallet in etherscan and arbiscan. The numbers must match.
In the example below we are moving .09 eth from the mainnet web wallet to the arbitrum layer 2 web wallet.
Since youβre documenting token balances in your spreadsheet, you will be able to estimate the starting and ending balances of each wallet (the wallet associated with mainnet and the wallet associated with arbitrum, both will have the same address) as well as the implications to the Ethereum balance when taking into account transaction fees.
π Starting with the mainnet wallet:
Using etherscan and your spreadsheet can answer all of these questions: How much eth moves from Ethereum L1 wallet to the Arbitrum L2 wallet? (.09 eth) What are the starting and ending balances of the Arbitrum wallet? (.018, .096) Do the transfer amount from L1 and Arbitrum reconcile against the balance? (yes, row4, row 7) How much did this transaction cost? ($2.37) All answerable below.
Moving .09 eth from mainnet to arbitrum cost ~.0014 eth or $2.37usd on layer 1. This is not magic. Transaction fees aka gas are the amount burned, amount tipped, and the amount returned and are all derived from the base (9.84 gwei) , priority (1.5 gwei) , and max amount (14.2 gwei) multiplied by the gas limit:
transaction fee = base(max + priority)* limit * 1 gwei/eth & price per coin = (9.84(14.2+1.5)*132,086)*(10^-9)*$1,585.35 = $2.37 USD
The image below outlines the reconciliation of L1 transaction fees depicted against the etherscan blockchain explorer.
Action - Calculate burned, tipped, and the actual gas used on your transaction
π Calculating transaction fees on arbitrum
Using our same spreadsheet and arbiscan we perform a similar analysis to determine the associated transaction fees on layer 2. Yes, transaction fees are imposed on both layer 1 and layer 2β¦.but do you see the order of magnitude difference?
The gas price for arbitrum is 0.1 gwei as opposed to 11 gwei on L1.
Much easier to understand, right? We can calculate the cost of gas by:
transaction fee = gas limit * gas price * 1 gwei/eth * price per coin = 250,933 * 0.1 x 10^(-9) * $1589.46 = $0.04 USD
In aggregate moving .09 eth cost 0.001494124041 eth on mainnet and 0.0000250933 eth on arbitrum.
Action - before proceeding, perform this calculation using your specific transaction on both mainnet and arbitrum. Does your math match whatβs in etherscan & arbiscan? It should. If you need more help review this guide.
Now that weβve assessed the impact on the L1 wallet and associated transfer fees on both L1 and Arbitrum L2, weβre now able to verify how the transfer of .09 eth impacted the Arbitrum wallet balance.
Doing this we notice something odd; the amount of eth received is greater than the amount of eth sent, even when accounting for gas fees.
We sent .09 eth from L1
We received .090002 eth on Arbitrum
β¦Yes, we can confirm that .09 eth was received by the Arbitrum wallet, but exploring the transaction details we actually received ~0.090002 eth. How? We see in the details:
the smart contract 0xDa7c0de432a9346bB6e96aC74e3B61A36d8a77eB which corresponds to hETH (hop exchangeβs Ethereum token collateralized by Ethereum) transferred .09 eth to an address ending in ac6d97β¦thenβ¦
..the smart contract which corresponds to wrapped ETH 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1 (wrapped eth) sent 0.090002158788826273 eth from the ac6d97 address to my target web wallet
Although I acknowledge that the variance is negligible, and is due to the price variability of the hETH and wETH-denominated tokens, it is still a value greater than zero. Regardless, what can we conclude with 100% certainty?
The estimated amounts in our web wallet e.g. metamask and the hop-exchange UI are not accurate:
You must always calculate the fees yourself. If you donβt start with small trades, you wonβt have the conviction to do it with larger trades. You will get rekted.
Wow that was alot.
We transferred .09 eth from L1 to Arbitrum L2 and reviewed the resulting balance. Sound simple? It is. This was heavy because what we can summarize from this analysis is a core idea, that if ignored, will be your demise: It is very easy to transfer money across exchanges and protocols. The actual process is only one step: click the send button in the hop exchange. But you must be able to explain how the tokens move from layer to layer, what happens to your actual token balance, what tokens are being minted/created, and how much youβre paying in the process. This level of detail will force you to assess associated fees and give you insight into how a smart contract works.
This is how you build knowledge and conviction. This is how you frontrun.
π Action for frontrunners:
Send eth from L1 to Arbitrum
Create two tables that document the associated transaction fees for each layer
Calculate the transaction fee and reconcile it against what you see in etherscan and arbiscan
Review the transaction details and assess what smart contacts were called and what tokens were used
You are the master of your destiny,
John Cook
September 6th, 2022
San Francisco, CA
www.frontruncrypto.com
Supporting content:
tweet of the week - is there any limit to your ambition?