With the introduction of the concept of blockchain technology, which became popular with the launch of Bitcoin in 2009, people began to use different ways to make financial transactions and transfer data.
Over time, everyday users, traders, investors and developers have found new use cases, and constantly benefited from a technology that aims to be transparent, decentralised and without borders.
But, as it usually happens, as new technologies become popular they also start showing drawbacks.
In the case of blockchains, top concerns around the sustainability and expensiveness of blockchain-based transactions needed new solutions.
Layer 2 scaling solutions are among them. In this article, we will define this type of solutions, the main categories, why they matter when it comes to scalability, and why they differ from layer 1 blockchains.
Contents
What do layer 2 scaling solutions do?
The most common use case of blockchains is their capability to work as digital ledgers for crypto transactions. When it comes to private blockchains, they don’t necessarily need cryptocurrencies to work, but if we only focus on public and decentralised blockchains, cryptocurrencies are their fuel, and the vehicles for the distribution of value and data.
Layer 2 solutions aim at solving the major drawback of certain popular blockchains: scalability.
What is scalability in crypto?
Scalability refers to the capability of blockchains to manage increasingly higher amounts of transactions and nodes without giving up on speed, security and performance.
Finding an all-in-one solution that can meet all these needs is not an easy task. The Ethereum team summarised this task on the official website of the popular blockchain-based network.
The so-called “Scalability Trilemma” can be explained as follows:
- To make a blockchain faster, a simple solution could be to make it more centralised. In fact, the lower the number of nodes, the faster the blockchain, if you consider that each transaction should be sent to the whole network to allow transactions to be validated.
- But higher levels of centralisation pose risks to security. Decentralisation avoids the risks of manipulation of the network and attacks. At the same time, a higher number of nodes can pose another type of risks to security: consider transactions as messages that fly until the node intercepts and validates them. The longer the time needed for validation, the higher the risks of flying data that are not timestamped and included in the immutable ledger – the blockchain. A solution could be to increase the power of nodes.
- But the higher the power needed, the fewer the number of entities that have enough resources to work as nodes, and this poses a new risk to decentralisation.
Given this trilemma, layer 2 solutions can come to the rescue by avoiding dramatic risks to security and decentralisation.
Layer 2 solutions: functioning and most common categories
Layer 2 solutions represent different types of protocols built on top of layer 1 blockchains. At this point it is important to understand the difference between layer 1 and layer 2 solutions: while layer 1 are the main infrastructure of the blockchain – that is, the very ledger, layer 2 solutions are built on top of mainnets to improve their scalability and performance.
Layer 2 solutions have mainly three goals:
- Improve transaction speed,
- Reduce costs,
- Maintain high levels of security and privacy.
There are different types of layer 2 solutions, and we will focus on the most common: optimistic rollups and zero-knowledge rollups.
Both solutions are designed to run calculations and verifications and only post necessary data, in batches, to the mainnet.
Optimistic rollups
Optimistic rollups are layer 2 solutions that inherit all the security systems from the mainnet. They’re formed by operators and validators:
- Operators are responsible for all the computational activity, and for aggregating different transactions to reduce the amount of data that should be broadcasted to the mainnet.
- Since operators “optimistically” assume that transactions are valid, validators need to verify if this is true, and they have specific time windows to do that.
The mainnet will receive only the “calldata”, which represent strings able to contain all the information needed to know the essential elements of the bundle of valid transactions.
Zero-Knowledge (ZK) rollups
ZK rollups are layer 2 scaling solutions that work similarly to optimistic rollups, but to verify the validity of transactions they use the so-called “zero knowledge proofs” – so, ensuring not only improved and scalable performance, but also high levels of privacy.
To explain what a zero-knowledge proof is, it is useful to mention the mathematical concept of the Ali Baba Cave.
The concept involves two parties: one has to convince the other that he knows a piece of information, but without revealing that information.
Think of a circular cave with a little tunnel that works as the entrance. The cave is divided by a door that needs a secret word to be opened.
The two parties agree on the different names to use for the different path created by the dividing door.
One of the two individuals enters the cave and chooses a random path, without showing it to the other individual.
At this point, from outside the cave, the second individual calls the first one, indicating the path to follow. The individual inside the cave can follow the right path only if she knows the secret word – as shown in the figure below:
Ali Baba Cave – Wikimedia Commons
Zero-knowledge rollups use these types of proofs to validate transactions and then broadcast only the necessary string of data to the mainnet.
Sidechains and parachains
Often mentioned among the different categories of layer 2 scaling solutions, sidechains and parachains represent different types of blockchains:
- Sidechains are off-chain systems that use their own security and consensus algorithms.
- Parachians are on-chain, independent systems that inherit security from a different layer.
The point is that they are independent blockchains, which are compatible with the mainnet, but they’re not built on top of it – so, they can’t be defined as layer 2 solutions under a technical perspective.
Study case and examples: Layer 2 scaling solutions and Ethereum
Born as a proof-of-work layer 1 blockchain, Ethereum faced all the challenges linked to PoW blockchain as the number of transactions on the blockchain started to increase:
- Low scalability,
- High computational resources required,
- Low sustainability,
- Low speed.
These are the same issues faced by Bitcoin, which also uses layer 2 solutions to improve its scalability.
The capacity of Ethereum was 15 transactions per second – TPS, but we need to consider that Ethereum is widely used not only for financial transactions, but also to build decentralised applications, exchanges and code smart contracts. That’s why it needed to find new solutions.
Once Ethereum reached its capacity – over 1 million transactions per day – L2 solutions became necessary, especially for the cost reached by gas fees.
Gas fees represent the fees paid to broadcast a transaction to the network, and the cost of transactions on Ethereum reached highs of hundreds of dollars for each transaction, allowing users with more resources to broadcast their transactions faster.
This is exactly what is covered in the scalability trilemma, and in this case security, sustainability and reasonable TPS are at risk.
The layer 2 solutions we’ve been talking about are compatible with Ethereum, and there are notable examples of L2 build on top of this popular blockchain:
- Arbitrum. This is a popular optimistic rollup that works like Ethereum, but that aims at significantly reducing transaction costs. Only whitelisted validators can use fraud proofs.
As we mentioned, optimistic rollups assume that transactions are valid, until a verifier proves that the transaction is not valid. They do so with fraud proofs: they analyse parts of the different groups of transactions during the time window left open for validators to challenge the validity of the transactions. If they find any issue, invalid transactions are removed and a group containing only valid transactions is restored.
Optimism
This optimistic rollup aims not only at improving the scalability of Ethereum, but also promoting sustainable projects and the values of Ethereum.
Loopring
This is a zero-knowledge rollup that increases the throughput by 1000 times while reducing costs.
Conclusion
Layer 2 scaling solutions in the crypto space represents the solutions adopted to improve the scalability of layer 1 blockchains that face issues related to the so-called scalability trilemma – term coined by Ethereum’s co-founder Vitalik Buterin.
The trilemma is made up of three points: decentralisation, security and scalability. It looks like only two out of the three goals can be reached when it comes to most layer 1 blockchains: an increased scalability might be reached by reducing the number of network participants, but this would threaten decentralisation, but high decentralisation could lead to delays – that would put security at risk.
So, popular layer 1 blockchains like Ethereum and Bitcoin need to solve all these issues, because they’re at the same time decentralised and secure, but at the same time need higher scalability for the number of transactions per day they manage to reach.
Layer 2 solutions can represent the right tools to improve scalability while keeping decentralisation and security. The most common types of L2 solutions are optimistic and zero-knowledge rollups, which work in a similar way, in the sense that they aim at improving scalability by grouping transactions, speeding up the verification process and communicating only necessary data with the main network that composes the L1 blockchain.
This type of solution is what allows blockchain technology and cryptocurrencies to respect the initial goal they wanted to achieve: scalability allows blockchains not to give up on performance while keeping costs low and making the technology more inclusive, fast, secure and sustainable.
When the scalability trilemma applies, blockchains have to give up on at least one fundamental element among decentralisation, security, inexpensiveness. That’s why L2 scalability solutions allow highly used L1 blockchains to overcome these types of issues while keeping them inclusive.
FAQ
What are layer 2 solutions in crypto?
L2 solutions are implemented to improve the scalability of a blockchain by reducing costs, improving security and increasing the number of transactions per seconds.
How do L2 scaling solutions work?
L2 solutions usually group transactions and run computational activity in separate protocols, in order to decongest the mainnet by communicating only the necessary data related to groups of valid transactions.
What is the difference between layer 1 and layer 2 in blockchain?
Layer 1 represents the base blockchain, the infrastructure, formed by nodes, consensus mechanism and ledger, that composes the blockchain network – some examples of layer 1 are Bitcoin and Ethereum. On the other hand, layer 2 are protocols built on top of layer 1 blockchains to improve their scalability.
What are the most common types of layer 2 – L2 – scaling solutions?
The two most common types of L2 are optimistic rollups and zero-knowledge (ZK) rollups. Both group transactions and send only the necessary data to the blockchain, but while optimistic rollups “optimistically” assume that transactions are valid and give validators a time-window to prove this validity, zero-knowledge rollups work thanks to zero-knowledge proofs (ZKP) by proving the validity of a transaction without communicating the underlying information.
Why is scalability important in blockchain?
Scalability is what allows blockchain to create an alternative environment where people can transfer value and data without giving up on speed, security and decentralisation.
It allows blockchains to reach these goals without the need to exclude users who don’t own enough resources – so, it allows blockchains to respect the initial goal of inclusivity pursued by Bitcoin.