State Channels, another path to scalability

State channels work by “locking” a part of the state of the blockchain in a multi-signature contract, controlled by a defined set of participants. The state that is “locked in” is called the state repository. For example, this could be an amount of Ether or an ERC-20 token, but it could also be a CryptoKittie or an ENS domain name.

Once the state depot is locked, Channel participants use off-chain messaging to exchange and sign valid Ethereum transactions without implementing them on-chain. These are like transactions that can be chained at any time, but they are not.

A basic breakdown

A basic breakdown of how this technology works would be as follows:

  1. Part of the state of the blockchain is locked by multiple signature or some kind of smart contract. Thus, a specific set of participants must be in complete agreement with each other to update it.
  2. Participants update the status of each other by building and signing transactions that could be sent to the blockchain. But these changes do not pass to the blockchain directly, instead the changes overlap until the interaction ends.
  3. Finally, participants send the state back to the blockchain, which closes the state channel and unlocks the state again (usually in a different configuration than the one you started with).

Since all exchanged transactions are equally valid as far as the blockchain is concerned, state channels need a mechanism to ensure that the last off-chain state (that is, the last move in our chess game) is the one that ultimately is resolved into the chain.

Final issue of the state

Therefore, if one party tries to unilaterally close a channel, other parts of the channel have a certain period (a “dispute window”) in which they have the opportunity to present a more recent status, thus proving that fraud was attempted. Once a violation is proven, the contract handles the resolution process, which generally involves punishing the guilty party by slashing their deposited funds (although it could also simply be updated to valid status and proceed accordingly).

If the “status” that is updated among the participants were a digital currency balance, then we would have a payment channel. Steps 1 and 3, which open and close the channel, involve blockchain operations. But in step 2 an unlimited number of updates can be done quickly without the need to involve the blockchain at all, and this is where the power of state channels comes in, because only steps 1 and 3 need to be published in the net. Pay fees or wait for confirmations.

In fact, with careful planning and design, state channels can remain open almost indefinitely and used as a larger exchange system to power an entire economy or ecosystem.

Source link