Wait, I have to learn about L2s too?

Wait, I have to learn about L2s too?


No alt text provided for this image

It seems like every few days a new word in crypto gets announced and adopted. Consensus mechanism, interoperability, light client, Layer 2, etc. What’s interesting is that these new semantic definitions are arising because true innovation is happening in the industry. For good reason, things are not stagnant in this industry and that leads to new use cases and definitions of technologies. Today we are going to deep dive into Layer 2s (L2s) and see the reason they exist and why they are important.


With that being said, let’s begin with the inception. Bitcoin led the innovation progression of bringing decentralized money onto the internet. A new form of value that was not tied to federal and fiscal policy, but rather to code. Bitcoin led the way for newer blockchains like Ethereum that tracked general activity not just financial. As these technologies were introduced they were hit with several limitations ranging from adoption to scaling. To this day, these issues are being worked out and there are zones of focus that are working on providing the best technological solutions to allow for adoption, security, and scalability. Today we are going to deep dive into Layer 2s and how they are the roadmap for massive adoption. Vitalik and the Ethereum foundation deem L2s so important that they built the long term roadmap around it.


Stating that there is an L2, implies that there is an L1 and that is correct. An L1 is a base blockchain that gets data added to it from a specialized blockchain (L2). There are lots of complexities to ensure this process is secure and reliable and we will focus on them but first we must cover why L2s exist. Vitalik introduced a conceptual challenge that has continuously shaped design decisions and technological advancements called the Blockchain Trilemma.?


The Trilemma

The trilemma suggests that blockchain systems can only achieve two out of the following three properties simultaneously:


Security: Ensuring that the system remains resistant to attacks, both internally and externally. In this context, security often means ensuring that transactions and operations on the blockchain are verifiable and immutable, even in the presence of malicious actors.


Decentralization: This refers to the extent to which the system's control and operation are spread out, rather than being concentrated in a few nodes or entities. A truly decentralized system ensures that no single entity has overwhelming control, leading to censorship resistance and reduced points of failure.


Scalability: The ability of the system to handle an increasing amount of transactions and operations efficiently. A scalable blockchain can process a high number of transactions per second, accommodating a larger user base without compromising on speed or cost.

No alt text provided for this image

The essence of the trilemma is that, given current technological constraints, it's extremely challenging to achieve all three attributes in a single blockchain system. For instance, a blockchain might prioritize security and decentralization at the cost of scalability, leading to slower transaction speeds and higher fees. Conversely, prioritizing scalability might mean compromising on decentralization, with more centralized nodes making the system vulnerable to censorship and less resilient against coordinated attacks.?


Now that we have introduced that trilemma, it is important to distinguish what it implies to the base blockchain (L1). Ethereum has a gravitating philosophy around decentralization and a proven security module through its consensus mechanism so it found a sweet spot knowing that it can use L2s to handle the scalability issue of the trilemma.?


L2 Types

No alt text provided for this image


Layer 2s were? designed to enhance a blockchain's throughput and efficiency without tampering with its foundational layer, the L1. In simple terms, L2s focus on the scalability component of the Trilemma. The execution of code by the virtual machine and nodes is moving from the L1 into the L2. By handling computations off-chain and then committing the results in a consolidated form back to the L1, these solutions reduce congestion and improve transaction speeds. There are several types of L2s each having their pros and cons. I will quickly introduce all of them but will focus on what are known as Rollups. After these quick introductions, we will dive into the technicalities.


Sidechain?

A sidechain is a separate blockchain that runs in parallel to a primary blockchain, often referred to as the "main chain." The unique aspect of side chains is their ability to exchange information and assets with the main chain through a two-way pegging mechanism. This allows assets like tokens to be transferred from the main chain to the sidechain and back.

The primary motivation behind side chains is to introduce new features or scalability improvements without altering the main chain's protocol. Since sidechains operate independently, they can implement different consensus mechanisms, block sizes, or even novel transaction processing methods. If a sidechain fails or is compromised, it does not directly jeopardize the security or integrity of the main chain.


However, the efficacy of a sidechain largely depends on the security of the two-way peg and the consensus mechanism it employs. Sidechains provide a sandboxed environment, allowing developers to experiment with innovative solutions while maintaining interoperability with more established blockchains.


A sidechain is like a parallel road that alleviates traffic from the main highway, allowing for smoother journeys without congesting the primary route.


State Channels

