Layer 1 vs. Layer 2
For the uninitiated, blockchain-related terminology can be overwhelming. An important distinction to be made is between layer 1s and layer 2s. Layer 1s are the base blockchain, and the most famous examples are Bitcoin and Ethereum. Layer 1s have:
- A network of node operators: a network of computers running the blockchain’s software. Anyone who downloads the blockchain software on their computer can participate.
- A network of block producers: A person or group chooses to verify a block’s transactions and begin the next block.
- The blockchain and its history of transaction data: A secure and decentralized record of transactions stored into blocks chained together via cryptography.
- The consensus mechanism for the network: Validation of a new block requires a majority of the computers’ network to agree to it, e.g., via Proof-of-Stake or Proof-of-Work.
How it started
Three desirable characteristics of layer 1s are security, scalability, and decentralization. These three are the blockchain trilemma because only two can be achieved without sacrificing the other. Bitcoin was the first blockchain introduced to the world in 2009, focusing mainly on security and decentralization. Other blockchains adopted varieties of this technology and use cases. As a result, exponential growth in use brought about high gas fees and slow transactions, notably on Ethereum.
This is where layer 2s come in. They allow layer 1s to maintain their security and decentralization while providing solutions for scalability. Scalability offers faster transaction speeds (finality) and throughput (transactions per second).
Layer 2s: On-chain and off-chain
Researchers and developers have found various solutions to improve scalability, most of which are Ethereum-centric, which is why Ethereum will be used as an example of layer one from here onwards. Some answers are on-chain, and some are off-chain. Sharding is a typical example of an on-chain solution, as seen on the Near protocol.
Sharding is a well-known concept in computer science that involves splitting the database horizontally to spread the load. This can operate together with off-chain solutions. In fact, after Ethereum’s “The Merge” upgrade, sharding is the next update in the pipeline.
On the other hand, off-chain solutions are executed off the main chain and do not require changes to Ethereum. Typically, they process transactions on a separate network and rely on Ethereum for security. The main chain also offers decentralization, so the main focus of off-chain layer 2s is on transaction speed and scalability. Since they are built on top of Ethereum, they do not require their native token, although they can have it. This is how they reduce the transaction load from the leading network.
Types of Layer 2s
Examples of layer 2s include:
- Rollups: These are the current preferred layer two scaling solutions. Rollup transactions occur outside Ethereum, but the transaction data gets posted to the main chain. There are two main types, which mainly differ in how this transaction data is published on Ethereum;
- Zero-knowledge (zk) rollups: These roll transactions into a verifiable batch to perform a particular cryptographic proof and then post to Ethereum, e.g., zkSYNC and Loopring. These are more secure but slower than optimistic rollups.
- Optimistic rollups: These roll transactions, assuming they are valid unless successfully challenged through fraud proofs, e.g., Optimism and Arbitron.
- Sidechains: They are separate chains that operate parallel to Ethereum and inherit its security. The most well-known example is the Polygon network. Other Ethereum Virtual Machine (EVM) compatible layer 1s can also function as sidechains. Popular choices are Avalanche, Fantom, and Binance Smart Chain.
- State channels: These are multi-signature smart contracts that allow parties to transact between them without needing Ethereum to validate each transaction and execute only with the approval of the involved parties. Examples include the Raiden, Connext, and Celer networks.
- Plasma chains: Like optimistic rollups, these rely on fraud proofs, but unlike optimistic rollups, the data is kept off-chain. This was one of the earliest layer two research areas, which somehow didn’t gain traction.
- Validium: These are compared to zk rollups due to the proof they rely on. However, in this case, data is kept off-chain. Immutable X, DiversiFi, and Sorare are good examples.
- Volitions: Volitions are a hybrid of a zk-rollup and validium chain, allowing users to switch between the two scaling solutions.