Exploring Sidechains and Rollups Differences and Similarities in Architecture, Security Assurance, and Scalability PerformanceComparison of Sidechains and Rollups Architecture, Security, and Scalability
Original Text: “Sidechains vs. Rollups: Breaking down the differences for dapp development” by Emmanuel Awosika
Translation: Deep Tide TechFlow
Sidechains and Rollups are two solutions to address the scalability issue in blockchain. The core idea of these two solutions is to move computations from resource-constrained blockchains (such as Ethereum) to independent blockchains designed for scalability optimization. This approach brings several benefits, such as reducing transaction costs, decreasing latency, and improving overall throughput. However, the similarities end there.
Sidechains and Rollups fundamentally differ in their scaling approaches and also have differences in design decisions and trade-offs. It is crucial for developers who want to build scalable dapps using these two solutions to understand their differences.
- How to understand the playability of blockchain games?
- Wall Street banks will establish their own blockchain and cross-chain stablecoin.
- Blockchain-based lending AAVE protocol simplifies DeFi
This article provides an overview of Rollups and Sidechains and explores their differences in terms of architecture, security guarantees, scalability performance, and more.
What are Sidechains?
Sidechains are blockchain networks that run in parallel with another blockchain called the “main chain.” Typically, sidechains are connected to the main chain through a bidirectional cross-chain bridge, allowing for the transfer of assets and possible arbitrary data between the two networks, such as contract states, Merkle proofs, and specific transaction results.
Most sidechains have their own consensus mechanisms and validators, separate from the main chain. This enables sidechains to settle and finalize 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 utilize a custom implementation of the Ethereum Virtual Machine (EVM), which is the execution environment for deploying smart contracts on Ethereum. In practice, most of these blockchains were originally forked from go-ethereum (also known as Geth, the most popular implementation of the Ethereum protocol).
While preserving many of Ethereum’s design features, such as support for smart contracts, EVM-compatible sidechains optimize other aspects, particularly consensus mechanisms, to improve execution efficiency and throughput. Nowadays, 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 like Truffle, Remix, or Hardhat and may need to learn other languages like 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 encrypted commitments (such as block headers) to another blockchain to update its 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 question invalid block headers before confirmation.
Typically, this is accomplished by implementing a smart contract on the main chain that handles rewards, staking, rotation, and penalties for sidechain validators. If a validator commits a provable violation (such as signing two blocks at the same height), anyone can submit evidence to the smart contract and reduce the validator’s stake.
The operation of optimistic chains is similar, requiring validators to periodically submit block headers to a smart contract on the main chain. However, optimistic chains do not have a separate consensus mechanism – the block headers are simply assumed to be valid until challenged with anti-fraud. Therefore, optimistic chains can operate with only 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 still have some security guarantees.
However, it is important to note that honest participants cannot prove malicious behavior without accessing the state data stored in the blocks. However, since the main chain only receives block headers from the sidechain (not the block bodies), it cannot guarantee the availability of the blocks. This allows dishonest block proposers to engage in dishonest behavior by hiding block data, such as stealing funds from cross-chain bridges.
This issue is known as the data availability problem and is at the core of the security properties differences of all sidechains (not just commit chains, optimistic chains, and rollups).
What is a Rollup?
Rollups improve the scalability of underlying blockchains 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 improve user speed and cost-effectiveness.
However, Rollups periodically submit blocks to the main chain, inheriting the security and decentralization characteristics of the main chain. 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 extract funds when Rollup validators hide transaction data.
- Validity: Only Rollup blocks that satisfy the validity conditions enforced by the parent chain can be eventually 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 the on-chain smart contract of the Rollup.
Types of Rollup
There are two types of Rollup: Optimistic Rollup and Zero-Knowledge Rollup. 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 the chain, the block will be finalized on the underlying layer.
Optimistic Rollup submits blocks without any proof to prove the validity of off-chain computations. Unless the other 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 both parties dispute a computation under 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 a 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 Rollup 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-intensive nature of proving native EVM instructions in the proof circuit, 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 “Zero-Knowledge EVM” (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 complete 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 in the StarkNet virtual machine.
How are Sidechains different from Rollup?
Throughput: Sidechains typically have higher average transaction processing capacity than Rollup because they are not dependent on the main chain’s consensus and data availability. For example, sidechains can achieve larger block sizes and extremely fast block times to achieve higher throughput, which Rollup cannot achieve.
Rollup must avoid processing too many transactions to the point where transaction batches cannot fit into a single main chain block. Otherwise, this would reintroduce congestion to the underlying layer and make it difficult to keep up with the blocks generated by the Rollup. Therefore, Rollup’s mother chain data bandwidth imposes an effective limit on its throughput.
Even for sidechains that partially rely on the security of the main chain (such as commit chains and Optimistic chains), their throughput is still better than Rollup.
Cost: Compared to Rollup, users may pay less fees for transactions on sidechains. Like other differences between sidechains and Rollup, this point is related to Rollup relying on the settlement and finality of the parent chain. Here are some operating 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 blocks) 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 validity proofs consumes a lot of resources, such as the current cost of about 500,000 Gas on Ethereum.
Pure sidechains do not incur the above costs, so the cost of using them is lower. Commit chains or Optimistic sidechains 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: Sidechains that are fully responsible for their security have instant finality, meaning blocks cannot be reversed once they are approved by the majority of validators. However, commit chains or Optimistic sidechains do not follow this rule 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 sidechains, and the reasons vary. 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 sidechains. Due to the high cost of generating and verifying validity proofs, sequencers tend to accumulate a large number of transactions before generating and submitting batches of validity proofs.
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 sidechains). This reduces risks such as audits, freezing of withdrawals, and invalid executions.
Pure sidechains are responsible for their own security. However, it can be difficult to launch diverse and reliable validators, which is why sidechains are considered less secure than Rollup.
Commit chains and Optimistic sidechains are slightly more secure than pure sidechains, but users must trust the data availability of validators and proposers. If data hiding attacks are carried out without incurring penalties, commit chains and Optimistic sidechains will have no security guarantees.
Cross-Chain Bridges: Rollups 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 subchain. The difference lies in how the funds deposited in the bridging contracts are secured.
Since Rollups are dedicated to specific underlying blockchain layers, there is usually a “speculative bridge” connecting the two. The funds deposited in the Rollup bridge are secured by the mother chain:
- The funds deposited in the Rollup bridge can only be withdrawn after the proofs related to the verification and inclusion of the exit transactions in the batches are verified on-chain.
- For Optimistic Rollup, users can only withdraw funds after the block containing the user’s withdrawal transaction has not been challenged after the dispute window (about 1-2 weeks) ends.
On the other hand, the security of funds deposited in sidechain bridges depends on their design. For example, if a sidechain has a speculative cross-chain bridge with another blockchain, the security of bridged funds is related to the honesty of the validators. Another issue is whether the bridge is validated by the entire set of validators (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 bridges also explains the difference 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 sidechains, once the final confirmed block header (and, if necessary, a valid Merkle proof) is received, users can withdraw funds from the cross-chain bridge contract.
Choosing Between Rollups and Sidechains
When deploying smart contracts, the choice between using Rollups or sidechains depends on your goals, user feedback, and project requirements. Here are the advantages of using Rollups, sidechains, or both in different scenarios.
When to use Rollups:
- Your users want the highest level of security guarantee.
- Your users can tolerate slightly higher costs and increased delays/finality. Rollups are much cheaper than Ethereum and faster (by orders of magnitude), but they 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 DApp users on Rollups. This may mean using liquidity providers to reduce delays in withdrawing funds from Optimistic Rollup or implementing code optimizations to reduce 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 sidechains:
- Your users want to transact with the lowest fees.
- Your users want fast processing, 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 together:
- Your project has established a strong network effect on one blockchain and is ready to scale to 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.
- Blockchain Capital Why did we lead the $40 million financing for ZK infrastructure company RISC Zero?
- The daily transaction volume has exceeded 20 million. Is the blockchain game Sui 8192 really that fun?
- Launching a coin without financing in blockchain entrepreneurship, pay attention to these three points
- Who is Arkham? A free Nansen exploring tokenized business models.
- CZ Binance’s Six-Year Anniversary Handwritten Letter Defending the Right Thing, Even if It Means Going to Court
- Millions of fans internet celebrity’s “textbook-like rights protection” after being falsely accused of pornography. Can blockchain solve the problem of online violence?
- Full text: US announces first criminal case involving attack on DEX smart contract.