Layer 2 (L2) solutions and Implications of Ethereum successfully moving to L2.
Blockchain technology is designed to offer us great benefits. like immutability, trust less transactions (no third-party needed), decentralization and high level of security. But in order to address one of the major problems of the blockchain network, layer 2 solutions were introduced.
Layer 2 refers to a secondary framework or protocol that is built on top of an existing blockchain system. The main goal of these protocols is to solve the transaction speed and scaling difficulties that are being faced by the major cryptocurrency networks.
In a broader sense, layer 2 protocols create a secondary framework, where blockchain transactions and processes can take place independently of the layer 1 (main chain). For this reason, these techniques may also be referred to as “off-chain” scaling solutions.
Over the years, bitcoin and Ethereum have still not been able to process thousands of transactions per second. This makes it much difficult for scalability and total adoption of these networks, because it hinders the network being used on a wider scale.
Because of the scalability trilemma (between scalability, security and decentralization) present on the blockchain, different layer 2 solutions have been created, with their own peculiar mechanisms and particularities, which aim to address and increase the throughput of the blockchain networks/systems.
This simply means that, the layer 2 solutions are designed to increase the speed and efficiency of blockchains. They were created to increase throughput or the number of transactions per second (TPS), which encourage scalability, address the area lacking in security and remove censorship to ensure decentralization.
In an ideal case, blockchain should be able to handle thousands of transactions per second but bitcoin handles only about 3–7 transactions per second and that’s limiting.
Examples of layer 2 solutions include Bitcoin Lightning Network, Ethereum Plasma, Zk (zero knowledge) Rollups and optimistic rollups.
The Lightning Network for Bitcoin, is based on state channels, which are basically attached channels that perform blockchain operations and report them to the main chain. State channels are mainly used as payment channels.
The main idea of the Ethereum Plasma is to establish a framework of secondary chains that will communicate and interact as sparingly as possible with the main chain (in this case, the Ethereum blockchain). The framework is being designed to operate as a blockchain tree, which is arranged according to hierarchy, in a way that numerous smaller chains can be created on top of the main one. These smaller chains are also referred to as Plasma chains or child chains.
The Plasma structure is built using smart contracts and Merkle tree which both enable the creation of unlimited number of child chains which are simply replicas of the Ethereum blockchain.
The amazing thing with child/plasma chains is that more plasma chains can be built on the existing plasma chains.
Rollups
Rollups are solutions that move transaction computations off-chain, but store transaction data to the Ethereum chain, which means that rollups are secured by Layer 1.
ZK (Zero-Knowledge)Rollups and Optimistic Rollups are the two new layer 2 solutions that are currently most built-on solutions. (They have different protocols being built on them like SYS, METIS)
Zk Rollup is a L2 scaling solution in which all funds are held by a smart contract on the main chain, while computation and storage are off-chain. For every rollup block, a state transition zero-knowledge proof (SNARK) is generated which includes proof of validity of every transaction. Examples of Zk rollups include Zk Sync, Immutable-X, Loopring
Zk rollups are said to be more advantageous than the optimistic rollup since it is significantly quicker. This is mainly because the validation occurs on the main-chain and validation occurs quickly. Zero-Knowledge rollups are more scalable now and have a maximum transaction of 2000 transactions per second.
Like Zero-Knowledge uses validity proofs, optimistic rollups use fraud proofs. Optimistic Rollups depend on a user submitting a new state root to the sidechain without validating the Rollup contract.
They assume that all transactions are valid and submit batches without performing any computation whatsoever, which can lead to significant improvements in scalability.
Yes! Just like it said, the contract does not need any verification. But then there are witnesses to the transactions going on, on L1(Layer1). These witnesses will invalidate a malicious state root if they choose. Optimistic Rollups take more time than Zk rollups because they have to wait for the smart contract on L2 before validation occurs. This makes it a bit more difficult to scale.
Examples of optimistic rollups include Arbitrum.
The most important difference between the two types of rollups is the verification process in each of the solutions.
In the case of ZK rollups, cryptographic proofs are generated that may be used to validate the legitimacy of transactions. Validity proofs are generated for each batch of transactions and sent to the main chain for validation.
One of the biggest strengths of optimistic rollups stems from the fact that they do not perform computation by default, which can lead to significant scalability gains — estimates suggest that optimistic rollups can offer up to 10–100x improvements in scalability. On the downside, the need to have a challenge period means that withdrawal periods are significantly longer than ZK rollups.
Another big advantage of optimistic rollups is that they are capable of executing smart contracts, whereas ZK rollups are mostly limited to simple transactions.
It’s vital to highlight that the speed differential isn’t significant in human perception. However, in terms of computational performance, there is a considerable disparity.
One of the main advantages of using off-chain solutions is that the main chain doesn’t need to go through any structural change because the second layer is added as an extra layer. As such, layer 2 solutions have the potential to achieve high throughput without sacrificing network security.
In other words, a great portion of the work that would be performed by the main chain can be moved to the second layer. So while the main chain (layer 1) provides security, the second layer offers high throughput, being able to perform hundreds, or even thousands, of transactions per second.
Ethereum and Layer 2
We’ve looked through the layer 2 solutions but let’s try to look into the implications of layer 2 on Ethereum. Ethereum blockchain has made it known that they choose to make use of the Optimistic rollup due to it’s ease in scalability.
Yes, scalability. Even though Zk rollups look like they are more advantageous than optimistic, several points were raised. One being that optimistic rollups are more cost effective than Zk rollups because it incurs cost for every instruction on the smart contract. This is expensive for Zk rollups because, constructing expensive elliptic-curve based proofs is a very large added cost while Optimistic rollups use nodes to execute and track transactions.
Another reason is the ease of compatibility between the rollups and EVMs (Ethereum Virtual Machines). Optimistic rollups have it much easier to communicate with EVMs available.
There is also the issue of Zk rollups not having trustless visibility and including “compression” of data. Zk rollups proofs prove that only the prover knows the valid chain and you cannot go back to trace or reconstruct transaction history even if you have the data.
Ethereum chain making use of sharding as their method of scaling makes a lot of things easier. Sharding is the process of splitting a database horizontally to spread the load. This firstly, increases the throughput or number of transactions per second and reduces the network congestion on Mainnet Ethereum.
Also, gas fees are significantly reduced because transactions are rolled up into a single transaction on the Ethereum Mainnet.
Which is basically what everyone is waiting for. But trouble for other Layer 2 networks because of competition.
It’s safe to say that the future of the layer 2 solutions on scalability has not been solidified but in the coming years, we are sure to find improvements and switch ups to present protocols available. Which will lead the race? Let’s find out.
-oracle.e