Layer 2 (second layer) refers to blockchain technology and Solutions in network protocols for extending the underlying blockchain (Layer 1). Its purpose is to increase transaction speeds, reduce transaction fees, and enhance the scalability and efficiency of the network. Layer 2 reduces the burden on the main chain by processing a large number of transactions outside the main chain and then submitting the results to the main chain in batches. Here are some key features and technologies of Layer 2:
Scalability: Layer 2 Solutions More transaction volumes can be processed, easing congestion issues on Layer 1 (such as Ethereum and Bitcoin).
Cost reduction: By processing transactions off-chain, Layer 2 can significantly reduce user transaction fees.
Improving speed: Since transactions do not need to be confirmed one by one on the main chain, Layer 2 can greatly increase transaction processing speed.
Security: Although transactions are processed off-chain, Layer 2 solutions still rely on the security of the main chain to ensure the final The transaction results are trustworthy and cannot be tampered with.
2. Common Layer 2 solutions
State Channels
This method allows two or more parties to proceed off-chain Multiple transactions, only the final state is submitted to the blockchain at the end of the transaction. A typical example is the Lightning Network, mainly used in Bitcoin.
Sidechains
< p style="text-align: left;">A side chain is an independent blockchain that uses its own consensus mechanism but is connected to the main chain (parent chain) through two-way anchoring. Sidechains can freely implement different functions and optimizations, while the main chain still maintains its primary security and stability.
Rollups
Rollups work by packaging a large number of transactions into in a single transaction and submit it to the main chain. This approach can be divided into two types: Optimistic Rollups (Optimistic Rollups) and Zero-Knowledge Rollups (zk-Rollups).
Op Rollups: Assume the transaction is valid and only verify it if there is a dispute< /p>
Zk Rollups: Using zero-knowledge proof technology, while submitting transaction data, its correctness is guaranteed.
Plasma
Plasma is a framework that allows the creation of multi-layered sub-chain structures, each layer can handle a large number of transactions. Although its theoretical foundation is strong, it faces certain challenges in practical application.
But on the l2beat website, except for rollups, other solutions are all defined as side chains
3. Explanation of terminology related to Layer2
Modularization
In current L2 blockchain projects, modularity has become standard; as we all know, the word modularity originated from the article co-written by Mustafa Albasan and Vitalik in 2018, titled "Data Availability Sampling and Proof of Fraud", later developed by Celestia. It is very appropriate for modularity and composability to fall on Layer2, but how does it behave on Layer3? How do we understand modularity and composability of Layer3? Modularization can work mainly due to the composable characteristics of the blockchain public chain architecture. A mature public chain includes:
Settlement layer (Settlement layer) is responsible for the transfer and determination of the transaction status of assets;
DA layer (Data Availability) is responsible for the status change data availability of transaction data for transaction verification:
The execution layer (Execution layer) is responsible for processing The execution logic of the transaction, including the call and execution of smart contracts;
The consensus layer (Consensus Layer) is responsible for all nodes agreeing on a certain version The transaction history reaches consistency;
The cross-chain communication layer (Interoperability Layer) is responsible for the message communication and status of different blockchain networks manage.
The above-mentioned blockchain components have a clear division of labor, and each performs its own duties, which constitutes the trustworthy and decentralized characteristics of the blockchain.
Data Availability Layer (DA)
Data Availability Layer refers to A layer that handles and ensures data availability. Data availability means that data can be accessed, verified and used when needed, which is crucial for data integrity and security in blockchain systems. The design goal of the data availability layer is to ensure that all participants can access and verify the data published on the blockchain, thus ensuring the transparency and reliability of the entire system.
Key functions of the data available layer
Data storage and distribution: The data availability layer is responsible for storing the data generated by the blockchain and ensuring that these data can be accessed by all nodes. It provides a distributed data storage mechanism to ensure data durability and redundancy.
Data verification: This layer also provides a verification mechanism that allows nodes to quickly verify the integrity and Correctness. Data verification is a critical step to ensure that data has not been tampered with or corrupted.
Data retrieval: The data availability layer needs to ensure that data can be efficiently retrieved and accessed when needed . Whether it is transaction verification, smart contract execution, or data analysis, they all rely on fast data retrieval capabilities.
Redundancy and Fault Tolerance: To prevent data loss or corruption, a data availability layer typically implements Redundancy and fault-tolerance mechanisms, such as through distributed hash tables (DHT) or replicating data to multiple nodes.
The position of the data availability layer in the blockchain architecture
In a layered blockchain architecture, the data availability layer usually cooperates with other layers (such as settlement layer and execution layer) to ensure the efficient operation of the entire system. Specifically, the data availability layer provides reliable data storage and access services to the settlement layer and execution layer.
Implementation of data available layer
On-chain data availability: In traditional blockchain systems, all data is stored on-chain (such as Bitcoin and Ethereum), which ensures the availability of data. However, this approach can lead to blockchain bloat and performance issues.
Off-chain data availability: Some modern blockchain systems use off-chain data storage to solve chain problems. On the issue of data expansion. For example, Rollup technology stores most of the transaction data off-chain and only stores the digest or proof of the data on-chain.
Sharding technology: Sharding technology divides the blockchain into multiple small pieces, each Small slices store a portion of data. This approach improves the scalability and data processing capabilities of the system, but requires an effective data availability scheme to guarantee data accessibility and integrity for each tile.
The challenge of data availability layer
< p style="text-align: left;">Data availability attack: A data availability attack refers to a malicious node publishing a block without providing all the data, making it impossible for other nodes to verify the integrity of the data. sex. Solving this problem requires designing an effective data availability proof mechanism.
Storage and bandwidth limitations: As the amount of blockchain data increases, storage and bandwidth requirements will also increase significantly. The data availability layer requires efficient storage and distribution mechanisms to cope with growing data demands.
Privacy and Security: Ensuring data privacy and security is also one of the important challenges of the data availability layer . Encryption and access control mechanisms need to be designed to protect sensitive data.
Algorithms available for data
Data Availability Proofs
Data Availability Proofs are a method used to verify that published data actually exists and is accessible. These proofs are important to prevent data availability attacks (e.g., a block publisher claims to have published data but actually has not).
Kate Commitments:
A polynomial commitment-based scheme to efficiently verify the availability of large data sets . It uses KZG (Kate-Zaverucha-Goldberg) commitments to prove that a specific block of data has been published correctly.
Data Availability Sampling:
A random sampling technique in which nodes randomly extract and verify a small number of data fragments to determine the entire data set availability. This method reduces verification costs, allowing even light nodes with limited resources to participate in verification.
Erasure Coding
Erasure coding is a data encoding technology used to improve the redundancy and reliability of data storage. By breaking the data into multiple fragments and adding redundant information, the data can still be recovered even if some fragments are lost or damaged.
Reed-Solomon Codes:
A widely used erasure code that can select from any k valid The original data is recovered from the fragment, where k is the encoding parameter. This encoding is widely used in storage and distributed systems.
LDPC Codes (Low-Density Parity-Check Codes):
An efficient erasure code using sparse matrices Encoding and decoding, suitable for systems requiring high redundancy and low latency.
Distribution DHT (DHT)
DHT is a distributed storage system. The node determines the location of the data through a hash function and stores it in the network. to store and retrieve data.
Kademlia:
A common DHT implementation that uses the XOR distance metric to determine the distance between nodes and efficiently route data requests. The distributed nature of Kademlia makes it suitable for data storage and retrieval in decentralized networks.
**Cryptography Technology**
Encryption and hashing algorithms play a key role in ensuring the integrity and security of data.
Merkle Trees:
Merkle tree is a hash tree structure used for efficient and secure verification Integrity of large data sets. Through the root hash (Merkle Root), nodes can quickly verify whether any data fragment is part of the data set.
Zero-knowledge proof (ZKP):
Zero-knowledge proof allows a party to prove that it owns the data without revealing specific data. knowledge of certain data. ZKP has extensive applications in data availability and privacy protection, such as zk-SNARKs (zero-knowledge succinct non-interactive knowledge arguments).
Data Sharding
Data sharding splits large data sets into smaller fragments and distributes them on different nodes to improve the scalability and data availability of the system.
Ethereum 2.0 Sharding: Ethereum 2.0 uses sharding technology to divide the blockchain status and transaction load into multiple parallel runs. shard chain. Each shard chain handles transactions and status independently, but achieves unified consensus and data availability through the Beacon Chain.
**Data available layer instance**
Ethereum 2.0: In the sharding design of Ethereum 2.0, the beacon chain and the sharding chain need to work together, and the data The availability layer plays an important role in ensuring the availability of data for each shard chain.
Celestia: Celestia focuses on building a dedicated The data availability layer improves the scalability and efficiency of the blockchain by separating consensus and data availability.
EigenDa: is an emerging data availability (Data Availability, DA) solutions focus on ensuring data availability in blockchain and decentralized applications through innovative technical methods. EigenDA combines multiple advanced cryptography and data distribution technologies to achieve efficient, reliable and scalable data availability.
**Centralized Storage Network**
Decentralized storage networks leverage distributed storage technology to improve data availability and censorship resistance.
IPFS (InterPlanetary File System): IPFS is a Distributed file system that uses content addressing and DHT to store and retrieve data. Through distributed storage, IPFS ensures high availability and redundancy of data across the network.
Filecoin: A decentralized storage network based on IPFS, Filecoin ensures data storage through an economic incentive mechanism reliability and durability. Storage nodes receive token rewards by providing storage space and retrieval services.
Cross-chain communication layer
Cross-chain communication layer (Cross-Chain Communication Layer) refers to the technology and protocols that enable information and value interoperability between different blockchain networks. Since blockchain networks operate independently and are often incompatible, enabling cross-chain communication can break down the isolation between blockchains and promote interoperability of decentralized applications (dApps) and broader ecosystem integration.
Key functions of the cross-chain communication layer
< /p>
Interoperability: The cross-chain communication layer allows data and assets to interoperate between different blockchains. This can include transferring tokens, sharing data, calling cross-chain smart contracts, etc.
Trust and security: ensuring cross-chain communication Security and trust are key. The cross-chain communication layer needs to guard against various attacks, such as double-spend attacks and man-in-the-middle attacks, to ensure the security and integrity of cross-chain operations.
Compatibility: The cross-chain communication layer needs to be supported The consensus mechanisms and data structures of different blockchains ensure seamless communication between heterogeneous blockchains.
How to implement cross-chain communication
Relay: Relay is a bridging mechanism that transmits information between different blockchains through relay chains or relay nodes. The relay is responsible for monitoring events on the source chain and submitting these events to the target chain for processing. Example: Polkadot's Relay Chain connects different parallel chains (Parachains) to achieve cross-chain communication and sharing security.
Atomic Swaps: Atomic swap is a trustless cross-chain transaction method that uses hash time to lock the contract. (HTLC) ensures that the asset exchange between the two parties on different chains is completed simultaneously. Example: Atomic swaps between Bitcoin and Ethereum can be implemented through HTLC, ensuring the exchange of tokens between the two chains.
Sidechain:A side chain is an independent blockchain that runs parallel to the main chain (mainnet) , realizing asset transfer and data communication with the main chain through a two-way peg mechanism. Example: Liquid Network, as a side chain of Bitcoin, enables faster transactions and higher privacy.
Cross-Chain Bridges: A cross-chain bridge is a specialized protocol or platform that uses bridging contracts or Relayers transfer assets and information between different blockchains. Example: ChainBridge and RenBridge are bridging tools for cross-chain transfer of assets between different blockchains.
Decentralized Relayers: The decentralized relay network is a trustless cross-chain Solution to verify and deliver cross-chain transactions through a decentralized node network. Example: Cosmos's IBC (Inter-Blockchain Communication) protocol implements cross-chain communication through decentralized relays.
Specific examples
Polkadot: Polkadot's relay chain and parachain architecture achieve efficient cross-chain communication. The relay chain is responsible for managing and verifying cross-chain transactions between parallel chains, ensuring the security and consistency of cross-chain operations.
Cosmos: Cosmos achieves this through its IBC protocol Cross-chain communication. IBC allows independent blockchains to interoperate through standardized protocols, and nodes can securely transfer messages and assets.
DappLink cross-chain interoperability protocol: a zkp's assets, data cross-chain interoperability protocol
Chainlink strong>: Chainlink provides interoperability solutions for cross-chain data and assets, enabling secure transmission of on-chain and off-chain data through a decentralized oracle network.
Challenges of cross-chain communication
< p>
Security: Cross-chain communication needs to solve various security issues, including double-spend attacks and replay attacks and man-in-the-middle attacks. Strong authentication mechanisms and encryption protocols need to be designed.
Performance and scalability: Cross-chain operations May increase latency and complexity, requiring optimization of performance and scalability to support large-scale applications.
Standardization and interoperability: different blocks Chains have different protocols and data structures, requiring standardized protocols and common frameworks to achieve interoperability.
4. Analysis of mainstream Layer2 projects
Ethereum Ecology
Ethereum’s mainstream Layer 2 solutions include Optimistic Rollups and zk-Rollups. Both solutions aim to increase the throughput and reduce transaction costs of the Ethereum network while maintaining decentralized nature and security.
Optimistic Rollups
Optimistic Rollups is a method based on commit chain and execution Layer 2 extension of the execution chain. It stores a large amount of transaction data on the execution chain outside the chain, and regularly submits the execution results to the commitment chain on the chain. Through off-chain computing and on-chain dispute resolution mechanisms, Optimistic Rollups achieves high-performance smart contract execution while retaining the decentralized nature of Ethereum.
Optimistic Rollups mainstream projects
Arbitrum
Optimism
Layer2 modified based on OpStack
OP old version OVM code architecture
ZK-Rollups
zk-Rollups is a Layer 2 extension solution based on Zero-Knowledge Proofs. It enables high-throughput and low-cost transactions by compressing large amounts of transaction data into proofs and publishing the digest on-chain. zk-Rollups provides higher privacy protection and transaction verification efficiency, but the technical threshold for implementation and deployment is relatively high.
ZK-Rollups Mainstream project
ol>
PolygonZkEVM
Scroll
Starknet
ZksyncEra
Linea
Projects based on Polygon CDK, Scroll and ZkSyncEra
Bitcoin Ecology (Side Chain)
Stacks (formerly Blockstack) is a build to A platform for centralized applications (dApps) and digital assets, aiming to give users greater data control and privacy protection through blockchain technology. Stacks provides a smart contract platform based on the Bitcoin blockchain that enables developers to build secure, private decentralized applications and allows users to own and control their own data.
Nervos: A Layer2 network based on the RGB++ protocol that handles cross-chain interoperability. Currently, it is The inability to run smart contracts is also the biggest challenge for Nervos' future development.
Preview
Gain a broader understanding of the crypto industry through informative reports, and engage in in-depth discussions with other like-minded authors and readers. You are welcome to join us in our growing Coinlive community:https://t.me/CoinliveSG