Layer 2 brings scalability to Ethereum by abstracting individual transactions away from the underlying blockchain, whilst maintaining the highest levels of security. The technology enables high-speed, low latency and in some cases, private transactions, giving traders all the benefits that they are used to on a large exchange such as Coinbase, but without giving up custody of their funds.
This post will give an overview of the different types of scaling technology as well as a simple guide to using the DeversiFi DEX
Over the past 12 months a category of technology that is known as ‘rollups’ has become synonymous with L2. A rollup is a kind of scaling solution whose security is guaranteed by the underlying Ethereum blockchain. This is an important distinction to make as other types of scaling technology purport to be L2, when in actual fact they do not have as strict security guarantees.
Within the rollup category, there are two main types – zero knowledge rollups and optimistic rollups. Each has its own benefits and drawbacks for different types of exchange use case.
Zero knowledge rollups (zk-rollups) abstract all transactions away from the underlying blockchain using zero knowledge cryptography such as Snarks or Starks. Each transaction is submitted to a Merkle tree and then periodically a zero knowledge proof is generated and sent to a smart contract for verification. It is this proof that is submitted periodically to the Ethereum blockchain, meaning that thousands of individual transactions can be submitted in just one main ‘batch’ or proof. This enables thousands of transactions per second (tps) to be processed whilst at the same time ensuring the strictest of security guarantees.
In the case of Optimistic rollups, a network of verifiers is needed to ensure the validity of each transaction that happens in the layer two. Instead of a smart contract checking the validity of transactions, the network of validators can challenge the operator in what is known as a challenge period. This challenge period may need to stretch for several days or weeks to ensure that enough validators are able to check enough of the network for ‘cheating’
In the event that the operator of either the zk-rollup or the optimistic rollup is proven to have cheated the system, the state of all participants’ balances is rolled back to the last stable state. In the case of a zk-rollup, this would be the point at which the last batch/proof was submitted and would likely be a few hours previous. In the case of optimistic rollups, the period that the trader’s balance is rolled back could be much greater. Importantly, all participants can retrieve their funds back to the main Ethereum chain, but may have suffered some opportunity cost due to the lost time period where the operator was proven to have cheated.
Zk-Rollup vs Optimistic Rollup
Earlier in this article we established that despite zero knowledge and optimistic rollups working slightly different, both have strong security guarantees and participants tokens & funds are safe. But what are the advantages and tradeoffs between each?
Put simply, zk-rollups are suited for high performance specific use cases, where high transactions per second and fast finality is needed. Optimistic rollups on the other hand take the edge in terms of composability and openness, as they are able to much easier to support an Ethereum Virtual Machine environment (or similar) via their Optimistic Virtual Environment meaning that projects can copy and pasts their existing smart contracts into the environment without having to make any complex code changes.
Layer 2 Exchange Guide
DeversiFi was one of the first projects to launch a zero knowledge rollup type exchange in 2020. DeversiFi goes one step further and is the first L2 project to implement privacy for its customers. Swapping, trading and investing is all hidden from prying eyes, meaning that no one can reverse engineer your strategies or follow your activity unless you want them to.
Getting setup on the DeversiFi layer 2 exchange is quick and easy. Follow the below steps or watch the video guide to see how to connect and deposit to DeversiFi for the first time.
Go to app.deversifi.com and connect your wallet using the ‘connect wallet’ button in the top right hand corner of the exchange. If you already have your wallet open, then you may see a popup asking you to sign a message. This is a completely safe step and is not a transaction – signing the message just lets DeversiFi know that you have an active wallet.
You are then presented with a variety of different wallet options. Wallets are the interfaces that act between your Ethereum address and DeFi products & services. Each wallet has its own advantages and disadvantages – for example, web based wallet such as Metamask are quick and easy to use, but hardware wallets such as Ledger wallets are more secure.
In this example we are going to connect and deposit using the Metamask wallet. It is important to note that if you are connecting via Metamask then you need to use the browser extension for Chrome, Firefox or Brave. Is is not possible to use the Brave in-built Metmask wallet (as this is an older version that doesn’t support all of the advanced functionality needed to trade on a L2) and it is not possible to use a combination of Metamask with a hardware wallet. If you wish to use a hardware wallet then you can select the Ledger direct connection
Once you have selected the option to connect via Metamask you will be asked to unlock your wallet. This does not cost any gas, is a one time thing and allows your wallet to interact with DeversiFi
Great, now you are ready to make your first deposit. Click the ‘Make Deposit’ button at the top of the page or the deposit button in the deposit widget on the right hand side of the page.
You will then be able to select the Ethereum ERC20 token or ETH asset that you would like to deposit.
Note – It is important that you have some ETH in your wallet in order to pay for the deposits and withdrawal to/from the exchange
For non-ETH deposits (eg other ERC20 tokens such as BAT, AAVE, Uniswap, Sushi, YFI etc) you will need to unlock deposits (approve) for each separate asset one time only.
Once you have selected the asset that you would like to deposit you need to click the confirm button and confirm the transaction using the popup confirmation from your wallet. Make sure that you select the Medium or Fast option to process the transaction to make sure that you’re not left hanging.
The cost of the deposit transaction is dependent on Ethereum network congestion and therefore you may wish to wait for a less congested time of day or weekend when gas prices are lower. The good news is, that once your assets are deposited to DeversiFi you can trade without paying gas!
Once the transaction in step 4 has been mined, you will see a block countdown timer appear in the deposit widget, showing how long it will take for your tokens to be ready for you to trade on the layer 2 exchange. You simply need to wait 10 blocks (about one minute) before you are ready to go
Congratulations, you have now deposited and are ready to swap, invest and send your tokens without paying gas!
DeversiFi makes DeFi easy. Swap, Invest and Send without paying Ethereum network fees.