Statechains And Helping Bitcoin Scale Off Chain

Nik
Coinmonks
7 min readApr 3, 2020

--

One of the most exciting things to look forward to in Bitcoin is the multitude of ways to safely, securely, cheaply, and creatively transact in it. From transferring in person via an Opendime to using the Lightning Network, I knew this was just the start of Bitcoin being able to scale privately and securely off-chain.

As time goes on Bitcoiners will figure out new use cases and will want to transact in a way that best suits them. Fortunately, Bitcoin is an open-source and if there is something that needs to be developed, we can do it. Well here is another way to transact with Bitcoin via an off-chain second layer protocol called Statechains.

Statechains initially caught my attention as it does something I never would have thought someone would willingly do, and that is instead of sending someone Bitcoin straight up, they would send the private keys to said person so they would then have ownership. This method of transacting does involve some tradeoffs, but then again like I previously stated, we will need different ways to transact for different purposes.

This uses a “two of two multi-sig wallet” which means a semi-trusted third party is involved. The importance of the two of two multi-sig helps ensure that neither party can screw each other over and steal the Bitcoin. The third party in this scenario has the duty to sign a requested transaction but only if it comes from the sender (or person who last held the transitory key). When sending the transitory key to someone else, the sender must notify the third party so they now know who holds it and can properly approve of future transactions. None of this ever requires an on-chain transaction and can be repeated over and over again.

“Use a semi-trusted third party for a transaction? Hell no! How would I be able to trust someone else? That's the whole reason I got into Bitcoin!’

I know that's what many of you are thinking, as I did as well. How do you know if you can trust the third party to act accordingly? Well, there are some ways to fix this, make it unprofitable for the third party ending up in wasted time, and keeping your coins safe from being stolen or lost. One solution to this problem was adding a time lock (via a backup transaction made previously before sending it to the multi-sig wallet) so if the third party refuses to comply, you’re safe. After the timelock is up, the coins will be sent to whatever address that it was programmed to go to and nothing is lost or stolen. This, of course, can be sped up if the third party and original participant both sign a transaction to do so. Moving on from that, let's say the transitory key gets passed around a bit and has gone through a few new owners. The current owner could utilize Eltoo (Lightning Network feature) allowing him to use his own backup to override any previous owners' backup, stopping them from cheating the system and reclaiming the coins.

If only everyone had good intentions am I right?!

One of the drawbacks of this is there is never a 100% chance you can trust the third party, as they could work with previous owners to get the transitory key and do whatever they please. This is where things get a lot more complicated as since this problem can’t fully ever be solved, there are a lot more complex steps taken to minimize risk. A longer solution to this is breaking up the third parties' key so that it has to be confirmed by multiple others in order to approve it. There are some limitations to Statechains as it is required to have Schnorr signatures and Sighash_Anyprevout to operate functionally. And lastly, the entire UTXO must be spent in a transaction, not smaller amounts. But since you can trade UTXO’s you can create a transaction similar to a Coinjoin; because only you and the Statechain know about it.

Now let's look at the more fascinating things about this secondary layer. Since each UTXO is essentially locked up and can only be spent in full, there is no risk of any fractional reserve. There is no risk of someone lending out any fraction of the stash, especially without permission. This also comes in handy if a central authority tried to seize or freeze the Bitcoin. The could not seize anything as they would have most likely only one key and the other participant could easily put the Bitcoin back on-chain. Oh, and did I mention that Statechains are noncustodial? Well, they are!

Statechains work very well with the Lightning Network and in fact, could be an easy solution to onboarding new users. Why is this? Statechains make Lightning much more flexible, allowing you to seamlessly add and or remove people from the channel without ever having to touch the main chain. As well as Statechains can be turned into Lightning channels at will. Let's say you want to set up a Lightning channel with someone, you would then have to first have available funds on the statechain. Then simply change the Statechain UTXO into a shared Lightning channel and BOOM! There you have it! This new technology can be advantageous as you can open and close channels with ease since you don't have to put anything on-chain.

Opening a channel but don't know how much liquidity you might need? Statechains provide a useful solution to this problem. You can open and close channels very cheaply, allowing you to open a channel with a small UTXO (then realize later on you may need more liquidity) and transfer it to a larger UTXO. Closing the channel when you’re all done with it as well with minimal costs. Because this is not only cheap but efficient, developers and testers can get creative and really test out new experiments they may have not been able to before. I'm really excited to see what creative ideas and solutions people will get from this!

While you use Statechains and Lightning together at the same time, the protocols are still kept separate. This is still true when closing the chain, as the Statechain does not need to be involved because both parties do not need to know about the transaction. The Statechain is somewhat hidden from this transaction although it can see that the UTXO has been transferred.

Statechain is blinded and can't see what it's signing

Privacy is also taken another step further with Blind Statechains. There was the first problem of the statechain knowing about your transactions and broadcasting them for anyone and everyone to see. But since you can swap UTXOs around, it makes your transactions similar to a Coinjoin. Built into this is also blind signatures. As you can see in the diagram to the left, the statechain can’t exactly see what it's signing. It could be someone sending money, it could be something completely different. All it see’s is there is a transaction to sign, so it does so. This helps with increasing privacy so much since you can transfer the rights to a private key safely and securely without ever having to change the actual key itself.

Overall I’m really optimistic about the future of off-chain scaling and other creative ways we will be able to transact in. As time goes by and the number go up, we will see a new wave of smart and passionate Bitcoiners come into space with fresh ideas on how to tackle problems. I have no doubt in my mind that any hiccups in Statechains and other layer two solutions will get smoothed out and get fixed in the long term. Cheap solutions that help with privacy get me so bullish on Bitcoin AND Bitcoiners I can’t even verbally express it.

Thanks for reading and have a great rest of your day homies!

Works Cited:

Song, Jimmy, director. Statechains, a Semi-Trusted Layer-2 Protocol! Bitcoin Tech Talk Issue #181. Statechains, a Semi-Trusted Layer-2 Protocol! Bitcoin Tech Talk Issue #181, YouTube, 30 Mar. 2020, https://youtu.be/ZdKhNv4l5Bs.

Wirdum, Aaron van. “Statechains: Sending Keys to Scale Bitcoin Off-Chain.” Bitcoin Magazine, 8 Jan. 2020, bitcoinmagazine.com/articles/statechains-sending-keys-not-coins-to-scale-bitcoin-off-chain.

Get Best Software Deals Directly In Your Inbox

--

--

Nik
Coinmonks

Bitcoin 🍊 Twitter and Digg: @nikcantmine