State Channels are one of the earliest L2 scaling solutions introduced in the space. They work by allowing two or more parties to open a private channel between them. Within this channel, participants can perform an arbitrary number of transactions among themselves without touching the main chain. It's only when the channel is opened or closed that the main chain gets involved. This makes state channels particularly suitable for applications where users engage in numerous back-and-forth transactions over extended periods, such as in gaming platforms or for micropayments.?


State channels, while promising for certain applications, come with notable limitations that deter their widespread adoption. Both parties involved in a transaction need to be online simultaneously, posing a challenge to spontaneity and flexibility. The necessity for an initial deposit can also tie up users' funds for extended durations, possibly making it a less attractive option for casual users. Furthermore, if one party decides to disappear or becomes uncooperative before a channel's closure, it could create difficulties for the other party in accessing their capital. Additionally, state channels might not be the best fit in situations where complete public verifiability of every transaction is a priority.


A state channel is like a shared notepad between two people, tallying scores privately, before revealing the final outcome to the world.


Plasma

No alt text provided for this image

Then we have Plasma, a brainchild solution that was short-lived. One of the cornerstones of plasma is off-chain computation. Rather than having every transaction verified by the entirety of Ethereum's nodes (a time-consuming process), Plasma suggests only essential transactions need such rigorous verification through something called Child Chains. By handling many transactions off the Ethereum Mainnet, Plasma chains can achieve faster processing times.?


However, for the off-chain transactions to benefit from Ethereum's security features, they must eventually be settled on the main Ethereum execution layer. This is where state commitments come in. These are periodic cryptographic "save points," in the form of Merkle roots, submitted by operators to the Plasma contract on Ethereum. These roots provide a snapshot of the off-chain's state at a specific moment in time.


Even though Plasma chains are exciting and sound advanced, they grapple with several challenges. A prominent issue is the data availability problem, where off-chain data might become inaccessible, especially if controlled by a malicious operator. This ties to the "mass exit" dilemma, where a sudden influx of users trying to withdraw their assets back to Ethereum can congest the network. Additionally, Plasma's reliance on complex fraud proofs demands continuous monitoring, either by users or designated watchers. Perhaps the biggest fallback is that the chains lack support for general smart contract execution, leading to limited application use-cases. Coupled with concerns about potential centralization due to single-operator validation and a waiting period for exits that locks up capital, Plasma's complexities have led many in the Ethereum community to explore alternative Layer 2 solutions.


A Plasma chain is like a subsidiary branch office, handling local tasks efficiently, while still reporting to the main company headquarters.

Rollups

Just like in any field of innovations, new solutions get introduced when limitations are met. In this case, Rollups came around to build another layer of innovation. In essence, Rollups consolidate many off-chain transactions into one and submit it to the L1. This means the heavy computation, like transaction validation, happens off-chain, although the data is stored on-chain.?


Rollups come in two flavors: Optimistic and zk-Rollups. Optimistic Rollups work on the principle of trust but verify. Transactions are assumed to be valid unless someone challenges them. In contrast, zk-Rollups employ zero-knowledge proofs, specifically zk-SNARKs, to validate transactions away from the main chain. Given the cryptographic strength of zk-SNARKs (Succinct Non-Argument of Knowledge), no challenge period is required, leading to swift transaction confirmations.


A rollup is like summarizing a book into a single page, yet retaining the essence and details for later review.

ZK-Rollups

The "zk" in zk-Rollups stands for "zero-knowledge", which refers to zero-knowledge proofs. These are cryptographic methods that allow one party to prove to another that a statement is true, without revealing any specific information about the statement itself. In the context of zk-Rollups, these proofs are used to validate transactions off-chain while ensuring on-chain data availability.?


Zero-Knowledge Proofs (ZKPs) are cryptographic methods that allow one party to prove to another that a statement is true without revealing any specific information about the statement itself. In the context of blockchain scalability, zk-SNARKs and zk-STARKs, specific types of ZKPs, enable vast transactional data to be represented by succinct proofs. Instead of storing and processing every transaction on-chain, these proofs verify a large batch of transactions off-chain, with just the proof itself recorded on-chain. This drastically reduces the data and computational load on the blockchain. For instance, zk-Rollups utilize these proofs to move computations off-chain while ensuring data correctness on-chain, offering an efficient way to boost transaction throughput and reduce congestion. One of the best benefits of ZK-Roll Ups is that they allow for instant finality because the proofs compute legitimate transactions.


zk-Rollups utilize zero-knowledge proofs to enhance scalability on blockchains. However, they face limitations. Their initial trusted setup, particularly for zk-SNARKs, is complex and, if compromised, could threaten security. Generating these proofs is computationally demanding, requiring significant infrastructure. The advanced cryptography behind zk-Rollups presents a steep learning curve for developers, potentially slowing adoption. While they ensure data correctness, they're reliant on external data sources or on-chain data, posing risks if such data becomes inaccessible. Finally, integrating zk-Rollups with other systems or future updates can be challenging. There are several companies solely focused on getting ZK to work with Ethereum and they’re getting close to production level tech.


A zk-rollup is like a magician who always reveals the secret behind the trick, ensuring the audience that each act is genuine without exposing every step.

Optimistic (most popular)

Now we can talk about currently the most adopted type of L2 scaling solutions, Optimistic rollups (ORU). These rollups take a slightly different approach. They primarily execute transactions off-chain, only committing a summary to the main chain, thereby reducing on-chain data and computational load. The system optimistically assumes all transactions are valid, but if an invalid transaction is detected, it can be challenged using "fraud proofs." This mechanism ensures security but introduces a withdrawal delay, often around a week, to allow for potential challenges. One notable advantage is their compatibility with Ethereum smart contracts, allowing developers to scale applications without extensive modifications. This approach significantly boosts transaction throughput while maintaining the security of the mainnet.


Optimistic Rollups, while promising as a scaling solution for Ethereum, come with concerns. Their reliance on "fraud proofs" requires users to actively monitor and challenge any suspicious activities, putting the onus on the community to maintain integrity. This system introduces a notable delay, often up to a week, for withdrawals to be finalized, potentially hindering liquidity. Data availability is another concern; if off-chain data becomes inaccessible, it can jeopardize the security of funds. Furthermore, the dependence on a centralized sequencer for transaction ordering may introduce centralization risks. Lastly, while they are more scalable than the Ethereum mainnet, they still have throughput limitations when compared to other Layer 2 solutions.


An optimistic rollup is like a fast-tracked airport security line where everyone proceeds quickly,?

but if something's amiss, they're pulled aside for a detailed check.

Optimistic Rollups are on a roll

We’ve covered most of the L2 scaling tech but now it is time to do a deep dive and discuss how the most commonly used L2 scaling tech, Optimistic Rollups works in detail. Some of this will be a quick recap but I’ll talk a bit more about the mechanisms now.?


Optimistic Rollup is a Layer 2 scaling solution for Ethereum, designed to significantly enhance its transaction throughput without compromising security. The system commits a bundle of transaction data to the Ethereum mainnet at regular intervals. On the Ethereum mainnet, specific smart contracts are deployed to oversee the rollup. These contracts manage deposits, withdrawals, and the crucial posting of transaction batches. You can imagine that if you bridge your funds from L1 to L2 you now have the amount you bridged as credit to use on the L2.?

Data Availability

Something we haven’t brought up yet but is a staple to Optimistic RU is the data availability layer. Data availability is a crucial component in the realm of blockchain, especially for Optimistic Rollups. At its core, data availability ensures that all necessary data for validating a transaction or operation on the blockchain is accessible and verifiable by any participant in the network.


In simpler words, the data availability layer is a fundamental component in the blockchain infrastructure, serving as a reliable mechanism that ensures all transaction data is accessible and verifiable.?


You may be wondering why DA is important, and the short answer is because they provide the data that blockchains need to operate. Rollups, especially Optimistic Rollups, operate on an "optimistic" assumption that transactions are correct unless proven otherwise. This means that once a transaction is executed, it's immediately accepted unless it's challenged during a designated period. For this challenge-and-verify mechanism to function seamlessly, all data associated with every transaction has to be available for scrutiny. If any piece of data goes missing, it could compromise the integrity of the entire rollup. We’ll talk about this in more detail in a bit.

Sequencer

There is also another core component in an optimistic rollup called the sequencer which basically organizes and submits the transactions to the L1. The sequencer's primary role is similar to that of a traffic manager at a busy intersection, ensuring a smooth flow of vehicles and preventing any congestion.


Sequencers in the ORU context have the main task to aggregate and order multiple off-chain transactions into a cohesive batch. Instead of users directly submitting their transactions to the Ethereum chain, they send them to the sequencer. By doing so, they significantly reduce the amount of data that must be stored on the main Ethereum chain, enhancing the overall transaction throughput. The sequencer then holds these transactions off-chain, momentarily, arranging them efficiently. Imagine this as a sorting facility, where each package (transaction) is orderly placed, ready for delivery.


