Payment or state channels are one of the more established blockchain scalability solutions. The idea is to use side channels or chains for processing transactions off the main chain. Once transactions on the side chain are processed and the state of the channel is finalized, it is written back on the main blockchain, as shown in the following diagram:
In this way, a lot of the transaction processing load is outsourced to a faster side chain, thus minimizing the amount of total validation effort by miners.
Here's a useful example to clarify this idea. Imagine that two friends go to a bar and open a tab. In this way, rather than paying for each round of drinks separately, their respective orders are recorded by the bartender and settled at the end of the night when the friends are about to leave.
Similarly, when two parties make transactions between each other in a payment channel, they will not record each transaction on the main blockchain. Instead, only after they finish all their dealings on the side chain will their respective account balances will be recorded on the main blockchain, as shown in the following diagram:
In a bit more technical terms, the process works along the following steps:
- First, a part of the blockchain ledger, including the account balances of the parties involved in the payment channel, is locked in a smart contract. This smart contract includes the agreement and business logic of transactions between the participants in the channel:
- Then, off-chain transaction processing between the parties takes place. The state of the participants' account balances is updated only between them for the time they use the channel. This allows any number of transactions to be processed without requiring the main blockchain, and it makes the process fast and scalable.
- Once the parties have finished their dealings between them, the payment channel is closed, and the final state of their account balances is written back on the main blockchain:
This is a very effective solution in rendering a faster and lighter blockchain network. Payment channels are a good solution for micropayments and IoT transactions, among other applications. They can minimize the cost base of transaction processing on the network.
Payment channels are used in Bitcoin's lightning network and Ethereum's Raiden network.
Lightning networks provide a useful platform for lightning fast transactions where participants don't need to open a bilateral payment channel with each person they want to transact with. Instead, the platform provides a network of such channels that reach everyone connected to it. Thus, a user just needs to open one channel to connect with the lightning network and then can transact with anyone else connected to it.
The Bitcoin lightning network has recently been deployed and is already operational.
There are also some decentralized applications that use state channels to great effect. Do you remember Fun Fair, the online gaming platform running on Ethereum? They have built state channels called Fate channels to enable fast and efficient transactions, and facilitate the scalability of their platform.