What is layer2 ? Learn about the investment opportunity in the Ether Scaling solution in one article
Layer2 is a very suitable solution to solve the problem of cryptocurrency network scaling.
The bottom layer of each cryptocurrency network is resources and communication, layer0. Layer1 is the layer with consensus, which is responsible for the security of the network by consensus algorithm out of the block. But layer1 will have certain limitations because large-scale consensus and high efficiency is contradictory. So it can only bypass the congestion and open up another way to solve the problem of network congestion.This is layer2.
Theoretically, if it is not a process in the chain, it is “layer2”, such as bridges, relays, gateways, which can be part of the information relay. But in order to achieve security, the definition of layer2 must be some solutions with security. For example, a smart contract, a network with node authentication capability.
Because layer2 is ultimately achieved to ensure the security of the case of layer1 account balance update, so in most cases will be the two layers of the account to do a balance change association, simple understanding is layer1 book and layer2 associated with the change of the book, most cases layer2 is only through the contract to achieve.
For example, if a contract is used to do a cryptographic processing of the address books of the two parties to the transaction to add or subtract correspondence, this is a lightning network class of technical solutions. If the ledger delivery process is added to a zero-knowledge proof class of technology, the transaction messages with proofs go once in layer2 and information is delivered securely, this is layer2 scaling using zero-knowledge proofs. If layer2 has a separate network, to have network nodes can perform separate verification, this layer may have a separate consensus, can run some contracts in the network to perform associated account changes, this is some sidechain solutions.
Most of the cryptocurrency projects in layer1 implementation performance is not enough, so many networks will have layer2 solutions. Layer1 to ensure security and decentralization, absolutely reliable and trustworthy; it can achieve global consensus, and as a “cryptocourt”, through the rules designed by smart contracts to arbitrate, in order to Layer2 pursues the ultimate performance, which can only achieve local consensus, but can meet the needs of various business scenarios.
There are several solutions for layer2, namely: Rollups, State channels, Sidechains, Plasma, Validium, Hybrid solutions, etc. This article will explain the first four solutions in detail.
Rollups are the most mainstream scaling scheme, which essentially takes a large amount of transaction data originally distributed in a block, packages it into a single set of transactions, and publishes it to the chain. To ensure the validity of each of these transactions, various Rollup solutions have designed different mechanisms to ensure that the security of the entire process remains consistent with Layer 1. This solution can be further subdivided into: ZK rollups, Optimistic rollups. zK rollups ensure security with zero-knowledge proof zk-SNARKs cryptography, while Optimistic rollups inherit Plasma’s penalty mechanism to ensure that nodes will pay a high price if they do evil.
II. State channels (State channels)
Pros: low latency, high real time
Disadvantages: limited number of users, low utilization of funds
Uses: micropayments / prediction markets / betting on horse racing
A stateful channel is also a channel that is constructed under the chain between two parties to a transaction, after signing it with a private key.
Stateful channels are a means of scaling up. scale up means linearly scaling up the blockchain using technical means, like sharding, for example. For example, Ether 2.0 is going to start 64 shards, and then its capacity is increased by 64 times. And for the state channel, he can now support 1000 users online at the same time, the future may support up to 64000 users, this number is still very low.
Although the scaling of stateful channels is saying that the more nodes you have, the bigger your network, the more capacity you have. This is a very rosy scenario, and it actually suffers from a major limitation — low liquidity utilization. The state channel is the channel where you want both sides of this to deposit this money on the chain and then send payments to each other afterwards. The first step is to deposit the money on the chain, which is limited. It’s you say you have 1000 Ether on hand, the status channel can only send 1000 Ether. If you suddenly send a sum of 2000 or more Ether, it can’t do anything about it.
This is because capacity can be scaled, however there is no way to scale money mobility. If one user sends a large amount of money to another user, then every node in between that is forwarded would have to have that much capacity, which is unlikely in real life. By the time everyone locks so much money into one state channel, this is very inefficient if the only way to forward it is with a state channel.
The status channel can only support micropayments. Moving a general dAPP to the status channel is quite difficult, for example an exchange like uniswap is very impractical to move into the channel because his user base can be very large.
III. Side chains
Pros: code and data independent, no additional burden on the main chain
Disadvantages: weak security
The core idea of a sidechain is to build a completely independent blockchain with its own verifier and operator, and an independent consensus mechanism.
The core idea of a sidechain is to have a completely independent blockchain. The sidechain has its own verifier and operator, and has the ability to migrate assets back and forth to the main chain, and can map each block header to the main chain to prevent forks.
Mapping is a security guarantee that provides the possibility of preventing verifiers from operating covertly to cause forks.
In the above figure, the sidechain generates blocks and maps them to the main chain. Mapping is storing the hash of the sidechain block on the main chain. The principle of the fork selection rule on the sidechain is that if this chain is not built on top of the last mapped block, it will not be recognized. In the above diagram, even if the verifiers of the sidechain collude with each other and try to generate a longer chain A’<-B’<-C’ after generating block A, as long as block A has been mapped to the main chain, then even if A’<-B’<-C’ is the longer chain, this longer chain will be ignored by the sidechain participants.
The main chain will have stronger security by moving from POW to POS, but the sidechain has fewer validators and weaker security: only 100 validators for Cosmos, for example.
The TPS of a sidechain depends on the number of people it verifies. The more people it has verified, the lower its TPS will be. The latency of the sidechain is relatively low, a bit higher than the milliseconds of the state channel, and much lower than the teeny-tiny seconds latency of the main chain.
IV. Plasma (Plasma)
Features: inability to apply to smart contracts, heavy burden on users to run nodes
Ether Plasma was co-founded by Ether co-founders Vitalik Buterin and Joseph Poon. The concept was created in August 2017 as a scaling solution for Ether.
The main idea of the Ether Plasma is to create a side-chain framework that will communicate and interact with the main chain (in this case Ether) as little as possible. Such a framework is designed to operate a tree-like blockchain that is arranged in a hierarchical fashion, making it possible to create many smaller chains on top of the main area. These smaller chains are also called Plasma chains or subchains.
The structure of the plasma is built by using smart contracts and Merkle trees, allowing for the creation of an unlimited number of child chains — basically smaller copies of the parent Ether blockchain. At the top of each child chain, more chains can be created, which is why it is called a tree structure.
Plasma is a separate blockchain with a fraud proof mechanism.
Overall, the Layer 2 track is currently blossoming, and the overall trend has taken off. At present, there are still 2~3 years from the official launch of the main Ethernet 2.0 network, before that, the large-scale expansion of the Ethernet ecology cannot be separated from the Layer 2 expansion, and this field will definitely be a red sea in the future.
And NEC (New Era) is a Layer-2 on-chain aggregator based on the core concept of Ethereum expansion, which does not affect decentralization and utilizes the existing developer community and ecosystem.
NEC is committed to building a modular, universal and highly flexible expansion framework for Ethereum,the core component SDK supports the construction and connection of two mainstream expansion paths: Secured chains as the layer 2 , which can rely on the security of Ethereum without establishing its own verification mechanism. In addition to the completion of the main chain, other Layer 2 expansion schemes will be supported in the future, such as Optimistic Rollups, zk Rollups, Validium, etc., which will make NEC a real Layer 2 aggregator on the Ethereum.