After collating a substantial number of transactions, the sequencer then creates a summary, or "rollup", of the batch and places it onto the main chain. This rollup is a condensed representation of the many transactions it embodies, similar to a delivery truck carrying multiple packages, making a single trip instead of multiple vehicles doing the same. The "optimistic" nature of ORUs comes from an inherent assumption of honesty. The system assumes that all transactions in the batch are valid once the sequencer submits them. It's like trusting that all packages in the delivery truck are correctly addressed without individually checking each one.

Proofs and Challenge Periods

There are two types of proofs in the roll up ecosystem called Fraud Proofs for Optimistic Rollups and ZK Proofs. Each has their benefits and issues as usual. We will mainly focus on fraud proofs but to give a high overview of ZK proofs, they allow for nodes to submit a proof that validates their computation was correct. In order for a ZK proof to be submitted they follow a process that ensures once the proof is submitted it is correct for all validators to accept. The benefit of a ZK proof is that there is instant finality in the computation.?


On the optimistic side, there is a safeguard mechanism. A predefined "challenge period" follows every batch submission by the sequencer. During this window, if anyone detects a malicious transaction in the batch, they can challenge its validity. It’s analogous to recipients verifying their deliveries and flagging any discrepancies.


Fraud proofs are cryptographic mechanisms that play an essential role in maintaining the integrity of decentralized systems, particularly blockchains. At their core, fraud proofs aim to facilitate efficient validation processes by distributing the responsibility of validation across participants. In decentralized systems, when a participant makes a claim or submits a piece of data, it is not always feasible for every other participant to validate it, especially as the system scales.? Instead of this exhaustive validation, fraud proofs allow for a more streamlined approach. If any participant suspects that a particular data entry or transaction might be malicious or incorrect, they can challenge it. Upon challenging, they submit a fraud proof to the network, essentially a cryptographic evidence of the suspected malfeasance. The network then evaluates the proof. If it stands up to scrutiny, the data or transaction in question can be rejected, and penalties might be imposed on the party that submitted the false data.


So to recap Optimistic Rollups, they are a Layer 2 scaling solution for Ethereum designed to enhance transaction throughput by periodically batching them for commitment to the Ethereum mainnet. Core to this system is data availability, ensuring all transaction data remains open for validation. The sequencer plays a pivotal role, organizing off-chain transactions and submitting them in aggregated form to reduce Ethereum's data load. Within this framework, Fraud Proofs maintain the system's integrity by allowing participants to challenge suspicious data entries, ensuring efficiency and security in the blockchain scalability landscape.


Are L2s important?

We have to ask ourselves, are L2s important? Well to even answer this question, we have to ask are L1s even important. More specifically, is Ethereum important? At the heart of this discussion we have to cover Ethereum’s blockspace . Ethereum's blockspace has the potential to build out a global decentralized system that can allow people from around the world to interact in censorship resistant and permissionless manner. In metaphor it could become the world’s computer to allow for global coordination at a scale never seen before.? As more individuals and enterprises tap into Ethereum's capabilities, the network is teeming with transactions and smart contracts, making its blockspace an incredibly sought-after digital asset.?


Looking forward, if Ethereum and blockchain technology continue on their current trajectory, they have the potential to reshape global coordination. As the world grapples with issues of trust, transparency, and efficiency, decentralized systems offer a promising alternative. Ethereum could serve as a backbone for this new world mechanism, where processes are not only transparent and secure but also permissionless. This means that anyone, regardless of their geographical location or economic status, could participate in this global ecosystem.


However, as promising as this vision is, Ethereum's current infrastructure faces scalability challenges. As more entities want to utilize this valuable blockspace, congestion and high transaction fees can become problematic. This is where L2s shine. If Ethereum truly grows to global scale, L2s will be the power engines that allow it to work. As mentioned L2s come in different flavors so the selection of L2s will differ based on preferences and capabilities.?


My personal take is that blockchain will get global adoption and Ethereum will be the main engine that powers the world. As for the future of L2s the future is more nuanced but the principle of scaling will come to fruition. I believe that this innovation will foster solutions to the current roadmaps and blockchain will win. Perhaps the end goal as well is to abstract the complexity from blockchain and users work with it not even knowing the processes of keeping things onchain. All in all it is exciting to see smart people dedicate their time and energy to bring these solutions forward and for blockchain to prosper.

Absolutely, the world of crypto is evolving rapidly with new concepts emerging frequently. Exploring Layer 2 solutions is crucial as they're designed to address scalability and efficiency issues of Layer 1 blockchains. How do you see L2s shaping the future of blockchain technology and adoption, Agustin?

要查看或添加评论,请登录

社区洞察

其他会员也浏览了