In our last article, we introduced the new trend in blockchain development and the development of a two-layer scaling technology, known as the Layer2 solution. Next, we will focus on the status channel, one of the “off-chain” scaling technologies, and introduce the related projects.
State Channel
Let’s talk about status channels first, just to give you an example. Alice and Bob are playing a boxing game together. If Alice wins, she gets 1 dollar from Bob, and if she loses, she has to give Bob 1 dollar, and vice versa. If the game is running on the main ethereum chain, our usual approach is for Alice and Bob to create a smart contract together. Whenever the fist game starts, they make a transaction to the smart contract, and when one of the players wins, the smart contract will enforce the rule to pay the winner $1. This is clear and simple, but it’s still very inefficient on Ethereum. Because this is limited to transactions between Alice and Bob that need to be processed by the entire ethereum. And every time the player needs to do something, they have to pay a Gas fee, they have to wait a few blocks before they can do it, which is very unfriendly to play the game. So can we design a system here that minimizes Alice and Bob’s operations on the chain? Yes. A system in which Alice and Bob can update the state of the game off-chain and, if necessary, restore the state of the main ethereum chain is called a state channel, and the implementation process can be summarized as the following steps:
- Open status channel
- The pledge assets
- Create a decentralized system of checks and balances
- Send transactions off the chain
- Sign the status and send it
- Both sides confirm the change of status
- Close status channel
The specific process
The challenge period
The advantages and disadvantages
advantages
- Status channels have good privacy
No matter how many transient transactions occur on the status channel, these transactions occur within the channel and are not broadcast or recorded on the chain, so no one else will know, so there is very good privacy.
- Immediate finality
As long as both parties sign a status update, the status is considered final and can be exited at any time.
- Suitable for long-term multi-status updates
Status channels are particularly suitable for participants who need to exchange many status updates over a long period of time, because there is an initial cost to creating a status channel when the contract is deployed, and the marginal cost of a status channel is close to zero once deployed. disadvantages
- Each opening and closing of a status channel requires an on-chain transaction
Opening the status channel to send only one transaction is uneconomical because two other transactions need to be done on the chain, and it is not suitable for low frequency operations.
- Participants in the status channel should stay online at all times
Due to the existence of the challenge period, the participants of the status channel need to be online all the time. If they are not online, their assets may be lost. We usually use imToken for transfer, and it is good to wait for the confirmation of several blocks.
- More suitable for applications with a defined set of participants
Because the judge contract of the status channel always needs to know the entities (addresses) that are part of the channel, it is also a troublesome point to change the contract and rebuild the channel each time we need to add or remove members. Let’s talk about projects implemented through state channels to help you understand their applications.
Lightning Network
This is the micro-payment channel of the Bitcoin network, which has been done for many years. However, due to the poor support of script and smart contract of Bitcoin itself, and the complicated design of its unlock and lock process, the project has been developing very slowly.
Radien Network
This is a micropayment channel on Ethereum, called the Lightning Network, similar to the Lightning Network. Because ethereum supports smart contracts, it’s much simpler and much faster than lightning. Lightning network draws on the technical concept of lightning network, and the key technologies are the same as lightning network, including RSMC, HTLC and other technologies. What makes them great is that you don’t have to have a status channel with every specific person you want to trade with, you can have a status channel connected to the larger status channel network, and then you can pay anyone connected to the status channel network at no additional cost. The more participants, the better the network’s ability to handle money transfers. However, in the early stage of network establishment, due to the few payment channels, so someone needs to take the initiative to establish intermediary points, in order to make the whole network more valuable.
Sprites
It introduces an economic model that provides an economic incentive for users to maintain a state channel. When A and B trade, B and C trade, they need to create A state channel. When they trade, they all close the state channel. The next time A and C need to trade, they need to create another state channel. If we can maintain the state channels between A and B, B and C through the mode of economic incentive, then the next time A and C trade, we can use the state channels between A and B, B and C as A springboard for input interaction. Then they don’t need to be built. That’s what Sprites are doing, providing financial incentives for people to maintain status channels so they can interact for others.
Counterfactual
What it does is Generalize the State Channel. Our premise is the state channel of Payment. If it is a game-based state channel, such as gobang or cards, when it exits, the judge’s smart contract is relatively complicated to write and harder to implement in engineering. What Counterfactual does is Generalize the judge layer so that as long as you Open the status channel once, it can be used for all kinds of applications and exits. It abstractions the opening and exiting mechanism of the state channel, and allows people to use the state channel more easily through a common modular implementation.
Liquidity Network
The Liquidity Network aims to solve the problem of ethereum payment speed and it is a lot of optimization compared to the Lightning Network and lightning Network. Lightning network is a one-way channel transaction between two parties. However, the Liquidity Network adopts the Network topology structure of Hub, so that users can join in any Hub and carry out transactions, payments and transfers with other users through the Hub, thus realizing two-way channel transactions between multiple parties. In the previous state scheme, if A is to be sent to C, there is no channel between them, but A and B, AND B and C have channels, then A can pay B to “borrow” to complete the transaction with C. If there are too many intermediate links, the “borrow fee” is also A large amount of expenditure. Since the Liquidity Network adopts the structure of Hub, if A wants to send it to C, it no longer needs to pass THROUGH B, so there is no concept of “transit fee”. In addition, with the help of the REVIVE deposit rebalancing algorithm, the Liquidity solves the problem that the funds between the channels of the lightning network are independent and cannot be automatically balanced. For example, in the Lightning network, if A sends A transaction to B and B sends A transaction to C, assuming that B’s balance is 0, then B cannot directly send A transaction to C after A sends A transaction to B. It must establish A payment channel with C and recharge enough money (greater than the transaction amount) before it can trade with C. It looks like trouble. However, through the REVIVE technology, Liquidity can directly allow B to trade with C immediately after the transaction with A, greatly increasing the efficiency of the transaction.
FunFair
FunFair is a decentralized gaming platform supported by Ethereum smart contracts. It builds a PEER-to-peer casino through a one-to-one status Channel, aiming to achieve fairness and justice in online blockchain gaming and solve the problems of high fees and low trust in “casino” games.
SpankChain
SpankChain is an Ethereum-based, adult entertainment platform whose existing products include Vynos, a peer-to-peer micropayment processing wallet, which has established a one-way payment channel for adult participants (its ICOs used a status channel).
Read on:
Layer2 | State Channel State Channel
Layer2 | Plasma framework
Under the Layer2 | chain is calculated
Communication between Layer2 | chain