Adam Bowmen posts information on how to use Loopring Layer2 (L2), what it is, how to onboard with swapping Ethereum without incurring the incredibly high ETH gas fees. Also useful information withdrawin from L2 to L1, making instant L2 transfers and how to trade on orderbooks.
Loopring L2 is the place where people can enjoy Ethereum by circumventing the biggest downside facing the network today: brutally high gas costs. Over the last 2 years Loopring has been dedicated to optimizing the L2 experience by supporting orderbook trading, transfers, AMM functionality, and NFTs (coming soon). Not to mention, we’ve reduced major costs along the way.
Now with a brand new web interface, our users are able to enjoy a better zkRollup experience. Below is a walkthrough guide about the new Loopring L2 web app, the layer 2 DEX built atop the Loopring zkRollup.
But first, we’ll answer two basic questions.
What is Loopring L2?
Loopring L2 is a non-custodial Ethereum decentralized exchange (DEX) built on the Loopring zkRollup. It is an orderbook-based and AMM-based DEX that replicates the high-performance, low-cost trading experience of centralized exchanges. Users can trade speedily & cheaply (without worrying about Ethereum congestion or gas fees) while maintaining self-custody control of their assets. The DEX is built atop the open source Loopring protocol.
Loopring L2 is more than just a DEX, as it also acts as a payment app. Users can send ETH and ERC20 token transfers to any Ethereum address instantly, cheaply, and securely on L2.
What is a zkRollup?
zkRollup is a type of layer 2 scaling solution on Ethereum, allowing much higher throughput and much lower costs, without sacrificing security. It does this by moving all of the heavy lifting (computations) off-chain, keeping the rules enforced and security intact by using validity proofs: cryptographic proofs attesting to what happened off-chain. Because Ethereum verifies these proofs, and stores enough data to tell exactly which off-chain account owns what, zkRollups inherit the same non-custodial security as Ethereum, but can run much faster. For more in-depth technical info, read our Design Doc.
Table of Contents
- How to onboard Loopring L2 on desktop
- How to make instant transfers on Loopring L2
- How to swap tokens gas-free
- How to add liquidity to an L2 AMM pool
- Finding the highest earning pools on Loopring L2
- How to remove liquidity from an AMM pool
- How to trade on the orderbooks
- How to Withdraw From L2 to L1
We’ll focus on the Loopring L2 web platform in this guide, but note that all the L2 tactics you learn here can be applied similarly using your Loopring Wallet as well. If you’re more technical, you can also interact with L2 via our relayer API.
How to get onboard L2
Head to Loopring L2. Click ‘Connect Wallet’ and link up your MetaMask, MEW, or a WalletConnect compatible wallet (Loopring Wallet is WalletConnect compatible).
2. With your wallet connected, you will see it says “Deposit to Activate Layer-2”. Click that. Choose an asset to deposit, and the amount. Confirm the transaction in your wallet to execute the deposit. After 18 Ethereum confirmations, you’ve made it to the zkRollup!
Note: Since depositing is an Ethereum layer-1 transaction, meaning it moves (bridges) from L1 to L2, this costs gas. It is approximately just the gas cost of a normal token transfer. Pay this gas cost once, and then you are on L2 with those assets, living gas-free for as long as you’d like.
As mentioned, you must deposit your assets into a smart contract to get onto L2. This contract receives your assets and ‘maps’ them to your slot in the Merkle tree, which you — and only you — control. You can withdraw your assets from the contract whenever you like, even if Loopring disappeared or turned evil (only Ethereum needs to exist for your assets to be safe).
Pro tip: Some people are apprehensive about paying a gas fee just to get on L2. But truth is, it is cheaper to deposit to L2 once than it is to do one Uniswap trade. Depositing ETH and most ERC20 tokens onto Loopring is ~60k gas whereas a swap on Uniswap costs around ~120k gas per swap. And you only need to migrate once! The rest of your token swaps are gas-free!
3. There should be an ‘Unlock’ button. Go ahead and click that. This asks your wallet for a signature to unlock your L2 account. It is a signature, not a transaction, so no gas fee!
This ‘Unlock’ button will appear every time you access your L2 account from here on. It’s the equivalent of logging on, but just needing your Ethereum address to sign a transaction with one click.
Once you’re logged in, you can check out your Loopring L2 balances, deposit other assets, or withdraw back to L1 by click on the “Account” tab.
For other deposits, you simply do this same process again (which costs gas since it is from L1). When you deposit any asset besides ETH (any ERC20 token), the deposit contract will first ask you for permission, aka a ‘token approval’, allowing it to interact with your respective token. You may be familiar with this pattern from all other Ethereum apps. This costs gas, since it is an L1 operation, but this token approval tx happens just once per token. Future deposits of the same token will just have the deposit tx, not the approval.
How to make instant transfers on Loopring
The ‘Transfer’ button is also where you can send assets on L2 to any other Ethereum address — whether they have previously used Loopring L2 or not. It is ideal for payments, especially frequent ones to many people!
All you need is someone’s Ethereum address or ENS name, choose the asset and amount, and you can send them an instant, gas-free transfer on L2. You can even add a memo. Click ‘Transfer’, sign the request, and it is sent.
Note: Never send an L2 transfer to a Centralized Exchange (CEX) as many do not support Loopring yet — only transfer to wallets that you know can access Loopring L2.
How to swap tokens gas-free
Loopring L2 supports both types of Ethereum DEX ‘market structures’: orderbooks and Automated Market Makers (AMMs). First let’s look at swapping on the AMM.
On Loopring L2 , click on the ‘Trade’ tab at top and then select ‘Simple’. Choose your pool (each pool has two assets you can swap between) and which way you are swapping. Choose your amount to swap.
The AMM pool will automatically show you the exchange rate.
You will also see the minimum amount you are guaranteed to receive from the swap. You can adjust the slippage tolerance on the right hand side. Just beware of the price impact in some illiquid pools!
Currently, Loopring fees are 0.3% for the swap. 0.2% of that goes to liquidity providers (LPs), the remaining 0.1% goes to the relayer and protocol fee. Fees are taken from the token you are buying. Remember: there are no gas fees!
Once you’re ready, click ‘Swap’ and your transaction will be executed instantly. No delay, no gas fee. Your L2 balance will be updated. You can see your swap history and the fees you paid in the Layer2 ‘Orders’ tab.
How to add liquidity to an L2 AMM pool
Liquidity providers (LPs) currently earn 0.2% fee from all trades in the pools they provide liquidity to, proportional to their share of that pool. To become an LP, you simply deposit an equal value of both assets in the pool.
To become an LP on Loopring, head over to the ‘Pools’ tab on top, and choose which pool you want to provide liquidity to. Click ‘Add’.
To add liquidity to a pool, you need an equal value of both assets, which gets deposited to the pool at the prevailing exchange rate of that pool. That is, if you want to become an LP in the LRC-ETH pool, you would need $100 worth of LRC and $100 worth of ETH.
Choose the amount you want to add from one asset or the other. The UI will automatically prompt you to deposit the other asset quantity given the exchange rate at that time to ensure an equal value. Then click ‘Add Liquidity’.
Your deposit will execute immediately.
While depositing to a pool is gas-free, there is a small fee associated with the transaction. This is because the operation, even though done on L2, has a smaller corresponding L1 gas cost. So the cost varies with gas prices on L1. At time of writing, it is 0.008 ETH.
Your position in the pool will be represented by LP tokens which you hold on L2. You can see your LP tokens for a given pool and the percentage that it represents on the ‘Pool’ page. You can also see your LP tokens in your ‘Balance’ under ‘Account’, since it is effectively an asset like any other. The name of an LP token for the LRC-ETH pool for example would be LP-LRC-ETH.
To see your AMM Liquidity positions, click ‘Layer2’, and then ‘My Liquidity’. There you will see your total position value and fees rewards from providing AMM liquidity.
Note: being an LP is not risk free. You face the potential risk of ‘impermanent loss’ just like with most other AMMs.
Finding the highest earning pools on Loopring
Under ‘Pools’, here you’ll see the liquidity in each pool, the volume, and if there are any LRC liquidity mining or other incentive programs.
All of this ultimately leads to an APR (annualized percentage rate) column, so you can see the expected return you’d earn from being an LP in that pool.
To learn more about liquidity mining on Loopring L2, read this. There are liquidity incentives provided in LRC and other tokens for certain AMM pools. These incentive campaigns change in 28-day cycles, so keep an eye on the AMM pools page and our Discord for updated APRs and cycles.
If you’re interested in liquidity mining, all you have to do is be an LP in the relevant pools. There’s nothing more to do. Just hodl!
The liquidity mining rewards are automatically sent to accounts on L2 at the end of the 28-day cycle.
Note: There are also rewards for traders! Users with high swap volume in a given pool are rewarded. Click ‘AMM Swap Tournament’ to learn which pools are being incentivized and with how much in rewards. This also changes in 28-day cycles.
How to remove liquidity from an AMM pool
On the ‘Layer2’ tab, you will see ‘My Liquidity’ which shows you the pools currently have assets in. You can go ahead and click ‘Remove’.
You will be prompted to decide how much of your assets you want to withdraw from that pool. Decide the amount, which effectively means redeeming your LP tokens for that portion of the underlying two tokens.
You will see the amount of each token you will be getting back in return. Please note that there is a very small fee when removing liquidity from a pool!
Note: This amount you are removing includes any fees you have earned throughout your time providing liquidity. LP fees (0.2%) automatically accrue to the pool every time someone swaps with that pool. This enlarges the pool for all LPs, so when you remove your liquidity, you are taking your share of the fees with you.
There is a fee to remove liquidity from the AMM pool. This is because the operation, even though done on L2, has a smaller corresponding L1 gas cost. So the cost varies with gas prices on L1. At time of writing, it is 0.01005 ETH.
How to trade on the orderbooks
Loopring is more than just an AMM. It is also an orderbook DEX. So if you rather ‘trade’ a pair on the books rather than the pool, head over to the ‘Trade’, tab at top and then select ‘Professional’
There you will see the familiar orderbook layout, displaying bids and asks, a price chart, price history, etc. Note: sometimes the orderbooks has different asset pairs than the AMM pool. Especially stablecoin to stablecoin pairs.
The orderbook supports limit orders, meaning you can state the price you want to buy or sell at, and leave it resting on the books. Someone can then come along and fill your order. This way, you are guaranteed to get the price you want.
The orderbook also supports market orders, meaning you can buy or sell at the prevailing best ask or bid. It is important to note that when making a market order, you don’t have control over the price that you will pay — the order will fill with the best available liquidity there is.
Makers receive rebates on their orders that get filled on the books. The rebate is 0.02% (2 bps). So any resting limit order you have that gets taken by another user, you earn 0.02% of that amount — i.e., a negative fee!
Note, in addition to maker rebates, there is also often liquidity mining for orderbook pairs! This incentivizes users (especially market makers or algorithmic traders) to place tight resting limit orders on the books, and receive rewards for providing that liquidity (being a maker) for others to take. Learn more about how orderbook liquidity mining works here. If you want to plug into the orderbooks to trade or MM programatically, here is the API. You may also want to plug into an existing market making software that is connected to Loopring L2 DEX, such as Hummingbot!
On the ‘Layer2′ page you can click on the ‘VIP’ tab to see your trading fee tier level as well as the amounts needed to upgrade.
Your Loopring VIP level is determined by the accumulated 30-day transaction volume and/or LRC balance in a users L2 account. The higher the VIP level, the more discounts on transaction fees that user will enjoy on our orderbook.
How to Withdraw From L2 to L1
On the ‘Layer2’ tab, you can withdraw assets from your Loopring L2 account back to Ethereum L1. Remember, a big virtue of zkRollups is that you can withdraw at anytime — your funds can never be stolen, frozen, or seized by Loopring.
Select the asset you want to withdraw and the amount. You can withdraw to a different address than your own; not just moving from your L2 to your L1, but from your L2 to a different L1. Either a different address of yours, or a friend, etc.
But by default, your own address is entered. Click ‘Withdraw’ and you will be prompted to sign a message, and that’s it.
Due to the aggregation of a zkRollup, and since it’s an L2 to L1 interaction, withdrawals can take some time until the ‘train wants to leave the station from L2 to L1’.
It can be 5 to 30 minutes to withdraw, or a few hours depending on a couple variables. With more activity on L2, it will actually be much shorter, since trains will leave the station more frequently as seats fill much quicker and more consistently.
There is a fee to process a withdrawal, since the Loopring relayer has costs in processing these withdrawals (compute power for the ZK proofs, and the overhead gas cost to publish a rollup block to Ethereum). This fee fluctuates with L1 gas fees, and is usually less than half the cost of token transfer on L1.
Our ‘fast withdrawals’ feature will be added as a feature to our new web interface soon. So if you’re in a rush to move from L2 to L1, this allows you to withdraw to L1 in the very next Ethereum block, you just pay a higher fee for the expedience.
Congratulations! You are at the cutting edge of Ethereum.
Layer 2 is the present and future of Ethereum scaling and will actually be magnified and scaled further by the rollout of Eth 2.0, not replaced by it. L2s will support a massive amount of economic activity, while L1 will be where rollups settle their big batches of txs representing all the user activity off-chain. L1 will be the settlement layer (or for whale movements), L2 will be the environments where most users actually ‘live’ and use applications.
If you completed this guide, then you are ahead of the pack in seeing what the future of finance looks like.
If you’re an Android or iOS user, you can check out the mobile smart wallet and have the power of Loopring L2 in your pocket.
Thanks, and have fun on L2!