第2课

State Channels, Sidechains, Rollups, and Plasma

State Channels are a Layer 2 scaling solution that allows for secure and efficient off-chain transactions between a limited number of participants, typically two. Payment channels, such as the Lightning Network for Bitcoin, are popular examples of State Channels designed specifically for money exchange.

State Channels

Concept and Functionality

State Channels are a Layer 2 scaling solution that allows for secure and efficient off-chain transactions between a limited number of participants, typically two. Payment channels, such as the Lightning Network for Bitcoin, are popular examples of State Channels designed specifically for money exchange.

Read More: What Is the Bitcoin Lightning Network?

In a State Channel, participants first deposit a certain amount of cryptocurrency on-chain, creating a multi-signature wallet outside of the blockchain. As long as their balances remain non-negative, they can transact directly with each other without involving miners or the main chain, sending state updates in the form of [turn_number, amount, signature].

When participants wish to close the channel, they perform an “exit” by submitting the last state update to the main chain, which validates the update and transfers the final balances back to the parties. To ensure security and prevent fraudulent exits, there is a challenge period during which the other participant can present a state update with a higher turn_number, effectively challenging the initial exit. Watchtowers can be employed to monitor the main chain for such attempts.

State Channels can be applied to other types of state transitions, such as gaming or smart contract execution, as long as the main chain can validate their correctness. They offer immediate finality, low fees, and relatively simple construction, making them suitable for various use cases like payments and gaming.

Use Cases and Examples

State Channels have been widely adopted for several use cases, primarily due to their instant finality, low fees, and efficient off-chain transactions. Some of these use cases include:

  • Payments: Payment channels, like Bitcoin’s Lightning Network, are popular Layer 2 solutions that enable fast and secure off-chain transactions for exchanging money.
  • Gaming: State channels can facilitate secure off-chain gaming experiences, where players can submit their moves as transactions to each other without interacting with the main chain.
  • Smart Contracts: State channels can also be used for executing smart contracts off-chain, reducing the load on the main chain while maintaining the desired level of security and efficiency.
    Despite their numerous advantages, the secure implementation of State Channels can be a complex undertaking, necessitating meticulous attention to potential edge cases and vulnerabilities.

Sidechains

Concept and Functionality

Side chains are a form of scaling solution for blockchain networks, operating independently alongside the main chain to improve its performance. They have their own validators and operators, as well as bridges that allow assets to be transferred between the main and side chains. Side chains can also snapshot block headers to the main chain to prevent forks.

To move assets from the main chain to a side chain, participants lock their assets on the main chain and provide proof of the lock on the side chain. To unlock the assets on the main chain, they initiate an exit on the side chain and provide proof of the exit once it’s included in a side chain block.

Despite leveraging the security of the main chain to prevent forks, side chains are vulnerable to invalid state transition attacks, in which colluding validators create invalid blocks and steal funds from other participants. Most side chains are designed with the assumption that the vast majority of validators will remain uncorrupted.

Use Cases and Examples

Side chains are employed to improve the scalability and efficiency of the main chain, and they can be utilized in various scenarios, such as:

  • Offloading main chain transactions: Side chains can handle a portion of the main chain’s transactions, reducing the overall load on the main chain and improving its performance.
  • Implementing experimental features: Side chains can serve as a testing ground for new features and improvements without affecting the main chain’s stability.
  • Customizable blockchain applications: Side chains can be tailored to specific use cases or industries, enabling customized blockchain applications without overloading the main chain.
    Although side chains are a form of scaling solution for blockchain networks, they are not considered a Layer 2 (L2) scaling solution, which is a specific type of scaling solution that operates on top of the main chain.

Despite their potential security risks, side chains remain an essential part of the blockchain ecosystem, enhancing the scalability and flexibility of the main chains.

Rollups (Optimistic and ZK-Rollups)

Concept and Functionality

Rollups are a Layer 2 scaling solution that combines or “rolls up” multiple transactions into a single proof before submitting it to the main chain. They are available in two type: Optimistic Rollups and ZK-Rollups. Both types of rollups increase transaction throughput and reduce gas costs, but they differ in their approach to validation and security.

