Ethereum – Layer2 Scaling Solutions Overview
As explained in the previous articles, blockchains have to trade off within decentralization, security and scalability called "Blockchain Trilemma". Ethereum is highly decentralized and secure but the scalability is still at low levels.?It is well known that Ethereum is scalable up to 15-45 transactions per second. There is an effort going on upgrading Ethereum to increase the scalability by way of sharding. This would enable Ethereum handle more transactions per second but still it may not be enough for the ever-increasing participation in use cases like DeFi, gaming, NFT and many more to come and evolve. To fill the gap, layer 2 scaling solutions are trying to provide the scalability.
Layer2 is a collective term used for solutions designed to scale applications by handling transactions off-chain while taking advantage of Ethereum’s security and decentralization. In this context Ethereum Mainnet is known as layer1.
On-Chain scaling
This method of scaling requires changes to the main chain (layer1). With Ethereum 2.0 upgrade, scaling is going to be achieved by sharding the main chain. In database context, sharding is done by splitting the database horizontally to spread the load to achieve higher throughput. In Ethereum’s context, sharding means creating new chains known as shards. Having multiple shards would decongest a single chain (Mainnet in Ethereum) and thereby improve the scalability.
Off-Chain scaling
This method of scaling involves a layer2 solutions offering scalability but using the decentralization and security of the mainnet. There are different types of layer2 solutions and they are all centered around a cluster of nodes. These solutions can be run by individuals or businesses or a large group of entities. Users and dApps that use these layers2 chains submit their transactions to the layer2 instead of layer1. The layer 2 chain batches these transactions and submits them to the layer1. In this case the layer1 provides security and decentralization to these transactions. A specific layer2 instance may be public and shared by many applications or may be created by one project and used by only their applications. Below is overview of some of the scaling solutions.
Rollups
Rollups perform transaction execution outside layer1 and the state of transactions is then posted to layer1. Layer 1 takes care of the consensus and state is then added to the world state of Ethereum. As layer2 data/state is added to layer1, the security and decentralization is taken care by layer1. There are two types of rollups with different security models.
领英推荐
Optimistic rollup: This type of rollup assumes that the transactions are valid by default and run the computation only when a fraud is suspected.
Zero-knowledge rollups (ZK rollups): ?They bundle numerous transactions off-chain and generate a cryptographic proof, known as SNARK which is a validity proof and submitted to layer1.
State Channels
State channels allow multiple parties to transact number of times off-chain and submit the final state to layer1. Only two transactions are submitted to the layer1 thereby reducing the network traffic. The first transaction execution opens up the channel by locking the state on-chain. Then all the parties involved in contract can transact number of times on channel to achieve a particular business goal. Once the transacting is finished, the final state is submitted to layer1 and the state is unlocked. That is the second on-chain transaction. Locking and unlocking of the state on-chain is handled by a multi-sig (multi signature) contract deployed on layer1. Multi-sig contract is a type of contract that requires signature of multiple parties (using their private keys). Layer1 takes care of the security and decentralization of the state.
Sidechains
Sidechain is an independent EVM (Ethereum Virtual Machine) compatible blockchain that runs in parallel to the Ethereum Mainnet. They are connected to the Mainnet by a two-way bridge. They have their own consensus mechanism like proof of authority, delegated proof of state, byzantine fault tolerance etc. As the sidechains are compatible with EVM (or they are just a copy of EVM) any dApp can be ported to Mainnet or to any side chain from Mainnet just by deploying the code. While the advantage of sidechains is that they are compatible with EVM and more scalable, the downside is that they are less decentralized and are not secured by layer1. However, there are specific use cases where sidechains can shine.
Plasma
Plasma chain is a separate blockchain that is anchored to the Ethereum Mainnet. These chains are essentially smaller copies of the Ethereum Mainnet and sometimes referred as the “child” chains. They can have multiple child chains which are anchored to the parent chain by way of Merkle tree. Thus, Merkle tree allows limitless stack of plasma chains anchored to the Ethereum Mainnet. Plasma chains derive their security through fraud proofs. When a fraud is suspected, a fraud proof would run the transaction to check if the fraud took place.