Today we will explore layer 2 scaling solutions. With the high cost of Ethereum gas fees at the moment, we decided it was an appropriate topic to delve into.
But Why Do We Need Layer 2’s In The First Place?
All blockchains have their limitations. They make tradeoffs to provide a specific service to their end-users. Vitalik Buterin, the creator of Ethereum, has dubbed it the blockchain trilemma
The triangle above helps you visualise the trilemma. Blockchains, as they currently stand, can only be designed to emphasise two of the three sides. You can be secure and decentralised, scalable and secure or decentralised and scalable. Blockchains like Bitcoin and Ethereum currently are secure and decentralised. Still, they lack substantial scalability and therefore opens up the opportunity for others to improve the service, but there is always a tradeoff.
Who Needs Layer 2’s?
Firstly you need to match the use case to the blockchain. Specific use cases like gaming or gambling require fast transaction times, and Ethereum doesn’t currently cater to these.
In addition to this, as the number of people using the Ethereum blockchain has grown, it has started to reach the upper limits of its transaction capacity. As a result, the transaction costs on the Ethereum Network have increased significantly. It has made some applications unnecessarily expensive to use. This limitation has provided the opportunity for other projects to step in and help the base chain, in this case, Ethereum, scale and improve its transaction speed and transaction throughput.
The other reason people have decided to leverage layer 2 solutions is for privacy. Businesses and companies may not want all their data published and visible to a global audience. Therefore they can create a permissioned layer that they can access and conduct business on while still leveraging the benefits of the layer 1 network.
What Is A Layer 2?
Layer 2’s sit on top of their parent blockchain. These layer 2 solutions can be run by anyone, whether it be a business or a large group of individuals. The way it works from a high level, in general, is that users of the network will broadcast their transactions to the people running the layer 2 software instead of the underlying blockchain. They will then batch the transactions into groups and then “anchor” them to the underlying blockchain (layer 1), where they are now irreversible. Reducing the load on the layer 1 blockchain makes it easier to create cheaper and faster applications.
Layer 2 Designs
Just how base layer blockchains have to make tradeoffs when it comes to their design, so will layer 2’s. There are different ways to design scaling solutions, which we will dive into below:
Rollups are one of the most popular methods and have been touted as the best method before the launch of ETH 2.0 by Vitalik Buterin.
Rollups will execute transactions outside the layer 1 blockchain and then post the data back to layer 1, where consensus is reached. The transaction data is included in layer 1 blocks and will inherit the security of the underlying blockchain. In order to further increase security, the people computing rollups are required to put us some form of financial collateral that will be taken away if they are caught trying to game the system.
A sidechain is its own blockchain; it runs “parallel” to the layer 1 chain. There is a lot of flexibility to this approach as you can choose your own consensus mechanisms and rules. However, this introduces security concerns because you now need to trust the people running the consensus, and it becomes less decentralised. However, this can be appropriate for enterprises and other use cases when you trust all those involved in consensus.
State Channels allow participants to transact any number of times off-chain while only submitting two on-chain transactions to the layer 1 network. In order to do this, one must “lock” a certain amount of funds in a special smart contract that requires two or more people to “sign” the transaction to process it. Once you have deposited funds into the smart contract and all parties sign saying they are happy to go ahead, you can now perform as many transactions as you want between one another off-chain (keeping a detailed record). Once everyone has finished making their transactions, the balance owed by everyone will be netted off, and once all parties are happy, they will “sign” the transaction, which will trigger the smart contract to make a payout to your wallet plus or minus what is owed. There is usually a high cost in setting up and settling a state channel, so it is not useful for the occasional transaction. Still, it can be very effective when there is a high volume of transactions expected between parties.
Plasma chains are a bit more complicated. A plasma chain is also a separate blockchain (similar to sidechains), but it is anchored to the Ethereum main chain and uses fraud proofs like rollups to ensure that the chain remains truthful. These smaller or “child” chains are essentially smaller copies of their layer 1 counterpart, and there can be hundreds and thousands created. There are several cons to using this method, including longer withdrawal times and the need to rely on operators to store the data.
Below you will find a summary of the different approaches and their designs (don’t worry, you don’t need to understand all of it):
All the above scaling solutions come with their own benefits and tradeoffs. We have seen layer 2 projects finding momentum and have become an investable theme in the general digital asset industry. Projects like Polygon have appreciated over 7000% this year alone. The trick is that you want to preserve the decentralisation and security of the base chain.
Yet, it remains to be seen if the introduction of ETH 2.0 negates the need for scaling solutions or if they can complement one another and create a world where scalability is really just an afterthought in blockchain design.