As the number of users and transactions on Layer 1 blockchains continued to grow, this posed a scaling challenge, called the “blockchain trilemma”. Fortunately, Layer 2 solutions have emerged to address this problem.
The development teams of the first blockchains that emerged more than 10 years ago (particularly Bitcoin) did not expect that with the increasing popularity of cryptocurrencies, they would so quickly encounter certain limitations due to the problem of intense growth. The blockchain trilemma (or scalability) is based on the belief that distributed networks can only provide two of its three main features (such as decentralization, security, and scalability) at any given time.
As a result, the developers had to prioritize two features, which would be the most crucial, given the philosophy and strategy of the project, and started working on a solution to this problem.
Some projects with their own blockchains decided to sacrifice decentralization in favor of scalability, some decided to change the consensus algorithm (like Ethereum, which migrated from Proof-of-Work to Proof-of-Stake), and others decided not to sacrifice decentralization under any circumstances (like Bitcoin with its PoW blockchain). Subsequently, Layer 2 emerged as one of the solutions to the blockchain trilemma.
What is meant by Layer 2?
Layer 2 (L2) is a protocol built on top of the existing Layer 1 (L1) blockchain. It was designed to boost the scalability and throughput capacity of L1 and to speed up transactions while reducing transaction fees. This solution is fully integrated with the underlying blockchain and inherits all of its rules, security criteria, crypto assets, and smart contracts.
Layer 2 processes transactions between L1 addresses, using the overlaying network L2 as the conveyer and enabling complete reliability and security of the transactions. This function can be assigned either to an off-chain protocol or to a standalone related blockchain.
Let’s consider the most successful Layer 2 solutions on the market.
The Lightning Network (LN) was released to solve the PoW blockchain trilemma of the oldest cryptocurrency, Bitcoin. The solution was rolled out back in 2015 when the Bitcoin mempool of unconfirmed transactions was increasingly overflowing. This directly affected the fees, which skyrocketed massively. In addition, transactors spent hours waiting for the first confirmation and crediting of assets to the wallet.
LN is an additional layer L2 added to the mainnet that runs on a protocol using smart contracts and communication channels. Each transaction in Lightning Network is processed within its own payment channel, which exists until the successful completion of the transaction, and serves only the sender and the recipient of the payment. Lightning transactions are not recorded on the blockchain.
In practice, Lightning transactions work much like invoicing:
• the sender initiates a transaction (opens a communication channel);
• the system requests the address of the recipient;
• the recipient creates a Lightning invoice, which is followed by a unique public key (address) and a QR code;
• the recipient provides the address to the sender (a QR code is a convenient way to make payments when a sender and a receiver are physically near each other)
• the sender pastes the received address and makes the payment;
• the recipient receives the funds, the communication channel is closed and the transaction is recorded in the block.
Lightning transactions happen instantly (1–3 seconds), and the fee fees range between 1,000 satoshi ($0.2) and less. If compared to the 2–7K satoshi fee for a traditional BTC transaction via Layer 1, LN transactions are cheaper.
The Lightning Network is a perfect solution for eCommerce. It reduced the naysayers’ claims about Bitcoin as an unhandy payment for goods and services to nothing. The Lightning Network is actually a convenient and fast model for BTC transactions. The LN scaling solution is an excellent attempt to solve the blockchain trilemma.
L2 for Ethereum 1.0 (PoW)
Ethereum has recently migrated to the new Proof-of-Stake algorithm, after getting tired of tackling the blockchain trilemma on the Proof-of-Work algorithm. During the PoW period, dozens of Layer 2 solutions have been developed which are worth knowing about at least for educational purposes. Let’s consider the most successful ones.
Rollups execute the transaction on the L2, and then transfer the data to L1.
There are two types of rollups. The first one is zk (zero knowledge) rollups, which bundle many payments into one transaction. The second one is optimistic rollups, which run in parallel with L1.
Zk-rollups create a batch of transactions, performing part of the computation outside L1. These transactions use a zk-SNARK as validity proof. This is cryptographic proof that goes to L1 and unrolls as a single transaction. Zk-rollups enable faster transactions, but the pool of these transactions is limited.
Optimistic rollups use smart contracts. The disadvantages of this solution include possible attacks through loop holes in smart contracts and slower speed compared to zk-rollups.
Zk-rollups examples include the Loopring and ZK-Chain protocols, and optimistic rollups are utilized by the Optimism protocol.