Exploring Sidechains and Rollups Differences and Similarities in Architecture, Security Guarantees, and Scalability PerformanceSidechains and rollups exploring the differences and similarities in architecture, security guarantees, and scalability performance.
Author: Emmanuel Awosika; Translation: Deep Tide TechFlow
Sidechains and Rollups are two solutions to the problem of blockchain scalability. The core idea of these two solutions is to move computation from resource-constrained blockchains (such as Ethereum) to independent blockchains optimized for scalability. This approach brings some benefits, such as reducing the cost per transaction, reducing latency, and increasing overall throughput. But the similarities end there.
Sidechains and Rollups are fundamentally different in their approach to scalability, as well as in their design decisions and trade-offs. It is important for developers who want to build scalable dapps using these two solutions to understand their differences.
This article provides an overview of Rollups and sidechains, and explores their differences in architecture, security guarantees, scalability, and other aspects.
- Fed raises interest rates to the highest level in 22 years, Powell warns that there will be no rate cuts this year.
- LianGuai Morning News | Insider The United States may reach a comprehensive framework agreement on stablecoins.
- How to handle the confiscated virtual currency worth 400 billion yuan involved in the case?
What are Sidechains?
Sidechains are blockchain networks that run in parallel with another blockchain, called the “mainchain”. Typically, sidechains are connected to the mainchain through a bi-directional cross-chain bridge, allowing for the transfer of assets and possible arbitrary data between the two networks, such as contract states, Merkle proofs, and the results of specific transactions.
Most sidechains have their own consensus mechanisms and validators, separate from the mainchain. This allows sidechains to settle and execute transactions without relying on other blockchains. However, it also means that the security of funds bridged to the sidechain depends on the presence of strong cryptographic economic incentives to prevent malicious behavior among validators.
Types of Sidechains
EVM-compatible and non-EVM sidechains: EVM-compatible sidechains use a custom implementation of the Ethereum Virtual Machine (EVM), which is the execution environment for deploying smart contracts on Ethereum. In fact, most of these blockchains were initially forked from go-ethereum (also known as Geth, the most popular implementation of the Ethereum protocol).
While preserving many of the design features of Ethereum (such as support for smart contracts), EVM-compatible sidechains optimize other aspects, especially the consensus mechanism, to improve execution efficiency and throughput. Today, EVM-compatible sidechains run most smart contracts written in EVM languages like Solidity, while reducing costs and latency for decentralized application users.
Non-EVM sidechains implement different virtual machine architectures and cannot run Ethereum-native dapps without significant code refactoring. Developers building on non-EVM chains may not be able to use familiar EVM development environments and tools (such as Truffle, Remix, Hardhat) and may need to learn other languages (such as Rust or Golang) to create dapps.
Note: Avalanche, Fantom, Celo, and LianGuailm are examples of EVM-compatible sidechains. NEAR, Solana, and Algorand are examples of non-EVM sidechains.
Commit Chains and Optimistic Sidechains: Not every sidechain relies entirely on its own security; some sidechains, especially commit chains and optimistic chains, rely on the main chain to provide certain security guarantees. Commit chains periodically submit cryptographic commitments (such as block headers) to another blockchain to update their latest state. The main chain cannot verify these state proofs because it cannot access the sidechain’s state, but it ensures that honest participants can challenge invalid block headers before confirmation.
Typically, this is accomplished by implementing a smart contract on the main chain that handles rewards, staking, rotation, and punishment for sidechain validators. If a validator commits provable misconduct (such as signing two blocks at the same height), anyone can submit evidence to the smart contract and reduce the validator’s stake.
Optimistic chains operate similarly, requiring validators to regularly submit block headers to a smart contract on the main chain. However, Optimistic chains do not have a separate consensus mechanism – block headers are simply assumed to be valid until challenged by anti-fraud mechanisms. As a result, Optimistic chains can operate with just one (honest) validator, while commit chains require multiple validators to function properly.
In both cases, honest participants can prove malicious behavior occurring on the sidechain to the parent blockchain. This way, even if the majority of validators on the sidechain act maliciously, users can still obtain some level of security guarantee.
However, it should be noted that honest participants cannot prove malicious behavior without accessing the state data stored in the blocks. Furthermore, since the main chain only receives block headers (not block bodies) from the sidechain, it cannot guarantee block availability. This allows dishonest block proposers to engage in dishonest behavior, such as stealing funds from cross-chain bridges by hiding block data.
This issue is known as the data availability problem and is at the core of the security properties differences for all sidechains (not just commit chains, optimistic chains, and rollups).
What is a Rollup?
Rollups improve the scalability of the underlying blockchain by processing transactions in a separate execution environment. Similar to sidechains, rollups have cross-chain bridges for transferring assets between the parent blockchain and the rollup. They also implement optimizations to enhance user speed and cost-effectiveness.
However, rollups periodically submit blocks to the main chain, inheriting the security and decentralization properties of the parent blockchain. This means that the parent blockchain provides the following security guarantees for rollups:
Availability: The availability of rollup blocks is guaranteed because the data is stored on a more decentralized and secure parent network. For example, users can always prove detailed information about the rollup state (such as owning certain tokens) to the cross-chain bridge contract and withdraw funds when rollup validators hide transaction data.
Validity: Only rollup blocks that satisfy the validity conditions enforced by the parent chain can be finalized.
Liveness: Since rollup data is stored on the underlying layer, anyone can reconstruct the last valid state of the rollup and generate new blocks. Additionally, users can force their transactions to be included in the rollup by sending them to on-chain smart contracts.
Types of Rollup
There are two forms of Rollup: Optimistic and Zero-Knowledge. Zero-Knowledge Rollup (also known as Validity Rollup) submits blocks along with proofs to the main chain to confirm the correct execution of off-chain transactions. If the proofs are validated on-chain, the block will be ultimately finalized on the base layer.
Optimistic Rollup submits blocks without any proofs to demonstrate the validity of off-chain computations. Unless another party challenges the result of a transaction with a “fraud proof,” the block is simply assumed to be valid. Fraud proofs take the form of a verification game, where two parties dispute a computation with the intervention of the main chain until the dishonest party is discovered.
Optimistic Rollup is named after the optimistic assumption that most computations are valid. However, this optimistic assumption, combined with cryptographic economic incentives, ensures that an invalid block will never be finalized on the main chain unless it remains unchallenged for a long time.
Note: Arbitrum and Optimism are examples of Optimistic Rollup.
EVM compatibility is another notable difference between Optimistic and Zero-Knowledge Rollup. While Optimistic Rollup is EVM-compatible, Zero-Knowledge Rollup differs in terms of EVM compatibility. Due to the complexity and resource intensity of proving native EVM instructions in proof circuits, some Validity Rollups use custom virtual machine instruction sets optimized for more efficient proofs.
For EVM-compatible ZK-Rollup, we describe its execution environment as “ZK-EVM.” ZK-EVM can execute Ethereum smart contracts off-chain and prove that all parts of the computation are executed correctly. Therefore, compared to Optimistic Rollup, which relies on cryptographic economic incentives and honest assumptions to prevent invalid executions, ZK-Rollup is considered more secure.
Linea is an example of a second-layer Validity Rollup with full EVM support, allowing developers to reuse Ethereum infrastructure and tools to build dapps. In contrast, deploying on a non-EVM ZK-Rollup (such as StarkNet) requires either (a) building smart contracts with a different stack or (b) modifying code libraries to run on the StarkNet virtual machine.
How are Sidechains Different from Rollup?
Throughput: Sidechains typically have higher average transaction throughput than Rollup because they are not dependent on the consensus and data availability of the main chain. For example, sidechains can achieve larger block sizes and extremely fast block times for higher throughput, which Rollup cannot achieve.
Rollup must avoid processing too many transactions to the point where batches of transactions cannot fit into a single main chain block. Otherwise, this would reintroduce congestion at the base layer and make it difficult to keep up with the blocks generated by Rollup. Therefore, the data bandwidth of Rollup’s main chain imposes effective limitations on its throughput.
Even side chains that partially rely on the security of the main chain, such as commit chains and Optimistic chains, still have higher throughput than Rollup.
Cost: Compared to Rollup, users may pay lower fees for transactions on side chains. Similar to other differences between side chains and Rollup, this is related to Rollup relying on the main chain for settlement and finality. Here are some operational costs generated by Rollup (which are borne by users):
Data storage: Submitting Rollup blocks to the underlying layer incurs fixed costs (the cost of including transactions in a block) and variable costs (based on the size of Rollup blocks). Therefore, Rollup charges users for computation and data fees, with larger transactions paying more fees and vice versa.
Proof generation and verification: Zero-knowledge Rollup requires generating validity proofs for verification on the underlying layer, which incurs additional costs. Verifying the validity proof consumes a lot of resources, for example, the current cost on Ethereum is approximately 500,000 Gas.
Pure side chains do not incur the above costs, so the cost of using them is lower. Commit chains or Optimistic side chains may incur some additional costs, such as submitting block headers, but these costs can be negligible. Additionally, costs can be reduced by accumulating multiple block headers in a single transaction.
Finality: Side chains that are fully responsible for their security have instant finality, meaning that once approved by the majority of validators, blocks cannot be reversed. However, this rule does not apply to commit chains or Optimistic side chains, as they have to consider challenges that may delay the finalization of block headers.
In general, Rollup has a longer finality time compared to pure side chains, for various reasons. For example, Optimistic Rollup delays confirming transactions to ensure honest participants have enough time to challenge invalid state updates.
Validity Rollup has instant finality once validated, but its finality time is longer compared to pure side chains. Due to the high cost of generating and verifying validity proofs, sequencers tend to accumulate a large number of transactions before generating and submitting the validity proofs in batches.
Security: The security of Rollup (Optimistic or zero-knowledge) is guaranteed by the underlying blockchain, reducing the trust assumptions of users. As explained earlier, Rollup relies on the (economically secure) main chain for consensus and data availability (unlike side chains). This reduces risks such as audits, freezing withdrawals, and invalid executions.
Pure side chains are responsible for their security. However, it can be difficult to launch diverse and reliable validators, which is why side chains are considered less secure than Rollup.
Commit chains and Optimistic side chains are slightly more secure than pure side chains, but users must trust the data availability of validators and proposers. If data hiding attacks occur without penalties, commit chains and Optimistic side chains will have no security guarantees.
Cross-chain Bridge: Rollup and sidechains (in most cases) use the same asset bridging scheme: lock X tokens in smart contracts on the main chain and mint X tokens for users on the sidechain. The difference lies in how the funds deposited in the bridging contract are secured.
Since Rollup is dedicated to a specific underlying blockchain, there is usually a “specification bridge” connecting the two. The funds deposited in the Rollup bridge are secured by the mother chain:
The funds deposited in Rollup can only be withdrawn after the proofs related to the validation of the batch containing the exit transaction are validated on the chain.
For Optimistic Rollup, users can only withdraw funds after the block containing the user’s withdrawal transaction has not been challenged at the end of the dispute window (about 1-2 weeks).
On the contrary, the security of funds deposited in the sidechain bridge depends on its design. For example, if the sidechain has a specification cross-chain bridge with another blockchain, the security of bridged funds will be related to the honesty of the validators. Another issue is whether the bridge is verified by the entire validator set (e.g., Polygon PoS bridge) or a small group of external validators (e.g., Avalanche-Ethereum bridge).
The difference in finality time between Rollup and sidechain bridging also explains the differences between them. For example, Optimistic Rollup users will experience more delays when bridging funds back to the main chain because they need to wait for the dispute window. With a sidechain, users can withdraw funds from the cross-chain bridge contract as soon as they receive the final confirmed block header (and the necessary valid Merkle proof) if needed.
Choosing between Rollup and Sidechain
When deploying smart contracts, the choice between using Rollup or a sidechain depends on your goals, user feedback, and project requirements. The following are the advantages of using Rollup, sidechain, or both in different scenarios.
When to use Rollup:
Your users want the highest level of security assurance.
Your users can tolerate slightly higher costs and increased delays/finality. Rollup costs much less than Ethereum and is faster (by orders of magnitude), but it cannot match sidechains in these metrics.
You (or your users) want to establish a closer relationship with the mother chain ecosystem (e.g., Ethereum).
You plan to improve the user experience of DApps on Rollup. This may involve using liquidity providers to reduce the delay in withdrawing funds from Optimistic Rollup or implementing code optimizations to reduce the transaction data generated when users interact with your smart contracts.
You want to use EVM tools and infrastructure when building DApps. Most Rollups are EVM-compatible and use the same tools, client software, and node APIs as Ethereum.
When to use Sidechain:
Your users want to transact with the lowest fees.
Your users want fast processing of transactions, especially when bridging funds.
Your users can tolerate increased trust assumptions and lower security guarantees.
You (or your users) do not consider a close relationship with the main chain ecosystem as a top priority.
You are willing to learn and use a new set of programming languages, tools, and infrastructure to build DApps (if using a non-EVM sidechain).
When to Use Sidechains and Rollups Simultaneously:
Your project has established a strong network effect on one blockchain and is ready to expand into multiple ecosystems simultaneously (e.g., to leverage liquidity).
You want to cater to different types of users and avoid alienating one side of the market.
Your project has enough resources to handle cross-chain scalability. This may mean having different teams responsible for deploying your DApp on different blockchain platforms.
- Is the hype around AI Agents that Silicon Valley giants are talking about real or just a bubble?
- Be vigilant of the hidden rug pull caused by contract storage leading to a run-off.
- Variant Partner Why is UniswapX said to be a boost for Uniswap?
- Another case of flash loan attack Analysis of the LianGuailmswap security incident
- Why is Musk’s Twitter reform said to have a profound impact on cryptocurrencies?
- Google Play Store announces new rules allowing games and apps to offer NFTs.
- The Struggle between Ripple and SEC What Will Happen Next? Experts Evaluate Four Possible Outcomes.