Everything You Need To Know About Layer 2 Solutions: The Chain Scale Problem
Bitcoin was the first to solve the Byzantine General’s Problem. If you’re unfamiliar, it is sort of a game theory thought experiment, where the Byzantine army, led by generals, is besieging a castle; but they can only win if they all do attack together.
The problem is all information is intercepted through the castle’s spies. How then, would you transfer accurate, dependable information which is more importantly, not a deception? You might be tempted to say, ‘Just have a centralized entity calling the shots.’ But then, it wouldn’t really be decentralized, would it? The generals wouldn’t be in this problem if they had one, right?
The application of the problem is extended to our economy as well. How do you establish a currency that all members of the society trust, agree and depend? How do you make it so that you never have to verify its authenticity?
Well, Bitcoin did all that and more with blockchain, creating a trustless, immutable distributed ledger that stores the history of all transactions.
We’ve come a long way since. We have bored apes sitting on yachts and we have ICOs now; I’m not sure which is weirder.
Our problem now is a bit different. The problem now is with scaling this solution.
Think of the main blockchain, the main ledger as layer 1. Layer 2, to oversimplify, is what comes on top of that. It is independent of layer 1, but it is still very much a part of it.
Take Ethereum, for instance. To interact with the main chain, the Ethereum Mainnet, you have to pay gas, which is a bit of ETH. This gas is regulated by the supply-demand mechanisms, which means if there more transactions to be processed at a particular point of time, it shall cost more gas. The fact that ETH has a throughput of about 15, which basically transactions it can process per second. To put it into perspective, Visa has a throughput of at least 1700.
Does this mean blockchain development is futile? No. It means we need more development.
That’s precisely what Layer 2 is. Layer 2 sort of acts as an intermediary between the main chain and the information that is to go on it. It does so, usually in one of four ways:
Sidechain: These basically operate be’side’ the main blockchain. Sidechains are sort of a cross between layer 1 and layer 2 solutions, where sidechains run separately from the blockchain, and operate using their own consensus algorithm. They run compatible with Ethereum Virtual Machine, but are less decentralized and more susceptible to coordinated malice. Examples include xDAI and Skale.
Rollups: Probably the most widely used L2 solution, rollups are linked to the blockchain in a way that the transactions happen on Layer 2, but the compressed version of transaction data is stored on layer 1. There are usually of two kinds.
a. Optimistic Rollups assume that the transactions are valid by default, don’t perform any computations; offering a fraud proof in case of a consensus challenge. Examples include Arbitrum, Boba, Cartesi, Fuel Network.
b. Zero-Knowledge Rollups run the computations off-chain, and submit the validity proof to the main chain. Examples include Axtec 2.0, Immutable X, Loopring, Matter Labs zKSync, Polygon Hermez.
Channels: They sort of offer a way of making multiple transactions off-chain, and they settle all of those with submitting only two transactions on the main layer. However, they have limitations in the sense that all parties should be known before; and they’re also required to deposit funds into a multisig contract which raises the issue of constant monitoring of funds. They come in two forms : state channels and payment channels.
Plasma: Plasma uses something called Merkle trees to create additional chain to the main chain; without going in too much detail of, offer the functionalities of faster transactions, lower costs and there’s practically no need to store data on the ledger.
Why are Layer 2 solutions needed?
On June 09, 2022, after about a week of voting, about 54% of ApeCoin users voted against the expansion of the coin beyond Ethereum blockchain, to other networks.. The entire fiasco had the community divided, with the majority barely making the cut. The entire debate, whether to stay on the network, was sparked due to an increase in gas prices during the sale of virtual land; for similar aforementioned supply-demand reasons, for Yuga Labs’ Otherdeeds Metaverse sale, where buyers ended up paying more than the land itself in gas fees; to put it in perspective, gas costed, on average, more than $4000.
Analysts also say that ETH worth about $171 million (60,235 ETH) was spent on transactions for completed mints, during the actual launch. Furthermore, about 1700 ETH was lost as a result of about 14 thousand failed transactions.
One could argue, probably, that the entire fiasco could have been avoided with the integration of a Layer 2 solution. If one did, one would be in agreement with an anonymous DAO engineer who put-forth AIP-41 proposal following the fiasco, and the subsequent Yuga Labs tweet. This is just one of many instances where a valid solution to an existing problem has had to face scalability issue on chain.
The instance above is one of many incidents where users paid for a developer issue; which essentially means that just by itself, the technology is probably not perfect. Maybe it’s just incomplete. While we do have the principles of liberation and decentralization incorporated to our financial systems now; once a far-fetched idea, we don’t have the scalability that blockchain’s fiat counterpart offers. Layer 2 just might be a solution for all that.
As a distinguished blockchain expert at Codezeros, Paritosh contributes to the company's growth by leveraging his expertise in the field. His forward-thinking mindset and deep industry knowledge position Codezeros at the forefront of blockchain advancements.