Summary
“Multiple cars are blocked and capacity expansion is imminent”-Layer 2 capacity expansion has always been one of the clear development trends of the blockchain industry. With the active Ethereum ecosystem and network congestion, the Layer 2 track has become the focus of the market again. This article will systematically introduce the principle and development process of the Layer 2 expansion mechanism, and look forward to the future ecological evolution and investment opportunities.
The essence of Layer 2 expansion is to put part of the computing tasks on the blockchain off-chain and transfer the calculation results back to the chain to achieve the improvement of blockchain computing power. In contrast, Layer 1 expansion is an improvement on the blockchain protocol to achieve expansion. While Layer 2 expansion does not change the blockchain protocol itself, expansion is achieved through the interaction between on-chain smart contracts and off-chain. The core link is the data interaction between Layer 1 and Layer 2, and how to ensure the security of assets on Layer 2.
Ethereum’s “sweet worries”-the outbreak of demand brings network congestion and soaring costs. Layer 2 is both a technical problem and a means to balance the interests of multiple parties. When the Ethereum ecosystem is prospering, the increase of users brings more transaction requests. The increase of complex contracts and complex calls reduces the actual transaction capacity of a single block. The rise in the price of ETH increases the transaction fee denominated in fiat currency, which is congested. The network will further increase the price of Gas. This mechanism-based cyclical development will cause bubbles and head effects on Ethereum projects, and overall it will reduce the innovation capabilities of Ethereum platform applications. The expansion of Ethereum is not only expected by the public, but also the general trend. Only by alleviating this kind of institutional congestion and high handling fees, can the healthy development of the Ethereum ecosystem be realized.
Looking at the development of Layer 2 expansion technology, the current technical routes mainly include side chain expansion, state channel expansion, Plasma and Rollup: the core of side chain expansion is to use another independent blockchain to undertake current transactions, thereby improving computing efficiency Reduce handling fees. The state channel was proposed around 2014. Its core is to lock through a hash and perform a series of transactions off-chain, and only put the transaction results on the chain, which is especially suitable for solving the pain point of high handling fees for small high-frequency payments. Around 2017, Plasma’s expansion route was proposed. In order to solve the threat of side chain security to assets in side chain expansion, Plasma’s design principle is to ensure that users can propose the first time even if the side chain fails. Own assets. The concept of Rollup was put forward in 2018, and the transaction information is highly compressed and packaged on the chain, even if the off-chain data is completely unavailable, assets can be raised. These technical routes are not clear-cut, but an evolutionary development of mutual integration, showing the spontaneous growth of the blockchain ecology.
Investment advice: We believe that the expansion of Layer 2 is on the eve of the outbreak. The first-to-live and EVM-compatible general platform Layer 2 solution will have a great first-mover advantage, and the user experience will become a decisive factor. Layer 2 expansion will greatly reduce handling fees and improve transaction efficiency, and the Defi market is likely to usher in a reshuffle. The expansion of Layer 2 will reduce the operating cost on the chain, promote the innovation of blockchain projects, and may realize deeper innovative applications of blockchain in the fields of games, finance, virtual world, and meta-universe.
Risk warning: The blockchain business model is not as expected; the uncertainty of regulatory policies.
1. What is Layer 2?
The expansion of the blockchain is to increase the transaction processing speed of the blockchain, so that more transactions can be processed in the same time, which can be compared to the multi-road traffic jam, and the need to build new elevated highways and tunnels to provide traffic efficiency. Layer 2 expansion is the general term for the off-chain expansion plan, which refers to putting part of the calculation process on the blockchain under the chain, and transmitting the calculation results back to the blockchain, thereby achieving the improvement of the blockchain’s computing power.
In contrast, Layer 1 expansion is to improve on the blockchain protocol to achieve expansion. While Layer 2 expansion does not change the blockchain protocol itself, expansion is achieved through the interaction of on-chain smart contracts and off-chain data.
Why does Ethereum need to expand?
Ethereum implements Turing complete calculations through EVM (Ethereum Virtual Machine). Developers can implement complex program logic through smart contracts on the chain. We can abstract Ethereum as a decentralized computer.
Ethereum uses the Gas fee mechanism to prevent the influence of malicious contracts (such as infinite loops), limit the capacity of a single block, and encourage participants to improve the efficiency of the network. The gas fee mechanism is to charge users for operations on the chain, and the fees are calculated according to the rules of operation type and complexity. These fees are paid to the group of miners who maintain the network and run contract calculations. The miners who dig a block get the total gas fee for transactions in the block. Gas fee is determined by operation type and complexity. Reading and writing information on the chain and calling external contracts will be more expensive than executing ordinary code. From a macro perspective, Ethereum originally intended to dynamically adjust the supply and demand of resources through the Gas mechanism to prevent malicious occupation of resources on the chain.
The gas price of the transaction is affected by the level of the Ethereum network. Generally speaking, the miners choose the packaged transaction according to the gas price and the waiting time of the transaction instruction. The transaction instructions with high gas price and long waiting time are prioritized. The user can according to the network situation Determine the gas price. The unit of Gas price is generally Gwei, 1Gwei=0.000 000 001ETH, the Gas fee to be paid by a single exchange = Gas required for operation (determined by rules) × current Gas price (determined by network conditions).
The Gas fee mechanism brings natural use value to ETH, and also encourages users and developers to streamline their operations and smart contracts, and encourages miners to bring packaged transactions. The capacity of a single block of Ethereum is also limited by the gas fee (Bitcoin is through the block size). The gas fee of all transactions contained in a single block cannot exceed the upper gas limit, thus limiting the capacity of a single block The miner who digs the block can fine-tune the gas upper limit to adapt to the network conditions.
With the explosion of Ethereum’s ecological application in the last six months, the transaction volume of the Ethereum network has risen sharply, and the price of ETH has also risen rapidly due to ecological development. Various arbitrage robots have enabled automatic arbitrage in DeFi applications. Arbitrageurs’ network speed sensitivity is much greater than network cost sensitivity. As long as the arbitrage space is larger than the cost, they are willing to pay super-high gas fees in exchange for fast transaction processing, and the average gas fee of the network will also increase. When ordinary users participate in these applications, they become slow and the network is congested. With the high gas fee and the high price of ETH, an ordinary Defi contract call can even reach dozens of hundreds of dollars. As transaction fees increase, Ethereum will face a situation where the popularity of Ethereum will weaken and project innovation will decrease.
We believe that the current Ethereum network congestion and high transaction fees are due to the mechanism of Ethereum Gas fees. Whenever the ecology is prosperous, the rise of users brings more transaction requests, and the increase of complex contracts and complex calls reduces the cost of a single block. The actual transaction volume, the increase in the price of ETH increases the transaction fee denominated in legal currency, and the congested network will further increase the gas price. This deterioration of the mechanism will cause bubbles and head effects on Ethereum projects. Initial projects and Projects with insufficient market promotion will be turned away by users because of high handling fees, which reduces the innovation capability of Ethereum platform applications as a whole.
The above contradiction is a “sweet trouble” for the public chain. Only when the ecology on the chain develops to a certain level, the gas fee problem will arise. Behind it is the three-party game of miners, Token holders, and ecological project parties. , Network stability, effective incentives and application innovation need to be balanced everywhere. Improper handling will cause harm to the community, especially after ETH has become a blockchain “model project”. Similarly, this kind of problem is theoretically unavoidable for every blockchain network that adopts the native token Gas fee mechanism. Ethereum is the fastest growing and the first to face such challenges.
Under the current circumstances, the expansion of Ethereum is not only expected, but also the general trend. Only by alleviating this institutional congestion and high handling fees, can the healthy development of the Ethereum ecosystem be realized.
The basic framework of Layer 2 expansion
The core idea of Ethereum Layer 2 expansion is to build a second-layer network on the basis of the main chain to help Layer 1 share the network pressure to achieve overall efficiency improvement. At present, there are four main types of Ethereum Layer 2 expansion technology architectures: state channels, side chains, Plasma, and Rollup.
The key points of the expansion mechanism of Layer 2 are the contract design of Layer 1, the protocol design of Layer 2, the design of cross-chain data interaction, especially the process design of asset deposit and withdrawal. From this we outline the basic framework of the Layer 2 expansion mechanism, which is sufficient to describe most of the current Layer 2 expansion projects.
Why pay attention to Layer 2 expansion?
The blockchain expansion route focuses on how to achieve higher computing power while ensuring security. Layer 1 expansion may be more able to fundamentally change network congestion, such as the shard expansion adopted by ETH2.0. However, the biggest drawback of Layer 1 expansion is the high cost of consensus. Simply increasing the block capacity will lead to a more centralized system, and there is a risk of hard forks (such as BCH forks from BTC). And Layer 2 expansion is a lighter, fast-achievable expansion method. It can undertake the existing ecological applications of the main chain, and the required resource cost is much less than that of the main chain expansion. This is also the rapid development of the Layer 2 track. one of the reasons.
Looking at the development of Layer 2 expansion, the idea of side chain expansion and state channel expansion is earlier than the emergence of the Ethereum network. It was proposed as early as the Bitcoin era. The core of the side chain expansion is to use another independent blockchain. To undertake current transactions, thereby increasing computational efficiency and reducing handling fees. The state channel was proposed around 2014. Its core is to lock through a hash and perform a series of transactions off-chain, and only put the transaction results on the chain, which is especially suitable for solving the pain point of high handling fees for small high-frequency payments. Around 2017, Plasma’s expansion route was proposed. In order to solve the threat of side chain security to assets in side chain expansion, Plasma’s design principle is to ensure that users can propose their own assets even when the sub-chain fails. The concept of Rollup was put forward in 2018, and the transaction information is highly compressed and packaged on the chain, even if the off-chain data is completely unavailable, assets can be raised.
Layer 2 expansion attempts to break through the existing computing bottleneck of Ethereum while ensuring decentralization and security. The “killer” Layer 2 expansion plan is likely to change the current industry competition landscape, and may produce new applications and expand the imagination of the industry. Therefore, we recommend paying attention to the development of Layer 2 expansion. This article also sorts out the implementation methods of Layer 2’s different routes.
2. How is the expansion of Ethereum Layer 2 achieved? An overview of the technical route
The side chain expansion route is mature, but the ecology is active but controversial
The side chain is a blockchain network compatible with the main chain. It is a relative concept to the main chain. The essence of the Ethereum side chain expansion technical route is to create a blockchain network compatible with Ethereum and use a cross-chain mechanism to achieve slave Asset transfer from the chain to the side chain, and deploy applications on the side chain to share the main chain network congestion.
The side chain is an independent blockchain with its own independent consensus mechanism. Security does not depend on the main chain, and more efficient consensus mechanisms such as DPOS and POA are often adopted.
The focus of the side-chain technology route is the design of the cross-chain mechanism. The basic principle of the cross-chain mechanism is to lock the assets on the main chain and issue related assets on the side chain. If you want to return to the main chain, you only need to destroy the assets on the side chain and unlock the related assets on the main chain. Because the blockchain itself cannot obtain information on other chains, who transmits and confirms the information to determine the locking and issuance of assets has become a key issue. In order to solve this problem, a notary public mechanism verified by a third-party subject can be adopted, or A relay mechanism that verifies through the blockchain itself. The notary can use a single subject or multiple subjects to verify and multi-sign to confirm the transaction.
The biggest risk of side chain expansion lies in the safety of the side chain itself and the safety of the cross-chain process: once the side chain fails, the assets transferred to the side chain are very likely to be lost. Once the notary and the running nodes of the side chain commit evil, they can transfer the user’s assets from the main chain (the Plasma and Rollup technical routes are both to solve this problem and protect users from the threat of centralization and system failure).
Although the cross-chain mechanism has matured and the side chain expansion has become more and more convenient and efficient, this expansion route is still very controversial.
The exchange public chain, which has been popular since the end of 2020, can be regarded as a side chain expansion of Ethereum, which has undertaken the ecological spillover of Ethereum and achieved a noticeable user growth rate and the number of assets on the chain. Take Binance Smart Chain BSC as an example. It is compatible with Ethereum’s data and smart contracts, adopts a similar blockchain data structure and protocol, and uses a higher TPS DPos consensus mechanism. Ethereum assets and applications can be easily transferred to BSC, and developers also have mature development tools for application development on BSC. At the same time, the exchange has attracted a considerable number of users for BSC by virtue of its own ecology and user advantages. Because of the similarity with the Ethereum protocol, a large number of BSC projects that are benchmarked with Ethereum Defi have been launched quickly, and some of the ecological applications on Ethereum have also migrated to BSC.
Compared with Ethereum, the exchange public chain greatly reduces the handling fee for contract operation, and is more friendly to small assets or users who are first exposed to blockchain applications. This is also proved by the rapid growth of users and on-chain transactions. As far as the industry is concerned, the rise of the exchange public chain has a great controversy over the pros and cons of a decentralized ecosystem. It not only lowers the threshold for users and brings ecological activity, but also a threat to centralization. There is another controversy about side chain expansion. Does the side chain used for expansion still belong to the ecology of Ethereum? Can the side chain itself be regarded as the Layer 2 expansion plan of Ethereum? If the exchange public chain is considered to be a type of Ethereum Layer 2 expansion, from the perspective of the development status and the number of users, the side chain expansion is indeed the most mature and active route for Layer 2 expansion.
The state channel focuses on micropayments, but the experience and usability are poor
The state channel is that both parties of the transaction lock assets on the chain to create a payment channel and conduct transactions off-chain. When users withdraw assets from the main chain, they only need to submit the proof of multiple off-chain transactions to the main chain smart contract for verification. .
The state channel dilutes the processing fees of multiple transactions, and is especially suitable for small multi-frequency transaction scenarios. This technology was proposed as early as the Bitcoin era, because the transaction fees on the chain have nothing to do with the transaction amount, which leads to a high percentage of small transaction fees.
Take the state channel expansion project Raiden Network as an example, the process is as follows:
Both participants need to lock the assets in the smart contract. This step ensures that the participants can transfer and receive assets to each other until the participants close the payment channel;
Participants maintain their own account balances, and both parties conduct transactions by sending signed transaction certificates;
The transaction can continue until one of the parties decides to withdraw the asset and close the channel. He can show the transaction proof to the smart contract at any time to close the channel. If the other party has a transaction with the exiting party, he needs to show the transaction proof at that time;
After both parties show the remaining transaction, they can withdraw the deposit from the smart contract. When the other party cannot show the transaction proof in time, the system will determine that he has not received any transfers and distribute them according to the unilateral proof. This mechanism ensures that anyone can get his funds back, even if the other party does not cooperate.
We can see that the advantages of the state channel are: the use of net settlement between the two parties reduces the single transaction cost; the transaction details of both parties are not connected to the chain to ensure transaction privacy; at the same time, the exit mechanism maximizes the security of the participants’ funds.
But there are serious shortcomings in the user experience: first, only transactions can be made with users who have opened channels or in the payment network; second, you must constantly pay attention to whether the counterparty chooses to close the channel, so as to show the received transactions to ensure Own rights and interests; third, the scalability of the state network expansion mechanism is poor, and it is difficult to achieve other operations outside of the chain transaction.
Plasma guarantees asset security, and unavailability of information is the biggest obstacle
Plasma can be regarded as a side chain technology to ensure the security of assets. It uploads the status proof under the chain to the main chain. Even if there is a security problem under the chain, users can prove and propose assets. Plasma technology architecture currently has two mainstream mechanisms, Plasma MVP and PlasmaCash.
Plasma MVP uses UTXO and Merkle proof to realize that users can withdraw their assets without resorting to a third party. Off-chain transactions are recorded in the Merkle tree in the form of UTXO, and the corresponding hash value is uploaded to the smart contract of the mainnet, so that users only need to provide a Merkle proof to prove that they have UTXO and raise funds.
When a user raises an asset, a period of questioning is required for fraud proof, and anyone else can prove that the user has already spent UTXO to realize the question. Because the main chain can verify the evidence provided by the user through the smart contract, but there is no way to know the user’s hidden information (for example, some UTXO has been spent).
Plasma MVP’s “group leaving problem”: When most users want to leave Plasma, all status certificates must be submitted to Ethereum, and the “challenge” is accepted during the challenge period. Since Plasma is not limited to the number of users, the processing capacity of Ethereum blocks is very limited. Therefore, if the entire valid state of Plasma is submitted to Ethereum for processing, Ethereum will be completely blocked and the transaction processing time will be reduced. Greatly delayed or even indefinitely.
The mechanism of Plasma Cash is very similar to Plasma MVP. The difference is that assets are recorded in the form of NFT on the sub-chain. The specific process is as follows:
1. When users lock assets in the contract, they will receive an NFT on Plasma that represents all deposited assets;
2. Plasma Cash uses a specific Merkel tree, and each NFT has a designated location. When a transfer occurs, the corresponding location records the transfer information, and uploads the root hash of the Merkel tree to the main chain;
3. It is necessary to provide the previous transaction records of the NFT during the transaction;
4. When the user logs out, the merkle proof of the previous two transactions needs to be submitted;
5. When a user withdraws assets, there is a questioning period, and anyone can question the user’s operations through transaction records.
In general, the advantage of the Plasma technical route is that it can ensure the security of users’ assets in the event of Layer 2 failure. This use of decentralized cryptography guarantee mechanism has made the Plasma route popular among the community.
However, the problems with the Plasma technical route are as follows: First, the data structure of the sub-chain is limited under this technical framework, which makes it very difficult to expand the universality; second, the Plasma mechanism has the problem of data unavailability, namely The main chain has no way to obtain all the off-chain data, only simple verification through the root hash, which also leads to a complicated exit mechanism, which often takes a long period (several days) to prove fraud, and users need to save their own data. , Always pay attention to the change of the sub-chain, which greatly affects the user experience.
The transaction data is compressed on the chain, the generalized platform is about to land, and the Rollup technical route has a promising future
The Rollup mechanism refers to highly compressing transactions and uploading them to the main chain, and verifying the authenticity of the transaction package through zero-knowledge proof or fraud proof, which solves the problem of Plasma’s data unavailability. The Rollup mechanism implements a hierarchical model in which data is on the chain and operations are off-chain, thereby ensuring the security of assets to the greatest extent.
In order to achieve a high degree of compression of transactions, the account asset data is maintained on the Rollup sub-chain, and each account has its own corresponding number. Therefore, only 4 bytes can realize the index of 223 accounts, which is enough to deal with most situations. Similarly, Rollup compresses everything that can be compressed without affecting readability (Figure 12), and the compressed transaction is less than one-tenth of the original. By compressing transactions, the Rollup mechanism can more efficiently use the existing Layer 1 network capacity, thereby achieving capacity expansion, and ensuring the availability of data on the chain while expanding the capacity.
The core problem of the Rollup mechanism is to verify the authenticity of the transactions in the compressed transaction package. For this problem, the solutions are mainly divided into two types: ZK Rollup based on zero-knowledge proof; Optimistic Rollup based on fraud proof. At present, both solutions are developing rapidly. Different teams have chosen different technical mechanisms. Projects on the Ethereum main chain have also made their own Layer 2 migration choices.
ZK Rollup adopting zero-knowledge proof is to send the zero-knowledge proof corresponding to the transaction at the same time when sending the transaction package, and the smart contract verifies the authenticity of the transaction package through the zero-knowledge proof. The overall process is as follows:
1. The user transfers in and locks assets, and the Layer 2 state tree adds account information and generates corresponding assets;
2. In the Rollup network, users sign and send transactions;
3. The sorter collects transactions, compresses and packs them into a transaction package, generates a zero-knowledge proof, and updates the state tree according to the transaction package;
4. The sequencer broadcasts the transaction package and zero-knowledge proof to the main chain;
5. The smart contract verifies the authenticity of the transaction package through zero-knowledge proof, updates the value, and executes the corresponding transfer operation.
The biggest advantage of ZK Rollup is its high degree of decentralization and high verification efficiency. The zero-knowledge proof is generated while the side chain is updating the state. The smart contract run by the miner can verify whether the new state in the transaction package originated from the old state superimposed transaction through the zero-knowledge proof, thus realizing the decentralization of Layer 2 data to Layer 1. Data verification, and because Layer 1 can quickly identify the authenticity of the data from Rollup, it can quickly complete the withdrawal of assets.
The disadvantage of ZK Rollup is that the process of generating zero-knowledge proofs is complicated and difficult. It not only requires a lot of calculations, but also the customization development of applications is difficult, and it is difficult to realize a universal platform compatible with existing applications.
The Optimistic Rollup (OP Rollup) technical route chooses to believe in the authenticity of the transaction package submitted by the operator and penalizes fraudulent behavior. The operator needs to pledge a certain amount of assets, and only the smart contract that meets the asset pledge conditions will receive the transaction package sent by it. Anyone can issue a fraudulent proof of the authenticity of the transaction package. Once the fraud is determined, it will be lost. All pledged assets. Through the economic incentives to the sorters and the doubters, the system achieves a safety balance.
When the challenger finds an error in the transaction package by recalculating the state value, he can send a fraudulent proof to the smart contract. The fraud proof includes all necessary information, including the account status before the transaction, the Merkleproof corresponding to the transaction, etc. Smart contracts can use fraud proofs to verify the authenticity of transaction packages by replaying transactions, thereby realizing fraudulent transactions.
The verification efficiency in this mode is reduced, but its advantage is that it is easier to implement a common platform, which is compatible with EVM smart contracts, which greatly reduces the workload of developers, which greatly reduces the difficulty of project migration, which is the OP Rollup project Occupying the Layer 2 blue ocean provides innate advantages and can also solve the urgent needs of the Ethereum network as quickly as possible.
The disadvantage of the OP Rollup mechanism is that the fraud proof mechanism makes it necessary to wait for a longer period of questioning for the deposit and transfer of assets, because once the assets stored in the contract leave the Rollup contract, it is unlikely that the transaction will be rolled back and the asset will be reverted. Recovered. Compared with ZK Rollup, Optimistic Rollup has lower verification efficiency and lower transaction compression rate, so the capacity expansion capability is also worse.
The expansion route of Ethereum Layer 2 is sorted out, and the mechanism is inherited instead of overnight
From the side chain expansion to the Rollup mechanism, it is not difficult to find that these technical routes are not distinct, but an evolutionary development of mutual integration. The fraud proof in the latest Optimistic Rollup mechanism has a similar mechanism as early as in the state channel expansion. And by anchoring the main chain to protect the asset security of the side chain, it was also passed from the initial Plasma solution to the Rollup technical route. The cross-chain mechanism is used in most technical routes.
Third, the future outlook of Ethereum Layer 2 expansion
At present, the Layer 2 expansion technology of the Ethereum network is in a period of rapid development, and solutions are blooming. Each solution has its own advantages and has also received support from related projects and communities that match its own characteristics.
In the short term, we believe that we will see a highly competitive and fragmented Layer 2 network group. The Ethereum main network may become a channel for large transactions and arbitrage transactions, and various Layer 2 networks will bring users low-cost and efficient Transaction execution. In the short term, different Layer 2 protocols may not be able to get through temporarily due to mechanism and technical problems, and will form a relatively independent small-scale ecosystem, with high interaction costs between them (multiple transactions with the main network). At this stage, the first-to-launch EVM-compatible general-purpose platform Layer 2 solution will have a great first-mover advantage, and the user experience will become a decisive factor. The expansion of Layer 2 will greatly reduce handling fees and improve transaction efficiency, and the Defi market may usher in a reshuffle.
In the medium term, Layer 2 agreements will try to achieve data connectivity, and different solutions will spontaneously form different Layer 2 alliances. We believe that ZK Rollup has better security and user experience than OP Rollup, and will occupy most of the Layer 2 market share by virtue of the superiority of the protocol. In the long run, we believe that the Ethereum community will eventually compete for the final winner of Layer 2, occupy most of the market, and achieve expansion while ensuring decentralization and information security. The unified Layer 2 protocol will also reduce the cost of network usage, which is conducive to the development of the ecology. Layer 2 expansion is not an intermediate compromise but a long-term solution. After the successful launch of Ethereum 2.0, the expansion mechanism of Layer 2 can still coexist with shard expansion to improve network throughput.
Layer 2 expansion is inseparable from cryptocurrency wallets, blockchain browsers, and market quotation websites to support and follow up on corresponding projects to provide a better user experience. The expansion of Layer 2 will reduce operating costs on the chain and promote the innovation of blockchain projects, which will give birth to deeper blockchain applications in the fields of games, DeFi, and virtual worlds.
Author/ Translator: Jamie Kim
Bio: Jamie Kim is a technology journalist. Raised in Hong Kong and always vocal at heart. She aims to share her expertise with the readers at blockreview.net. Kim is a Bitcoin maximalist who believes with unwavering conviction that Bitcoin is the only cryptocurrency – in fact, currency – worth caring about.