Optimistic Rollups

Optimistic Rollups rely on a system of “optimistic” assumptions, where transactions are presumed valid until proven otherwise. They use a dispute resolution mechanism called “fraud proof” that allows users to challenge invalid transactions. If a transaction is found to be invalid, the rollup is reverted, and the challenger is rewarded.

ZK-Rollups

ZK-Rollups, on the other hand, use zero-knowledge proofs (zk-SNARKs) to provide cryptographic assurance of the validity of transactions before they are submitted to the main chain. This eliminates the need for a dispute resolution mechanism, as invalid transactions can not be included in the rollup.

Use Cases and Examples

Rollups are one of the most promising Layer 2 scaling solutions today due to their security and efficiency properties. Some benefits and use cases of rollups include:

  • Improved data availability: Rollups ensure data is not withheld by requiring the full block or state to be passed as an argument when snapshotting a block.
  • State transition validation: Rollups provide a zk-SNARK (for ZK-Rollups) or a fraud proof (for Optimistic Rollups) to attest to the correctness of state transitions, preventing invalid blocks from being created.
  • No forks: The fork choice rule in rollups always prefers the chain containing the last snapshotted block, preventing the creation of forks.
  • Reduced gas costs: Rollups significantly reduce the gas cost of on-chain verification, making them more efficient than on-chain transactions.
  • Instantaneous exits: If rollup operators cooperate, exits can be executed instantly without the need for an exit game.

Examples of Rollup Implementations

Optimism is a popular Optimistic Rollup implementation on the Ethereum network designed to scale smart contracts and decentralized applications (dApps).

zkSync is a ZK-Rollup solution for Ethereum that focuses on providing low-cost, fast, and secure token transfers.

Plasma

Concept and Functionality

In 2017, Joseph Poon and Vitalik Buterin first proposed Plasma as a Layer 2 scaling solution. It creates a tree of child chains rooted in the main chain, with each child chain functioning as a separate blockchain that can handle transactions independently. This offloads processing from the main chain, increasing overall throughput. Assets can be transferred between the main chain and child chains through a system of smart contracts.

Plasma chains rely on a combination of Merkle trees and fraud proofs to ensure the security and integrity of off-chain transactions. Plasma designs can be classified into several types, such as Minimum Viable Plasma (MVP), Plasma Cash, Plasma Debit, and More Viable Plasma (MoreVP). Each type offers different trade-offs in terms of security, efficiency, and usability, catering to specific use cases and application requirements.

Advantages of Plasma

  • Scalability: Plasma chains can handle a large number of transactions independently from the main chain, greatly increasing overall throughput.
  • Lower transaction fees: Offloading transactions to Plasma chains can reduce the fees associated with on-chain transactions.
  • Customizability: Each Plasma chain can have its own consensus mechanism and rules, allowing for tailored solutions to specific use cases.
  • Security: Plasma chains inherit the security of the main chain while using fraud proofs to ensure the integrity of off-chain transactions.

Use Cases and Examples

Plasma offers several benefits, making it suitable for various use cases:

  • Decentralized Exchanges (DEXs): Plasma can be used to create high-throughput, low-latency decentralized exchanges without congesting the main chain.
  • Gaming and NFTs: Plasma chains can support scalable and efficient gaming platforms and Non-Fungible Token (NFT) marketplaces.
  • IoT and supply chain: Plasma can enable real-time data processing and asset tracking in complex supply chain ecosystems.
    Examples of Plasma implementations
  • OMG Network (formerly OmiseGo): A Plasma-based Ethereum scaling solution focused on enabling fast, low-cost token transfers and decentralized exchange functionality.
  • Matic Network (now Polygon): A Plasma-based sidechain for Ethereum that provides a platform for creating scalable and efficient dApps. Polygon has since evolved into a multi-chain scaling solution that also supports other Layer 2 techniques, such as ZK-Rollups and Optimistic Rollups.
免责声明
* 投资有风险,入市须谨慎。本课程不作为投资理财建议。
* 本课程由入驻Gate Learn的作者创作,观点仅代表作者本人,绝不代表Gate Learn赞同其观点或证实其描述。
目录
第2课

