Gate Alpha 2nd Points Carnival Round 4 Hot Launch! Trade to Share $30,000 MORE & Alpha Points
Trade $MORE to unlock Listing Airdrops + $300K Points Prize Pool!
💰 Total Airdrop Volume: $30,000 MORE, Limited slots—first come, first served!
✅ Total Points: 2 Alpha Points per trade—accumulate points to share the $300K prize pool!
🔥Trade the Hottest On-Chain Assets First
For more information: https://www.gate.com/campaigns/1342alpha?pid=X&c=MemeBox&ch=vxDB0fQ5
Off-chain scaling solution analysis: A comparison of the technical principles and applications of State Channels and Sidechains.
Off-chain Scalability Depth Analysis
1. The Necessity of Scalability
The future vision of blockchain is to achieve decentralization, security, and scalability, but it often can only satisfy two of these at the same time, which is known as the impossible triangle problem of blockchain. For many years, people have been exploring how to improve the throughput and transaction speed of blockchain while ensuring decentralization and security, that is, to solve the scalability issue, which is one of the hot topics in the current development process of blockchain.
The decentralization, security, and scalability of blockchain can be roughly defined as:
The first major hard fork of the Bitcoin network originated from the scalability issue. As the number of users and transaction volume increased, the Bitcoin network faced congestion due to the 1MB block limit. Starting in 2015, the Bitcoin community experienced disagreements over the scalability issue, ultimately leading to the first major hard fork in Bitcoin's history on August 1, 2017, which resulted in the creation of the new currency BCH.
Similarly, the Ethereum network also chooses to sacrifice a portion of scalability to ensure security and decentralization. Although Ethereum does not directly limit the block size, it sets a cap on the gas fees for individual blocks, but the aim is to achieve trustless consensus and ensure broad distribution of nodes.
From the emergence of CryptoKitties in 2017 to the rise of applications such as DeFi, GameFi, and NFTs, the market's demand for throughput has been continuously increasing. However, even Ethereum, which is Turing-complete, can only process 15-45 transactions per second, leading to increased transaction costs and longer settlement times, making it difficult for most DApps to bear the operating costs, resulting in the entire network becoming slow and expensive. Therefore, the problem of blockchain scalability urgently needs to be addressed. The ideal scalability solution is to maximize transaction speed and throughput without sacrificing decentralization and security.
2. Types of Scaling Solutions
We can categorize the scaling solutions into two main types: on-chain scaling and off-chain scaling, based on the criterion of "whether to change a layer of the mainnet."
2.1 on-chain scaling
Core concept: A solution to achieve scalability by changing a layer of the mainnet protocol, with the current main solution being sharding.
There are various solutions for on-chain scalability; this article will not elaborate on them but will briefly list two:
Plan One is to expand the block space, which means increasing the number of transactions packed into each block, but this will raise the requirements for high-performance node devices, increase the threshold for nodes to join, and reduce the degree of decentralization.
Option two is sharding, which divides the blockchain ledger into several parts, with different shards responsible for different bookkeeping. Parallel computation can handle multiple transactions simultaneously; this can reduce the computational pressure on nodes and lower the entry barriers, improving transaction processing speed and the degree of decentralization. However, it means that the overall network's computing power is distributed, which can reduce the security of the entire network.
Changing a layer of the mainnet protocol may have unpredictable negative effects, as any underlying security vulnerabilities could seriously threaten the overall network security.
2.2 off-chain scaling
Core concept: A scalability solution that does not change the existing layer one mainnet protocol.
Off-chain expansion solutions can be subdivided into Layer 2 and other solutions:
3. off-chain scaling solutions
3.1 State Channels
3.1.1 Overview
State channels stipulate that users only need to interact with the mainnet when the channel is opened, closed, or disputes are resolved, and interactions between users are conducted off-chain, thereby reducing transaction time and costs, allowing for unlimited transaction counts.
State channels are simple P2P protocols suitable for "turn-based applications" such as two-player chess games. Each channel is managed by a multi-signature smart contract running on the mainnet, which controls the assets deposited in the channel, verifies state updates, and arbitrates disputes between participants. After deploying the contract, participants deposit and lock funds, and once both parties sign to confirm, the channel is officially opened. The channel allows participants to conduct an unlimited number of off-chain free transactions ( as long as the net transfer value does not exceed the total amount of tokens deposited ). Participants take turns sending state updates to each other, waiting for the other party's signature confirmation. Once the other party confirms with a signature, the state update is considered complete. Normally, state updates agreed upon by both parties are not uploaded to the mainnet; it only relies on the mainnet for confirmation in the event of a dispute or when closing the channel. When closing the channel, any participant can make a transaction request on the mainnet, which will be executed immediately if approved by all signatures; otherwise, they must wait for the "challenge period" to end before receiving the remaining funds.
In summary, the state channel solution can greatly reduce the computation load on the mainnet, enhance transaction speed, and lower transaction costs.
3.1.2 Timeline
3.1.3 Technical Principles
The general workflow of state channels is as follows:
Alice and Bob deposit funds from their personal EOA to the on-chain contract address, where these funds are locked in the contract until they are returned to the user when the channel closes; after both parties sign to confirm, the channel officially opens.
Alice and Bob can conduct unlimited off-chain transactions, with participants communicating through encrypted signed messages. Both parties need to sign each transaction to prevent double spending. Through these messages, they propose updates to their account status and accept updates proposed by the other party.
If Alice wants to close the channel, she needs to submit the final state of her account to the contract. If Bob signs to approve, the contract will release the locked funds back to the corresponding user according to the final state. If Bob does not respond with a signature, the contract will release the funds back to the corresponding user after the challenge period ends.
In a pessimistic scenario, if Bob does not respond to the state update signature sent by Alice at a certain point in time, Alice can initiate a challenge by submitting her last valid state to the contract. Then, the contract allows Bob to respond within a period of time by submitting the next state to the contract; if Bob responds, the two can continue trading within the state channel; if Bob does not respond within that time period, the contract automatically closes the state channel and returns the funds to Alice.
3.1.4 Advantages and Disadvantages
Advantages:
Disadvantages:
3.1.5 Application
Bitcoin Lightning Network:
Ethereum Lightning Network:
Celer Network:
3.1.6 Application Comparison
The Bitcoin Lightning Network, Ethereum Lightning Network, and Celer Network are similar in design philosophy, all being off-chain scaling solutions based on state channels. The main difference is:
Underlying blockchain: The Bitcoin Lightning Network is based on Bitcoin, while the Lightning Network and Celer Network are based on Ethereum.
Application Scenarios:
Technical Features:
Development Stage:
Token Economy:
3.2 Sidechains
3.2.1 Summary
The concept of sidechains was first proposed in 2012 in the Bitcoin developer chatroom, and the first related article was written by a Blockstream researcher in 2014.
Sidechains are a form of blockchain that emerged to accelerate Bitcoin transactions, allowing for the use of more complex contracts or by improving consensus mechanisms like PoS(, or adjusting block parameters to make the sidechain suitable for specific purposes. The transaction results of the sidechain are ultimately recorded in the validation when sent back to the main chain.