What is State Channel


State channel is a Layer 2 scalability solution. It allows participants to conduct an arbitrary number of off-chain transactions securely for free. Participants only need to pay gas fees when they open and close the channel. Therefore, state channels can enable greater transaction throughput at lower gas fees.

What is layer 2? What's its utility for blockchains? Please refer to the content: What is Layer 2

Principle of State Channel

Let's look at a simple example.

You can imagine a situation where Bob has to pay $0.5, the equivalent of $ETH, to his friend, Alice, over 10 times each day for one month. However, this can be very time-consuming and gas-consuming. Most of the time, the transaction amount cannot even cover the gas fee Bob paid for each transaction.

What is the gas fee? How is it generated and calculated? Please refer to the content: What is Gas Fee

So they come up with a pretty neat that they can open separate accounts in a bookkeeping APP, and Bob has to deposit some money in advance, let's say $100, into a safety deposit box to earn Alice's trust. Then, for each transaction, they only need to update their account balance without immediate settlement.

After a month, when all the transactions between them are finished, the bookkeeping APP clearly shows that Bob owes $80 to Alice, and the $100 locked in the safety deposit box will be redistributed between them.

This is an intuitive way to understand the idea behind state channels, but all the storage and computing of deposits will be governed by a smart contract.

Mechanism of State Channel

Technically speaking, to join a state channel, a pre-defined set of participants are required to sign a multi-signature smart contract to deposit and lock up their funds into it, which forms an initial blockchain "state". The "state" that is locked up in the smart contract might be an amount of ERC-20 tokens, or even NFTs, ENS domain names, etc.

Then, participants in the same channel can transact freely off-chain, without the need for immediate settlement back to Layer 1. Each off-chain transaction should be signed by all participants and then can be confirmed as a valid "state update".

Finally, when transactions are all finished, all participants should submit the final agreed-upon state to Layer 1 by signing the smart contract. After verifying all the off-chain transactions ("state updates") are valid, the smart contract will finalize the channel and settle deposit balances for each participant. And then, participants can withdraw what's left of their deposit.

Pros and Cons of State Channel

The above features of state channels make them good at handling extremely high transaction throughput while maintaining low gas fees for users, especially under the scenario of microtransactions (repetitive, small payments) over a long period. 

However, state channels do have other drawbacks. For example, they only allow transactions within a pre-defined set of participants in the same channel without adding or removing, which could significantly increase the limitations of the channels.

The oldest-known example of state channels is the payment channels in Bitcoin's Lightening Network, which allow for off-chain instant payments to be sent directly between two parties for free. Another notable example is Celer Network. Its product, Layer.2 finance, utilizes state channels to allow people to access all existing DeFi protocols at a fraction of the cost.

Source: Celer Network

Layer 2

State Channels

What else do you want to learn?


In This Article

Use TokenInsight App All Crypto Insights Are In Your Hands