State Channels Q&A
If you’ve kept up with blockchain, you may be well aware that there is a race between competing technologies to scale their respective blockchains. In a recent tweet by Vitalik, he suggested the following five scaling strategies:
If you look at number four, you’ll see he notes the “layer two” solutions of “Plasma” and “Channels”. Layer two solutions are those which sit on top of a protocol to improve it (Ex: adding a jet booster to a car) whereas layer one solutions are embedded within the protocol layer (Ex: improving a car’s existing engine). Layer two solutions are great because they can be taken and applied to any other blockchain (as long as they have a place to add a jet booster), while layer one solutions are specific to the blockchain itself and often require a lot more time to implement.
In this post, I’m going to give a brief overview of what State Channels are, the value they provide, and who is working on them in the space.
What is a State Channel?
A state channel is something that allows work that would typically be done on the blockchain to be done elsewhere. This frees up the blockchain to handle additional work and increases overall throughput of the system.
Every time you interact with the blockchain, you are digitally signing and executing some transaction with your blockchain wallet. State channels allow you to create / sign these transactions and hand them off to someone else so that they can execute them. One example of this would be going to a bank and transferring money to someone versus signing a check and letting them transfer the money to themselves in your name.
The provided example below expands on this thought and provides a real-world scenario where this would be useful.
What’s an Example of a State Channel?
One example of a state channel is where we handle payments between different parties. These “payment channels” have been discussed for years, and are exactly what the Bitcoin Lightning Network provides to Bitcoin.
For a real-world example of a payment channel, imagine the following scenario: you frequently purchase food at a restaurant, but only pay in checks (as this is most convenient for you) — whenever a check is cashed, though, there is a $5 fee from the bank cashing the check for the restaurant. Now, with each check averaging ~$15, this is a 33.33% transaction fee. So, what do we do to avoid these high fees?
The situation plays out with you paying by check to the restaurant, except that each time you write a new check, you increment it by the value of the previously written check that you gave the restaurant and rip apart the old check. This allows the restaurant to have a signed check for the running total that you owe to them, enabling them to handle multiple transactions with only one bank interaction (mitigating the bank’s transaction fee). This would look a little like the following:
In the above example, we see that we can mitigate transaction fees by exchanging newly written checks to account for those previously written and destroying the olds ones in the process.
If you would like a deeper dive into how this is implemented technically, please take a look at my previous article.
What are the Benefits of State Channels?
As you’re probably aware, blockchains are pretty slow — for instance, the Ethereum blockchain is only able to handle about 15 transactions per second. This really hinders Ethereum’s ability to handle any serious traffic — in fact, in January, “CryptoKitties” — a single application, completely backed up the blockchain to a point where it would take days to get a single transaction processed.
With systems / applications that leverage state channels, we are be able to:
- Address the user experience problem of having to wait on the blockchain to confirm everything a user does, ‘Instant Finality’.
- Provide privacy to transactions — only you and the restaurant knew all the individual transactions between each other, the bank only knew the sum of the transactions.
- Lower the cost of leveraging blockchain technology — every time you do a transaction involving the blockchain, you have to pay a fee. By migrating most of the transactions off of the blockchain, we lower that fee and make it less expensive to use.
Why Haven’t I Heard About These?
You have certainly heard of these before! As stated previously, the Bitcoin Lightning Network is a collection of payment channels where individuals validate transactions between themselves without having to pay fees or wait on the entire network to check that their transactions were valid. If you’ve heard of Raiden, it is doing the same thing for tokens on Ethereum.
In terms of companies focusing on the more general approach (more than just payments), the main player would be Counterfactual (by L4). They do not yet have any publicly available implementations of their framework, but plan to be releasing something soon.
Where can I Learn More?
Feel free to contact me on Twitter with any questions that you may have — I’ll be putting out additional articles on State Channels every week on Medium as well as code on my Github for implementing them within your applications.
If you’d like to learn more about Counterfactual, here are a few resources for you to check out: