Side Chains for Layer2 Scalability#
In our previous article "The Technical Logic Architecture of Blockchain - Layer0-3," we mentioned that there are many solutions for Layer2 scalability. We have already discussed state channels in the previous issue, so in this issue, we will continue to explain the next solution, which is side chains.
1. What are Side Chains?#
A side chain is an independent blockchain network that is connected to the main chain through a bidirectional channel. Unlike other scalability solutions, side chains usually have their own set of nodes and consensus rules. However, they are designed to be interoperable with the main chain, which is usually a public blockchain like BTC or ETH. This interoperability allows assets and data to be transferred from the main chain to the side chain for specific tasks or applications. Therefore, the security of transactions on the side chain is guaranteed by itself and does not depend on the main chain. This is also the biggest difference between side chains and other solutions.
Since side chains have their own consensus mechanism (such as using POA or DPos), they can increase transaction throughput by modifying block time or block size. However, this may sacrifice a certain degree of decentralization and security.
The interaction between side chains and the main chain mainly relies on a bidirectional channel (bidirectional bridge), which is used to exchange tokens on the main chain and side chain.
The diagram below illustrates the side chain:
2. The Role of Side Chains#
1. Scalability: Side chains can handle transaction loads that the main chain cannot bear, improving the performance of the entire blockchain ecosystem. Specific-purpose side chains can be optimized for specific purposes or applications, such as financial services, supply chain management, or privacy transactions.
2. Isolation: Side chains can provide additional security and isolation to prevent problems on the main chain from affecting the side chains negatively.
3. Functionality: Side chains can implement new features and smart contracts without being limited by the main chain.
3. Operation Mechanism of Side Chains#
Let's assume we have a side chain called Polygon, and our main chain is Ethereum. Can we directly use ETH on Polygon for transactions? The answer is no. We need to use tokens on Polygon. So, how do we get these tokens?
The answer is through staking. To complete this process, a smart contract P will be created on Ethereum. When you stake 10 ETH into this contract, contract P will call the smart contract C on the side chain to mint tokens proportionally. This process is also called deposit. After the minting is completed, you will receive 10 side chain tokens, which can be used for transactions on Polygon.
After a series of transactions on the side chain Polygon, let's say you have 5 tokens left. Can these 5 tokens be exchanged back to ETH on the main chain? The answer is yes, and this process is called withdrawal.
The withdrawal process is slightly more complicated than the deposit process. It requires destroying the 5 tokens on Polygon and submitting the proof of destruction to the main chain. When this destruction proof is successfully submitted on the main chain, the smart contract P will be triggered to refund the remaining staked ETH to the trader.
Therefore, the bidirectional channel between the side chain and the main chain is actually the interaction and invocation between the smart contracts of the side chain and the main chain.
However, side chains still have their drawbacks. The weak security of side chains may lead to losses of assets on the main chain. For example, there was a hacker who exploited a vulnerability in a side chain, created a large number of tokens out of thin air, and withdrew these tokens for ETH on the main chain, causing significant losses.
Another Layer2 Solution: Plasma
Most of Plasma's design is similar to side chains, so we will explain it together with side chains in this issue.
There are two main differences between Plasma and side chains. First, Plasma periodically submits the state (Merkle Root) of the Plasma chain to the main chain. Second, its withdrawal mechanism introduces fraud proofs.
Fraud proofs mean that if I withdraw 100 ETH from Plasma, others can raise objections. If the fraud is confirmed, the transaction will be invalidated, and the objector can also receive a reward.
With the role of fraud proofs, the security of Plasma is higher than side chains, but the withdrawal speed is much slower than side chains because fraud proofs require a waiting period (challenge period), usually about a week.
1. Although side chains and Plasma are considered effective solutions for Ethereum scalability, they are now being gradually abandoned in favor of more efficient and secure Layer2 solutions such as Rollups.
2. There are two main types of Rollup solutions: Optimistic Rollups and Zk Rollups. Optimistic Rollups are currently the more mature solution, while Zk Rollups are the ultimate Layer2 solution mentioned by Vitalik Buterin.