WUJS

I'm here

10 Dec 2023

Off-Chain Scaling of Blockchains

Early blockchain protocols, such as Bitcoin and Ethereum, were designed with a monolithic architecture. In this model, a single protocol layer is responsible for handling all network functions: execution, settlement, data availability, and consensus. A direct consequence of this design is that every full node in the network must operate as a replicated state machine, independently processing every transaction and storing the entire system state.

This model of global replication is necessary to ensure decentralization and trustlessness, but it also creates inherent performance limitations. The overall throughput of the network is constrained by the processing capacity of a single node. To enable ordinary individuals to run nodes and thus maintain the network’s decentralized character, the hardware and bandwidth requirements must be kept low. This forces the protocol to strictly limit its resource supply, primarily in three areas:

  1. Computational Resources: The capacity to execute smart contract operations is limited.
  2. Storage Resources: The cost of permanently storing state on-chain is high.
  3. Bandwidth Resources: Broadcasting and validating transaction data consumes network bandwidth.

When user demand for these scarce resources exceeds the network’s capacity, a competitive fee market forms, leading to increased transaction fees (Gas Fees) and longer confirmation times. This not only impacts user experience but also restricts the deployment of many applications that require frequent interactions.

Different Scaling Approaches

To address these bottlenecks, the industry has explored two distinct paths for scaling.

The first is on-chain scaling, which involves modifying the base protocol (Layer 1) to increase its native capacity. Examples include upgrading the consensus mechanism (such as Ethereum’s transition from Proof-of-Work to Proof-of-Stake) or implementing sharding. While these solutions can fundamentally improve the network’s processing power, they are often slow to implement, technically complex, and require broad community consensus.

The second approach, and the focus of this article, is off-chain scaling (Layer 2). It takes a different approach by decoupling functions. Instead of altering the base protocol, it constructs a separate execution layer on top of it. The majority of transaction computation is moved to this off-chain layer, while Layer 1 is used primarily for security guarantees, dispute arbitration, and final settlement. This allows for faster iteration and more flexible architectural designs.

Paradigms

Off-chain scaling is not a single technology but a collection of different architectural designs, each making distinct trade-offs between security, cost, and performance.

Rollups

Rollups are the most widely adopted off-chain scaling solutions today. Their mechanism involves executing transactions off-chain and then posting the transaction data in a compressed format back to Layer 1. By doing so, rollups leverage the data availability of Layer 1 to ensure their own security. Anyone can verify the state of the L2 using the data published on L1, and users can safely withdraw their assets even if the L2 operator becomes malicious or goes offline.

  1. Optimistic Rollups This solution operates on a “presumption of innocence” model. It assumes that transaction batches submitted to L1 by the operator are valid by default and initiates a “dispute resolution period” (typically seven days). During this window, any observer (a verifier) can examine the data on L1 and, upon finding an invalid state transition, submit a “fraud proof” to challenge the operator. If the challenge is successful, the invalid batch is rolled back, and the malicious operator is economically penalized. The advantage of this mechanism is its relative technical simplicity and good compatibility with the Ethereum Virtual Machine (EVM). The trade-off is that users must wait for the dispute resolution period to end before they can withdraw assets from L2 back to L1. Arbitrum and Optimism are prominent examples of this approach.
  2. Zero-Knowledge Rollups (ZK-Rollups) This solution operates on a “validity proof” model. For every batch of transactions submitted to L1, the operator must include a cryptographic proof (such as a ZK-SNARK or ZK-STARK). This proof mathematically guarantees that the execution result of the batch is correct without requiring L1 to re-execute the transactions. The smart contract on L1 only needs to verify the validity of this proof. Since its security is guaranteed by cryptography rather than an economic game, ZK-Rollups do not require a long dispute resolution period, allowing users to quickly withdraw their assets back to L1. The challenges lie in the computational overhead of generating zero-knowledge proofs and the technical difficulty of achieving full EVM compatibility. zkSync and StarkNet are representative projects in this category.

State Channels

State channels are suited for scenarios with a fixed set of participants and frequent interactions. The process is as follows: multiple participants first lock funds in a smart contract on L1 to “open” a channel. Afterward, they can conduct an unlimited number of instant transactions off-chain, which are merely signed state updates exchanged between them. The cost is nearly zero. When they decide to conclude their interactions, they submit the final, mutually agreed-upon state back to L1 for settlement to “close” the channel. The Lightning Network on Bitcoin is the most well-known application of state channels. This solution is highly efficient but lacks generality and is not suitable for open, multi-party interactions.

Sidechains

A sidechain is an independent blockchain with its own consensus mechanism, validators, and block parameters. It is connected to the mainchain (L1) via a “two-way bridge,” allowing assets to be transferred between them. The key characteristic of a sidechain is that it does not inherit the security of L1. Its security depends entirely on its own validator set and consensus algorithm. If the sidechain’s validator network is compromised, users’ assets on the sidechain could be at risk, but this would not affect the security of the L1 mainchain. The advantage of sidechains is their high degree of flexibility and performance, enabling the creation of execution environments completely different from the mainchain. Polygon PoS is a widely used sidechain.

Validium

Validium can be viewed as a hybrid architecture of a ZK-Rollup and a sidechain. Like a ZK-Rollup, it uses validity proofs to guarantee the correctness of off-chain computations and submits these proofs to L1. However, unlike a rollup, Validium does not post transaction data to L1. Instead, the data is stored off-chain, managed by an entity such as a Data Availability Committee (DAC). This design avoids the cost associated with storing data on L1, thereby achieving higher throughput and lower transaction fees. The trade-off is the introduction of a new trust assumption: users must trust the Data Availability Committee not to withhold data, as doing so could result in their assets being frozen.

Trade-Offs

Different off-chain scaling solutions represent different engineering choices between security, performance, and cost. We can compare them across several dimensions:

Feature Optimistic Rollup ZK-Rollup State Channel Sidechain Validium
State Transition Integrity Secured by L1 via fraud proofs Secured by L1 via validity proofs Enforced by L1 contract at settlement Secured by sidechain’s own consensus Secured by L1 via validity proofs
Data Availability Data is available on L1 Data is available on L1 Data is private to participants Data is available on the sidechain Data is available off-chain, reliant on DAC
Trust Assumptions At least one honest verifier Relies on cryptography and L1 Counterparty responds during disputes Trust in the sidechain’s validator set Trust in the DAC not to withhold data
Withdrawal Time to L1 ~7 days A few minutes Channel closing time Depends on bridge design A few minutes
Use Case Suitability General-purpose smart contract platforms General-purpose smart contract platforms High-frequency interactions between specific parties Independent ecosystems, enterprise applications Cost-sensitive, high-frequency applications

For developers, the choice of solution depends on the specific requirements of their application. Decentralized Finance (DeFi) applications requiring high security guarantees tend to favor Rollups. Gaming or trading applications that need instant finality and high throughput might be better suited for ZK-Rollups or Validiums. Projects that require a high degree of customization or independent governance models might opt for a sidechain.