As of now, Ethereum is the most well-known and successful blockchain that enables a smart contract platform that has proper state channels. This means that every block of the Ethereum blockchain has information related to its entire state. The information comprises account balances, contract code, and contract storage, etc.
What are state channels?
State channels are referred to as the procedure through which the users conduct a transaction with each other off-the-chain or outside of the blockchain. Both participants use their private key in the channel for the transaction, which ensures security in the process. It is quite similar to that of Bitcoin Lightning Network’s payment channel concept. However, there is a little different as instead of supporting payments they support general state updates as well.
The best part about state channels is that they are private and off the chain, meaning that they are only known or open to the participants. It also enables both parties to conduct instant anonymous transactions as well. Based on the number of transactions conducted the lifespan of the channels is determined. If needed the participants can close the channel by entering the last update of the transaction conducted.
After the closure of the channel, the record of the transaction can be uploaded in the blockchain to make the outcome official.
Though it might look like that the transactions conducted within the state channels do not have the same level of security as that of the on-chain transactions. However, that is not the case. The security remains to be the same as in off-chain transactions as well.
How do state channels operate?
The working of a state channel is quite interesting. The Ethereum platform process goes like this:
- The participants lock up a certain part of the state to send money to a multi-signature contract that can accept Ether and pay all parties as well
- Every participant in the state channel sign the transactions and then send them to each other. Each of them creates and keeps a copy of the signature for future reference.
- Each transaction that takes place in a way so that a chronological order of all the transactions are maintained for the smart contract.
- After the participants have conducted the transaction via the state channels they close it by submitting the last update of the transaction.
- Followed by the updating and unlocking of the state, the remaining balance is sent to the participants by the smart contract.
State channels are important because it enables scalability that is a big issue faced in mainstream adoption of blockchain. Most of the applications are too slow or too pricey for regular users to have access to. The use of state channels is known to minimize the overall computational load that one needs for processing and storing of transactions conducted. It also significantly reduces the cost of using the blockchain network.