What is the difference between Layer2 and side chain? Are sidechains secure enough?
Editor's Note: This article comes fromChain catcher (ID: iqklbs)Editor's Note: This article comes from
Chain catcher (ID: iqklbs)
Chain catcher (ID: iqklbs)
, Author: Ali Atiiaa, reprinted with authorization by Odaily.
During a bull market, misinformation in the crypto industry increases dramatically, with many sidechain projects misleadingly packaging themselves as layer 2 scaling solutions. This article aims to explain to beginners what makes a chain a Layer 2, so completeness and rigor are sacrificed to make the article more accessible.
Normally, Layer1 has high security and liquidity, and Layer2, as a new chain, hopes to obtain security and liquidity from Layer1.
Let's look at a simple example, for beginners, especially those who have just joined the cryptocurrency industry, if Metamask shows that you have 100 DAI on Ethereum, how does Metamask know? It communicates with the Ethereum p2p network through an Ethereum node-as-a-service provider called Infura. But what does it really mean to own 100 DAI? This means that the DAI contract is a piece of software consisting of code and data that lives on the Ethereum blockchain and has your address in your Metamask with the number 100 next to it.
Going back to the new chain, it may or may not be L2, let's call this chain Macau, and you want to move 100 DAI from Ethereum to Macau, because you want to transact there, or transact with cheaper gas fees, Or maybe you just want to do something to feel something."So how do you move the 100 DAI to Macau? Did you send an email to Vitalik's Masternode HQ asking him to transfer it? No, you're actually sending your 100 DAI to another contract on Ethereum, which is often called a deposit contract (think of it like a casino's deposit window)."Step 1: You send 100 DAI to the Macau deposit contract on the Ethereum chain."The validators/workers in Macau can see your deposit because they are constantly watching Ethereum, specifically that deposit contract, and one of them says to the others:"。
Hey guys! We have a new customer coming to our casino, hurry up! Looks busy, ahem
. Then she says to you:"Welcome chad, glad you can join us, here are 100 synthetic DAI for you to play on our chain, freshly baked in this Macau block I just verified"Step 2: You have obtained 100 IOU tokens issued by Macau (which can be thought of as casino chips), representing a claim on the real DAI locked in the Ethereum deposit contract. We call these IOU tokens Synthetic DAI, or sDAI for short.
Macau is actually like some websites. This website has some front-end pages that are exactly like those on Ethereum. For example, if you borrow money on the Aave protocol or trade on Uniswap, these front-end Javascripts will package a borrow/exchange for you. Transaction, feedback to your Metamask, you will be sad to see the gas fee after 5 minutes, and then continue to click
confirm
Sign and broadcast your transaction, you are familiar with this workflow.
The same is true on Macau, in fact, if Macau is a fork of Ethereum, it may even be exactly the same workflow, such as Binance’s BSC or Avalanche’s C chain, because you can use Metamask to work with both, There is no need for a special wallet to sign packaged transactions (because the address format of Ethereum/BSC, etc. is the same as the encryption signature scheme).
Step 3: Use this 100sDAI to do something on Macau, such as trading, mining, investing, etc.
For example, you play poker and turn your 100sDAI into 200sDAI (the +100sDAI you get comes from other people who also come to Macau to gamble. So they also locked the real DAI on Macau’s deposit contract on Ethereum before).
For example, you participate in the transaction and get 200 sDAI through 100 sDAI (the 100 sDAIu you get also comes from other people in Macau, so they also locked the real DAI in Macau’s deposit contract in Ethereum before)
We've come to the most critical part.
You want to recoup your gains on Layer 2 and switch back to Ethereum because you are a user who values high security and deep liquidity, or you are a masochist who loves $1,000+ in gas fees mad. If you can independently withdraw your 200 DAI from Macau's deposit contract on Ethereum anytime, anywhere, and no one can stop you...then Macau is a L2 solution."If Macau's validators could theoretically prevent you from withdrawing your 200 DAI, or withdraw directly to themselves, then Macau is not an L2, but a sidechain."。
Macau is also not L2 if you can theoretically withdraw more money than you deserve, say 300 DAI.
When it comes to scaling solutions, it always comes down to
who controls exports
So how to make the deposit contract on Ethereum smart enough to prevent yourself or other Macau users and Macau miners/validators/operators from cheating?
As you can imagine this is not a trivial matter, because it requires the contract to be smart enough to know who owes whom and when in Macau: because although you did win 100 in a poker game in Macau an hour ago sDAI, so you have the right to withdraw 100 DAI on Ethereum, but after that you may lose in a subsequent game! Therefore, the contract must be able to determine the truth. Therefore, the contract must be able to determine the latest transaction information in Macau."Users must keep an eye on Ethereum's L1 contract in order to challenge/suppress/punish malicious withdrawal attempts that threaten their assets.",or"Users must store the data necessary to file a dispute. In the case of one-tier channels, this data is usually a signature from the counterparty attesting to a state change in the channel (e.g.")。
Alice: I prove to pay Bob 10 DAI
Charlie: I justify moving the rook to position H5 on this board when configuring Xbeginner , intermediate , zk-rollup andoptimistic rollup。
Specific to plasma: users are vulnerable to a massive increase in the amount of data they need to store, because the data they are interested in exists as part of the global plasma chain state, rather than just a transaction party like channel 2; plasma operators ( block producers) who may attempt to maliciously withdraw while withholding the data needed from users to issue a challenge. This adds more complexity to the withdrawal security logic on L1.
These annoying problems weren't really solved until rollup came along, which required that all data needed for a user to exit was available on L1. These data are updated by the rollup operator whenever L2 advances state. Therefore, the execution of L2 and the data update of L1 are progressing synchronously. You can learn more about rollup by reading these articles:
and
In rollups, all parties involved are guaranteed to remain honest through mathematical (ZKRU) or cryptoeconomic (ORU) guarantees, and if the rollup operator disappears or starts misbehaving: spamming, censoring, or (in the case of optimistic rollups) committing fraud, Users can always safely withdraw their funds using the data on L1. This is all reflected in the rollup contract on L1 Ethereum, so the only thing users need to trust is the faithful execution of these contracts by the L1 network (the same trust assumption around any other L1 contract, such as MakerDao MCD or Aave, etc.).
Note 1:
Other first-layer blockchains, such as NEAR, Polkadot or Cosmos Hub can indeed become a rollup relative to Ethereum, they only need to make a bridge that obeys the rollup design pattern and publish the necessary data to Ethereum, just like other rollup is the same.
Note 2:"In the case of ZK Rollups, fraudulent behavior cannot even be enforced thanks to the validity proofs proving the correctness of Rollup state updates, each of which is verified on L1. However, the data must still be published on-chain so that if the operator disappears, users can still use the data to submit withdrawal requests themselves."Note 3:
Can Bitcoin have 2 layers? No, it lacks the EVM and state pipeline needed to create complex Layer1 contracts to manage disputes and/or verify proofs of validity. Of course, you'll hear it said that you can use a Bitcoin sidechain
without giving up control of your coins
, but that's just false advertising.
Rollup is the only layer 2 scaling solution that can guarantee that you will not be robbed while sleeping, because the exit is under the control of the L1 chain.
Back on the sidechain:
If Rollup is so amazing, why would anyone choose to build sidechains that require extra trust and have been rejected by the market for the past 7 years?
Sidechains refuse to fail because they are so easy to get going, usually people go through the details of how they work to create a pitch platform, raise money from angel investors, and then sell the tokens to retail investors.
You can actually create a sidechain in an afternoon: you just set up a basic smart wallet-like contract on Ethereum, where people deposit funds, and just choose a new one for your sidechain. Chain ID and rebuild.... And voila, you're basically done...well, well, not quite...you still need to hire an army of scammers, a graphic designer to create a slick website, etc.... ..but plenty of VCs are happy to take care of it all for you, and they have massive bots ready to deploy.
Some scammers will try to package the sidechain as L2 and sell it to you, and some may even be shameless enough to claim that their sidechain is more secure than rollup. But it comes down to a simple question: Who controls the exit? With rollups, egress is under the control and protection of Ethereum L1's powerful EVM.
To summarize the above message:
Currently, any chain claiming a scalability solution with TPS > 2000 may imply a sidechain, and users are making other undisclosed trust assumptions.
After the ETH 2.0 shard goes online, Rollups may provide more than 10k TPS, and they have a large demand for data.
Rollups are the only layer 2 scalability solution that does not require additional trust and/or liveness assumptions on users.


