Gate.ioBlogEssentials for Crypto Newbie: What Is Layer 0, Layer 1 and Layer 2?
Essentials for Crypto Newbie: What Is Layer 0, Layer 1 and Layer 2?
24 November 11:44
1. There are six layers in the blockchain logic architecture: data layer, network layer, consensus layer, activating layer, contract layer, and application layer.
2. The data and network layers are part of the basic architecture of the blockchain and also the lowest layer of the entire blockchain system.
3. Based on fundamental architecture, the consensus layer, activating layer, contract layer and application layer work together to constitute the protocol layer of the blockchain.
4. Layer 0, also known as the data transfer layer, is the bottom layer of the OSI model and mainly involves the integration between blockchain and traditional networks.
5. Layer 1, or on-chain scaling, refers to a scaling solution implemented on top of the blockchain's base protocol.
6. Layer 2 is also known as off-chain scaling in which the underlying protocols and ground rules of the blockchain will not be changed, and the transaction processing speed will be increased through state channels, sidechains, and other solutions.
Scalability and Layer 0/1/2 are terms that are often mentioned in the cryptocurrency news. Especially now, with Ethereum actively pursuing more scalability, Layer 2 is arguably one of the hottest topics. So what are Layer 0, Layer 1 and Layer 2 in the blockchain? And what are their respective features and uses?
Let’s Start With Six Layers of Blockchain Technology In January 2009, Satoshi Nakamoto mined the first block of Bitcoin on a server located in Helsinki. For now, Bitcoin has grown into a massive system with tens of thousands of nodes around the world and a total market capitalization of over $1 trillion. It has perfectly solved the problem of representing value in the digital world and has also advanced blockchain technology. If the structure of the Bitcoin system is carefully analyzed, it can be divided into five layers based on its function: the data layer, the network layer, the consensus layer, the activating layer, and the application layer. Afterwards Ethereum rose rapidly in attention with smart contracts, and has set up a new paradigm for the blockchain system by adding a contract layer between the activating layer and the application layer. Let's have a closer look.
The data and network layers are the basic architecture of the blockchain and also the lowest layers of the entire blockchain system.
The data layer acts as the blockchain data structure (e.g. Merkle tree) and is composed of two elements: pointers and a linked list. Pointers are variables that refer to the position of another variable, and a linked list is a list of chained blocks with data and pointers to the previous block. What’s more, the data layer involves a hashing algorithm and asymmetric encryption used to ensure the tamper-proof nature of the blockchain. The layer can also be considered as a distributed and tamper-resistant database that needs to be maintained by all nodes of the system, which leads to the network layer of the blockchain.
The network layer refers to a huge P2P network that involves all nodes of the blockchain. In this distributed P2P network, once a node has created a new block, it transmits the information to several nearby nodes through a transmission mechanism. After the other nodes have authenticated the block, they will again transmit the data to the other nodes. Eventually, the block is officially connected to the blockchain once most of the nodes in the system have authenticated the block.
Based on fundamental architecture, the consensus layer, activating layer, contract layer, and application layer work together to constitute the protocol layer of the blockchain.
In the blockchain, the consensus layer mainly includes consensus algorithm mechanisms, which are used to unify the nodes that are not related to each other in the whole network and maintain the consistency of data at the data layer. So far, the common consensus mechanisms are the proof of work (POW) of Bitcoin, the proof of stake (POS) of Ethereum, and the delegated proof of stake (DPoS) of EOS. As one of the core technologies of blockchain, consensus mechanism plays a significant part in the security and operational efficiency of networks. In addition, it’s one of the crucial governance mechanisms of the blockchain community.
The activating layer includes the issuing mechanism and distribution mechanisms of the blockchain. Through the incentive mechanism, nodes in the system will spontaneously maintain the security of the whole blockchain network. For example, in the PoW consensus mechanism, newly issued Bitcoin tokens are distributed to miners who include and validate transactions. And it seems to reach a consensus that more work pays more. Nodes with more computing power are more likely to pack blocks successfully and obtain bookkeeping rights. In some cases, nodes that use their power for evil like cheating would be punished by the system.
Bitcoin creatively incorporates economic incentives into its algorithm, resulting in miners competing for bookkeeping rights through computing power. This mechanism maintains the transaction system while issuing new tokens, which in turn becomes an incentive for distribution to miners, thus creating a stable and secure system. In the process, Bitcoin's function as electronic cash is also fulfilled.
The contract layer mainly includes various _script_s, algorithms, and smart contracts. It is the basis of sophisticated blockchain programming. In the blockchain, it is a true implementation of what is known as 'code is law', where the contract algorithm, once activated, will inevitably follow its original settings without third-party intervention or facilitation. Furthermore, due to the Turing completeness of smart contracts, the contract layer is also programmable, which gives the entire blockchain network a virtual machine-like nature.
The application layer is the uppermost layer of the blockchain system and contains the various application scenarios of blockchain. For the Bitcoin blockchain, the electronic cash system with complete issuance, transfer, and bookkeeping functions, constitutes the application layer, while for a programmable blockchain like Ethereum, various advanced features and DApps work together to make up the application layer.
Layer 0, Layer 1 and Layer 2 The six layers of the blockchain system are structurally inseparable and jointly realize the functions of the blockchain. Returning to the scalability mentioned at the beginning of this article, the industry generally refers to the Open System Interconnection Reference Model (OSI) of the communications and re-divides the six layers into three Layers, with the bottom to top being Layer 0, Layer 1, and Layer 2.
Layer 0, also known as the data transfer layer, is the bottom layer of the OSI model and mainly involves the integration between blockchain and traditional networks. The Layer 0 scaling solutions are those that do not change the blockchain's structure and retain its original ecosystem rules for performance improvement. The Layer 0 solution is highly versatile as it does not affect the blockchain itself and is also compatible with Layer 1 and Layer 2 scaling solutions. They work together to multiply the performance of the blockchain network. There are still numerous issues that affect performance in the underlying network protocols to be optimized. The existing Layer 0 scalability technologies include BDN (blockchain distribution network), QUIC and UDP.
Polkadot is often referred to as a Layer 0 blockchain since its mainnet acts as a relay chain and only serves to provide security and interoperability between major parachains. And on top of Polkadot, some networks can connect to Layer 1 blockchains like Ethereum through slots, such as the Moonbeam chain supporting programming language.
Layer 1 corresponds to the data layer, network layer, consensus layer and activating layer in the blockchain logical architecture. Most crypto coins have an independent and unique public chain, namely Layer 1, on which all transactions are settled. Layer 1, also known as On-Chain Scaling, refers to a scaling solution implemented on top of the blockchain's base protocol. It generally requires modifying the block capacity, block generation time, consensus mechanism and other inherent properties of the blockchain to increase the trading capacity. Specifically, Bitcoin scaling upgrade is increasing the capacity of each block so that more transactions can be accommodated, while SegWit reduces the average space occupied by a single transaction, allowing more transactions to be accommodated per block. Upgrading to DPoS also allows for better performance at the expense of some degree of decentralization and security. However, the efficiency of Layer 1 scaling is susceptible to physical and economic factors.
Layer 2 corresponds to the contract layer and application layer of the blockchain. It is also known as off-chain scaling in which the underlying protocols and ground rules of the blockchain will not be changed, and the transaction processing speed will be increased through state channels, sidechains and other solutions. Layer 2 is a solution to the performance that scales outside of the main chain. It is complementary to Layer 1, i.e. Layer 2 is an infrastructure built on top of the underlying blockchain to provide better scalability, availability, and privacy for the blockchain. Compared with Layer 1, which pursues security and decentralization, Layer 2 pursues the ultimate efficiency and performance. Common types of Layer 2 solutions are side chain, Plasma, State Channels, Rollup and so on.
Since the rapid development of Bitcoin and Ethereum, the problem of insufficient performance is hovering over these well-known public chains. How to crack the "impossible triangle" and reach an optimal solution between scalability, decentralization and security is considered one of the most significant causes in the blockchain field. It is the "holy grail" of blockchain. In subsequent articles, we will introduce you to the scaling solutions on major blockchains and the latest scaling technology advancements, as well as help you track the industry's cutting edge. Let’s stay tuned!
Author: Ashley. H, Gate.io Researcher *This article represents only the views of the researcher and does not constitute any investment advice. *Gate.io reserves all rights to this article. Reposting of the article will be permitted provided Gate.io is referenced. In all other cases, legal action will be taken due to copyright infringement.