State Channels, Sidechains, Rollups, and Plasma

State Channels are a Layer 2 scaling solution that allows for secure and efficient off-chain transactions between a limited number of participants, typically two. Payment channels, such as the Lightning Network for Bitcoin, are popular examples of State Channels designed specifically for money exchange.

State Channels

Concept and Functionality

State Channels are a Layer 2 scaling solution that allows for secure and efficient off-chain transactions between a limited number of participants, typically two. Payment channels, such as the Lightning Network for Bitcoin, are popular examples of State Channels designed specifically for money exchange.

Read More: What Is the Bitcoin Lightning Network?

In a State Channel, participants first deposit a certain amount of cryptocurrency on-chain, creating a multi-signature wallet outside of the blockchain. As long as their balances remain non-negative, they can transact directly with each other without involving miners or the main chain, sending state updates in the form of [turn_number, amount, signature].

When participants wish to close the channel, they perform an “exit” by submitting the last state update to the main chain, which validates the update and transfers the final balances back to the parties. To ensure security and prevent fraudulent exits, there is a challenge period during which the other participant can present a state update with a higher turn_number, effectively challenging the initial exit. Watchtowers can be employed to monitor the main chain for such attempts.

State Channels can be applied to other types of state transitions, such as gaming or smart contract execution, as long as the main chain can validate their correctness. They offer immediate finality, low fees, and relatively simple construction, making them suitable for various use cases like payments and gaming.

Use Cases and Examples

State Channels have been widely adopted for several use cases, primarily due to their instant finality, low fees, and efficient off-chain transactions. Some of these use cases include:

  • Payments: Payment channels, like Bitcoin’s Lightning Network, are popular Layer 2 solutions that enable fast and secure off-chain transactions for exchanging money.
  • Gaming: State channels can facilitate secure off-chain gaming experiences, where players can submit their moves as transactions to each other without interacting with the main chain.
  • Smart Contracts: State channels can also be used for executing smart contracts off-chain, reducing the load on the main chain while maintaining the desired level of security and efficiency.
    Despite their numerous advantages, the secure implementation of State Channels can be a complex undertaking, necessitating meticulous attention to potential edge cases and vulnerabilities.

Sidechains

Concept and Functionality

Side chains are a form of scaling solution for blockchain networks, operating independently alongside the main chain to improve its performance. They have their own validators and operators, as well as bridges that allow assets to be transferred between the main and side chains. Side chains can also snapshot block headers to the main chain to prevent forks.

To move assets from the main chain to a side chain, participants lock their assets on the main chain and provide proof of the lock on the side chain. To unlock the assets on the main chain, they initiate an exit on the side chain and provide proof of the exit once it’s included in a side chain block.

Despite leveraging the security of the main chain to prevent forks, side chains are vulnerable to invalid state transition attacks, in which colluding validators create invalid blocks and steal funds from other participants. Most side chains are designed with the assumption that the vast majority of validators will remain uncorrupted.

Use Cases and Examples

Side chains are employed to improve the scalability and efficiency of the main chain, and they can be utilized in various scenarios, such as:

  • Offloading main chain transactions: Side chains can handle a portion of the main chain’s transactions, reducing the overall load on the main chain and improving its performance.
  • Implementing experimental features: Side chains can serve as a testing ground for new features and improvements without affecting the main chain’s stability.
  • Customizable blockchain applications: Side chains can be tailored to specific use cases or industries, enabling customized blockchain applications without overloading the main chain.
    Although side chains are a form of scaling solution for blockchain networks, they are not considered a Layer 2 (L2) scaling solution, which is a specific type of scaling solution that operates on top of the main chain.

Despite their potential security risks, side chains remain an essential part of the blockchain ecosystem, enhancing the scalability and flexibility of the main chains.

Rollups (Optimistic and ZK-Rollups)

Concept and Functionality

Rollups are a Layer 2 scaling solution that combines or “rolls up” multiple transactions into a single proof before submitting it to the main chain. They are available in two type: Optimistic Rollups and ZK-Rollups. Both types of rollups increase transaction throughput and reduce gas costs, but they differ in their approach to validation and security.

Optimistic Rollups

Optimistic Rollups rely on a system of “optimistic” assumptions, where transactions are presumed valid until proven otherwise. They use a dispute resolution mechanism called “fraud proof” that allows users to challenge invalid transactions. If a transaction is found to be invalid, the rollup is reverted, and the challenger is rewarded.

ZK-Rollups

ZK-Rollups, on the other hand, use zero-knowledge proofs (zk-SNARKs) to provide cryptographic assurance of the validity of transactions before they are submitted to the main chain. This eliminates the need for a dispute resolution mechanism, as invalid transactions can not be included in the rollup.

Use Cases and Examples

Rollups are one of the most promising Layer 2 scaling solutions today due to their security and efficiency properties. Some benefits and use cases of rollups include:

  • Improved data availability: Rollups ensure data is not withheld by requiring the full block or state to be passed as an argument when snapshotting a block.
  • State transition validation: Rollups provide a zk-SNARK (for ZK-Rollups) or a fraud proof (for Optimistic Rollups) to attest to the correctness of state transitions, preventing invalid blocks from being created.
  • No forks: The fork choice rule in rollups always prefers the chain containing the last snapshotted block, preventing the creation of forks.
  • Reduced gas costs: Rollups significantly reduce the gas cost of on-chain verification, making them more efficient than on-chain transactions.
  • Instantaneous exits: If rollup operators cooperate, exits can be executed instantly without the need for an exit game.

Examples of Rollup Implementations

Optimism is a popular Optimistic Rollup implementation on the Ethereum network designed to scale smart contracts and decentralized applications (dApps).

zkSync is a ZK-Rollup solution for Ethereum that focuses on providing low-cost, fast, and secure token transfers.

Plasma

Concept and Functionality

In 2017, Joseph Poon and Vitalik Buterin first proposed Plasma as a Layer 2 scaling solution. It creates a tree of child chains rooted in the main chain, with each child chain functioning as a separate blockchain that can handle transactions independently. This offloads processing from the main chain, increasing overall throughput. Assets can be transferred between the main chain and child chains through a system of smart contracts.

Plasma chains rely on a combination of Merkle trees and fraud proofs to ensure the security and integrity of off-chain transactions. Plasma designs can be classified into several types, such as Minimum Viable Plasma (MVP), Plasma Cash, Plasma Debit, and More Viable Plasma (MoreVP). Each type offers different trade-offs in terms of security, efficiency, and usability, catering to specific use cases and application requirements.

Advantages of Plasma

  • Scalability: Plasma chains can handle a large number of transactions independently from the main chain, greatly increasing overall throughput.
  • Lower transaction fees: Offloading transactions to Plasma chains can reduce the fees associated with on-chain transactions.
  • Customizability: Each Plasma chain can have its own consensus mechanism and rules, allowing for tailored solutions to specific use cases.
  • Security: Plasma chains inherit the security of the main chain while using fraud proofs to ensure the integrity of off-chain transactions.

Use Cases and Examples

Plasma offers several benefits, making it suitable for various use cases:

  • Decentralized Exchanges (DEXs): Plasma can be used to create high-throughput, low-latency decentralized exchanges without congesting the main chain.
  • Gaming and NFTs: Plasma chains can support scalable and efficient gaming platforms and Non-Fungible Token (NFT) marketplaces.
  • IoT and supply chain: Plasma can enable real-time data processing and asset tracking in complex supply chain ecosystems.
    Examples of Plasma implementations
  • OMG Network (formerly OmiseGo): A Plasma-based Ethereum scaling solution focused on enabling fast, low-cost token transfers and decentralized exchange functionality.
  • Matic Network (now Polygon): A Plasma-based sidechain for Ethereum that provides a platform for creating scalable and efficient dApps. Polygon has since evolved into a multi-chain scaling solution that also supports other Layer 2 techniques, such as ZK-Rollups and Optimistic Rollups.
免责声明
* 投资有风险,入市须谨慎。本课程不作为投资理财建议。
* 本课程由入驻Gate Learn的作者创作,观点仅代表作者本人,绝不代表Gate Learn赞同其观点或证实其描述。