πRollups
Understanding the Layer 2 Landscape:
Plasma and State Channels - Full Layer 2 Schemes: Plasma and state channels attempt to move both data and computation offchain. However, they face fundamental game theory challenges related to data availability, making it difficult to safely support all applications. They rely on an explicit notion of asset ownership, which limits their generality.
Rollups - A Hybrid Approach: Rollups represent a hybrid Layer 2 scheme. They move computation and state storage offchain but retain some data for each transaction on Layer 1 (Ethereum). This approach balances offchain efficiency with onchain data integrity.
Scenario π
Let's consider a crowdfunding platform that leverages Rollups to efficiently manage and secure its transactions. This platform allows entrepreneurs to pitch their projects and receive funding from backers. Here's how Rollups are utilized in this scenario:
Setting Up the Rollup:
Smart Contract with State Rootππ³: The platform operates on a smart contract on the Ethereum blockchain. This contract maintains a state root, which is the Merkle root of the state of the rollup, encompassing account balances, project details, funding amounts, and other relevant data within the rollup.
Publishing BatchesποΈ: Entrepreneurs post their projects, and backers fund them. These activities generate numerous transactions. Periodically, a batch of these transactions is compiled in a highly compressed form. Each batch includes the previous state root and a new state root, which reflects the state after processing these transactions.
Contract Verificationβ : When a batch is submitted to the blockchain, the smart contract verifies that the previous state root in the batch matches its current state root. If the match is confirmed, the contract updates the state root to the new state root.
Deposits and Withdrawals:
Depositing Funds: When backers want to fund a project, they can deposit their funds into the rollup. These transactions have inputs from outside the rollup state. The transaction submitting the batch must transfer these assets to the rollup contract.
Withdrawing Funds: If a project reaches its funding goal and the entrepreneur withdraws the funds, or if a backer withdraws their pledge, these transactions have outputs to the outside. Upon processing the batch, the smart contract initiates these withdrawals.
Ensuring Integrity of State Updates:
The key challenge is ensuring that the post-state roots in the batches are correct. If someone could submit a batch with any post-state root without consequences, they could, for instance, illegitimately redirect funds. To prevent this, the rollup uses one of two main solutions:
Optimistic Rollups
Zero-Knowledge Rollups
Upsides
Improved Scalability and Efficiency ποΈ: Rollups employ advanced compression methods to minimize the onchain data footprint. By replacing data with computation wherever possible, they significantly improve efficiency.
Cost-Effective Transactions π: By using advanced compression techniques, Rollups reduce the on-chain data footprint, leading to lower gas costs. For instance, an ERC20 token transfer in a rollup can cost under 300 gas, compared to about 45,000 gas on the Ethereum base layer.
Downsides
Hardware and Cost Requirements for ZK-Rollups:
π» Hardware Intensity: Generating zero-knowledge proofs, a key component of ZK-Rollups, requires significant computational power, which can be hardware-intensive.
πΈ Cost Implications: This hardware requirement can translate into higher costs, potentially making ZK-Rollups a less accessible option for some users or developers, especially those with limited resources.
Withdrawal Delays in Optimistic Rollups:
β³ Challenge Period Delays: Optimistic Rollups include a challenge period to ensure transaction integrity. This period can lead to delays in withdrawing funds.
π Not Ideal for Time-Sensitive Transactions: Such delays might be a drawback for transactions where time is of the essence, as immediate access to funds is not guaranteed.
Data Bandwidth Limitations:
π Underlying Blockchain Constraints: While Rollups significantly improve scalability, they are still bound by the data bandwidth limitations of the underlying blockchain (e.g., Ethereum).
π§ Scalability Ceiling: This means that despite their efficiency, Rollups cannot achieve infinite scalability and are subject to the performance constraints of the base layer.
Complexity in Implementation:
π§ Technical Complexity: Implementing Rollups, particularly ZK-Rollups, involves advanced cryptographic techniques, which adds a layer of complexity.
π οΈ Development Challenges: This complexity can pose challenges for developers, requiring specialized knowledge and skills in cryptography and blockchain technology.
Optimal For π―
Toggle to see what these applications could be
Sources and Extra Material
If you are just interested in knowing which one from Optimistic and Zero Knowledge Rollups would be your problem-solution fit for your project go straight to Transaction Costs page to see their comparison and outlook.
Last updated