Episode 8: Statechains w/ Ruben Somsen
Ep. 08

Episode 8: Statechains w/ Ruben Somsen

•

Episode description

Aaron and Sjors welcome their first guest on to the show, Ruben Somsen, to discuss his proposals for Statechains on Bitcoin! Statechains allow you to send keys not UTXO and it offers quite a few scaling and functionality improvements!

Helpful Links:

Ruben’s presentation on Bitcoin Magazine about Statechains:

Aaron’s Bitcoin Magazine article on Statechains: https://bitcoinmagazine.com/articles/statechains-sending-keys-not-coins-to-scale-bitcoin-off-chain

Chapters

00:00:00 Introducing Ruben Somsen and statechains
00:02:55 Off-chain transfers of whole UTXOs
00:06:15 Two keys and unilateral recovery transactions
00:11:15 Overriding old states with eltoo
00:13:01 Trusting the operator and reducing custody risk
00:18:57 Opening Lightning channels on statechains
00:20:49 Implementations before ANYPREVOUT
00:23:33 The state history and public double-spend detection
00:28:06 Scaling layers, adoption and federation tradeoffs
00:31:42 Payment pools, monitoring and nested designs

Support the Show!

Follow Bitcoin Magazine on Twitter @BitcoinMagazine

Follow Aaron van Wirdum @AaronvanW

Follow Sjors Provoost @provoost

Transcript

Download transcript (.vtt)
0:07

Aaron van Wirdum Live from Utrecht, this is the Van Wirdum Sjorsnado.

0:10

Sjors Provoost Hello.

0:11

Aaron van Wirdum Sjors, welcome.

0:12

Sjors Provoost Thank you.

0:13

Aaron van Wirdum Who's this?

0:14

Sjors Provoost There's a guy in the room.

0:15

Ruben Somsen There's another guy in the room. Sorry to...

0:17

Aaron van Wirdum There's three of us today.

0:19

Ruben Somsen That's right. And I'm also from Utrecht, so that's amazing. All three of us.

0:24

Aaron van Wirdum Ruben Somsen.

0:25

Ruben Somsen That's right.

0:25

Aaron van Wirdum Welcome.

0:26

Ruben Somsen Thanks.

0:27

Aaron van Wirdum Let's start with, yeah, let's briefly explain who you are.

0:31

Ruben Somsen Sure. I'm Ruben. I like Bitcoin a lot. Originally, I've been in South Korea for a very long time. I ran the Seoul Bitcoin meetup there and I got so into Bitcoin that now I'm kind of contributing or going and... making proposals such as state chains, which I assume we're going to be talking about today.

0:51

Aaron van Wirdum Yeah, and in South Korea, you were hosting the Seoul meetup, I think?

0:55

Ruben Somsen Yeah, that's right. So I was doing this Seoul Bitcoin meetup there. Right now, it's kind of on a hiatus. I mean, I'm not there. There's corona right now, so that's not great. Maybe some of the guys that are still around there will be organizing more meetups again once things get back to normal. But for now, I'm here back in the Netherlands and I'm enjoying your company. So that's also great.

1:16

Aaron van Wirdum Yeah, and you're hanging out in Utrecht and you're staying here for the foreseeable future?

1:21

Ruben Somsen Yeah, I haven't really planned ahead. So for now, I'm just going to be here. And yeah, we should hang out more often.

1:27

Sjors Provoost Yeah, I mean, the weather is great here. A

1:29

Ruben Somsen little rainy. I got wet on my way here, but yeah, it's something. Yes,

1:34

Aaron van Wirdum and you designed state chains. That's your claim to fame.

1:38

Ruben Somsen Yeah, I guess that's the one that stuck. I mean, there are a couple of other things that I've done that I haven't really, well, I guess I have yet to present in a way that people understand and appreciate. But State Chains is the one that I think most people know me from.

1:53

Aaron van Wirdum You want to get into it?

1:56

Ruben Somsen Sure.

1:56

Aaron van Wirdum Are you ready for state chains?

1:58

Sjors Provoost I think I am. I mean, we could probably remind the user that we did an episode, episode six, about sharing a UTXO, so sharing a coin on the blockchain between multiple people. We discussed various ways to do that. And this is actually another way.

2:12

Ruben Somsen Yeah, that's right. Payment pools, right? I listened to that episode.

2:16

Aaron van Wirdum Well, it is and it isn't. It's pretty different.

2:19

Sjors Provoost Well, that's why I said it's another way.

2:22

Aaron van Wirdum Yeah, but you're not sharing the UTXO in the case of state chains. Anyways.

2:25

Ruben Somsen You're sharing it with the state chain federation, sort of. So I think you could say that. It just depends on how you look at it.

2:34

Sjors Provoost Okay, maybe I should say another way. Well, it's like sharing your car. You know, whose car is it? What are you sharing?

2:42

Aaron van Wirdum A little bit. You're right.

2:43

Sjors Provoost There is another party involved. I think that is important to indicate. Yeah.

2:47

Aaron van Wirdum All right, let's get into state chains. I guess it makes sense if you take the lead, Ruben.

2:53

Ruben Somsen Sure.

2:53

Aaron van Wirdum Doesn't it?

2:54

Ruben Somsen Yeah, I guess so.

2:55

Aaron van Wirdum Okay, go for it. Yeah, feel free. Okay, first of all, no, let me ask you a question. First of all, what problem are we solving here?

3:01

Ruben Somsen Yeah, so the problem we're solving is basically trying to take Bitcoins off chain in such a way that we have a minimum amount of risk to some kind of third party. What we want is we want to have some Bitcoins and I want to send you those Bitcoins. But ideally, we don't use the Bitcoin blockchain because that's expensive, especially in the future when more and more transactions hopefully are going to occur. So we have to do it in some other ways. And statechains is one of those ways. And one analogy or one similarity is that of federated sidechains. So federated sidechains are kind of also a model where you basically hand over your Bitcoins to some kind of multi-sig address. And then from that point on, you... move your coins on another ledger, and then at some point you ask for your coins back and multisig hopefully gives them to you. This is kind of like that, but... More secure and kind of a different model because you're transferring entire UTXOs. So it's not like with a sidechain, you could send any kind of fraction of a Bitcoin and you could take those out. But here, that's not the case. Here, there's a UTXO on the blockchain and I can either transfer the whole thing to you or not.

4:13

Aaron van Wirdum Yeah, that's actually why I figured it's not sharing UTXO. You either have it or you don't. It's not like we both have a part of it.

4:22

Sjors Provoost Yeah, you're passing the UTXO around.

4:25

Ruben Somsen Yeah, but it is possible to send it to two people. So you don't necessarily have to send it from Alice to Bob. You could send it from Alice to Alice and Bob. So then it becomes a payment pool or a channel or whatever you want.

4:38

Aaron van Wirdum I didn't actually know that. Let's get into that once we've explained state chains themselves. Okay. Yeah, so the way I wrote an article about it, a while ago like over a year ago yeah and sort of the sort of the first step i took was what you can do if you own a utxo it's just instead instead of send the transaction just send someone the private key yeah okay the reason you can't actually do that is because the person can keep the private key keep a copy of it and still send the coin so that's the first problem you sort of need to solve here right yeah so how do we solve this problem how do you how do you Share it.

5:12

Ruben Somsen Yeah. How do you share a key and not get screwed over because the other guy still has the copy of the key?

5:18

Sjors Provoost Well, there's this guy in Canada that made this device that can do that. But this may be a bit of a sidetrack.

5:25

Ruben Somsen I have no idea what you're talking about. Are you talking about like an HSM, like a device that can transfer over private keys?

5:32

Sjors Provoost Yeah, the USB key that has a private key on it and has a self-destruct mechanism.

5:35

Aaron van Wirdum Oh, sure. Opendime. Opendimes. All right, right.

5:38

Sjors Provoost So that is a way to do that, a very different trust model than what you're describing. But it's kind of similar that you cannot, you can't just send arbitrary amounts. You can't use an Opendime to send half of the money from the Opendime. You give the whole thing.

5:50

Ruben Somsen Yeah, that's true.

5:51

Sjors Provoost And in that sense, state chains are a bit similar.

5:54

Ruben Somsen Yeah, you could say it's like a virtual Opendime. where there's some kind of federation that is kind of like the replacement of the OpenDime functionality to ensure that private key doesn't actually do anything funny.

6:07

Sjors Provoost Enough with the sidetracks. Yes. I don't think the analogy is as useful as I was hoping. Let's just get into it.

6:15

Ruben Somsen Yeah, so essentially, instead of having one key that you transfer over from Alice to Bob, say, there are two keys. And one key is with a federation. Or if you want to, for simplicity, you could just say a single server, but a federation would be more secure. And essentially, you do two things. You hand over your key. Alice hands over her key to Bob. And then simultaneously, she requests the server or the federation to sign a off-chain Bitcoin transaction that assigns the Bitcoins, that assigns the UTXO to Bob. And this means that if the federation, the state chain disappears. Bob can just send that transaction to the Bitcoin blockchain and get the Bitcoins. And we have a dispute mechanism, or in this case, it's utilizing eltoo, that ensures that even though Alice also has a copy of an off-chain transaction, Bob's copy basically goes first or has as a priority.

7:11

Aaron van Wirdum Okay, one step at a time. Yeah. First of all, we need... a federation or it could just be a trusted server but a federation is a bit more secure yes

7:21

Sjors Provoost yes

7:21

Aaron van Wirdum okay so the first thing we're doing is we're we're securing this utxo in a multi -sig two out of two right that's that's the idea so that way if i get i'm alice I give my private key to Bob. Then Bob cannot yet spend the coins without the server helping out, right? Yes. And the same for me. Like when I first put my money in the UTXO, I can spend the money without the server helping out or the federation. I'm using the two in a confusing way, perhaps. But whether it's a federation or a server, you need someone's help. That's two of two. That part is easy. The hard part is... First so there's I think there's two big problems the first big problem is what do you do if the Federation is unresponsive yeah okay because if the Federation is unresponsive then you can't get your money out yeah I can't get my money out if the Federation is unresponsive so we need a solution for that and the solution for that looks a lot of like lightning yes if you're counterparty isn't responding anymore you can still get your money out and the way you do that is with a pre-signed transaction that sends coins in a specific way to new outputs where it can be spent either with cooperation like either sort of in the original way in cooperation with the server or after a week you just get the funds yeah that's right yeah right okay So that's how I would set it up at first. Yes. But then I'm sending money to Bob. So I'm sending my private key to Bob. I'm just giving him my private key as a way of paying him. Yeah. So now the server has to help Bob. But it also means Bob has to be able to get his money out if the server is unresponsive. Yes. So therefore, Bob also needs this backup transaction. That's right. So before I send the private key to Bob, I actually first cooperate with the federation or the server to set up a... backup transaction for Bob. And only when Bob has a backup transaction will he also accept the key as a form of payment.

9:23

Ruben Somsen That's right. Right? Yeah. So once both of these have occurred, the payment is basically complete. And before that, the payment would not be accepted by Bob. So yeah, absolutely right. And thanks for... I think you're very good at explaining these things and also in your article. So I just want to say thanks for rewording this because I think this is really useful for our listeners.

9:41

Aaron van Wirdum Thank you. Are you still with us, Sjors?

9:43

Sjors Provoost Yeah, partially. So... so there's a there is a multi-sig involved in this or not or

9:48

Ruben Somsen yes two different conditions

9:49

Aaron van Wirdum okay so there's actually two multi-sigs if we use the federation and that's what we need Schnorr i think

9:55

Sjors Provoost yeah let's let's just call it a server and just have one server with a private key on it just to keep it simple sure keep in mind that this could be a very complicated thing but just call it one server yeah so the server creates An address or something where it creates a private key and then there's a multisig between the server and Alice.

10:15

Ruben Somsen Yes.

10:15

Sjors Provoost That's where the money's at. So they both have to sign in order to move it.

10:18

Ruben Somsen They both have to sign in order to move it.

10:20

Sjors Provoost Before the money is moved in.

10:21

Ruben Somsen That's right. Yeah. So Alice already has a transaction where she can reclaim the Bitcoin. Similar to kind of how when you set up a lightning channel, before you set it up, you sign a transaction where you get your coins back if cooperation fails.

10:36

Aaron van Wirdum Yeah, which you don't broadcast yet, obviously. You broadcast that if and when the servers are unresponsive.

10:44

Sjors Provoost Yeah, and then so the way you move it to Bob is now Bob creates the same transaction to him.

10:52

Ruben Somsen Yeah, well, Alice has to do that for him because Bob is not in control yet. So Alice asked the server to create another off-chain transaction, but now sending the money to Bob. And then Alice hands her private key, or rather the transitory key, as I call it, because it's not really Alice's key. It's the key that goes from one user to another user. That one then gets handed over from Alice to Bob.

11:15

Aaron van Wirdum Next question. The way this works, so Bob has his backup transaction. That must be able to override Alice's backup transaction, right? Yes. And I think that's why there needs to be this week of wait time, basically.

11:28

Ruben Somsen Yes. There needs to be some kind of... resolution there and it's again it's very similar to lightning where you you when you send coins you you create a new off-chain transaction and then the previous off-chain transaction has to become invalid somehow And the way it's done here, or at least the ideal way for state chains, is utilizing eltoo, which is a soft fork that is going to come in the future. And that's actually mainly intended for Lightning Network. But what that does is it allows you to not have to invalidate a transaction, but instead you can kind of override it. Or that would be like kind of my analogy, where even though Alice has one of these off-chain transactions, even if she sends it to the Bitcoin blockchain, Bob can then go ahead and send his transaction and kind of override it and take the money. Yeah.

12:13

Sjors Provoost Because what we're worried about here is Alice gives a key to Bob, but Alice still has a key so she can steal the money. But yeah, if she does that, just like in Lightning, there's some sort of way to stop that from happening. Yeah. And the way that you can already do is with rolling timeouts, right, where... Alice can send the transaction on February 1st, but Bob can do it a day earlier. Yeah. So Bob can always stay ahead of Alice. And with this new proposal, SIGHASH_ANYPREVOUT is another word for it. Sometimes it's called SIGHASH_NOINPUT. It changes names all the time. Yeah. It doesn't matter. Alice can broadcast her transaction, but Bob's transaction will fit onto that transaction. So he can always just take the money from Alice. But not the other way around. Alice's transaction does not fit on Bob's transaction.

13:01

Aaron van Wirdum Yep. Right. So no one needs to trust anyone for anything, right?

13:06

Ruben Somsen Wrong.

13:09

Aaron van Wirdum So there is a trust trade-off, Ruben. Tell us about the trust trade-off.

13:12

Ruben Somsen Yeah. So the trust trade-off is that if the server, let's call it, right? It could be a federation. If they literally want to take your money, they have a way of doing so. So what they could do is they could be the first person. They could pretend to be Alice, right? So the server is also Alice.

13:29

Aaron van Wirdum They're not pretending Alice in this example. They are Alice.

13:32

Ruben Somsen They are Alice. So we've got the server. We've got Alice. And then Alice sends her coins to Bob. and hands over the private key. But now we still have Alice, who has the private key. And Alice, because she's also the server, also has the server key. So now she has both keys. And so even though the money went to Bob, Alice and the server can just cooperate. Or if they're the same person, it's very easy for them to cooperate and take the money back. That would be the main kind of way in which this can go wrong.

14:04

Aaron van Wirdum Yeah, so to emphasize this, because I'm not sure if we've made this very clear so far, the idea is that the server will only ever cooperate with the last recipient of the funds. That's what the server is supposed to do. That's what we're trusting the server with. Only the last person who received the funds, that's the only person you sign along with.

14:23

Ruben Somsen Yeah, that's correct. So that's

14:24

Aaron van Wirdum also how the server can cheat. by being one of the previous recipients of the funds or colluding with them. And that way, not keeping to the original idea of only signing in cooperation with the last recipient and thereby stealing the funds.

14:39

Ruben Somsen Yeah, that's right. Because Bob would not have... asked the server to sign anything yet the server signs the coins and takes them so that would be a violation of what the what the server what the state chain server is supposed to do generally speaking so if the server is malicious you're screwed but there are quite a few kind of nice things that we can do to make it as trust minimized as possible well to be clear still there is there is this problem it exists So the first thing is that, well, which we talked about already, right? It's the Federation. So it's not just a single person. It's a group of people. Hopefully they're all over the world and they're spread out and you're some kind of threshold multisig. So seven out of 10 have to agree to take your money if they want to do so. And the second thing is that there's actually a little trick that might be a little bit difficult to explain. So I guess I won't go into too deeply. But essentially, there is a trick that allows you to change the transitory key with each transfer. If the federation is not malicious, and if they're acting honestly, they will cooperate with Bob to change the two private keys, the state chain key and the transitory key. And now if at some later point, let's say Alice goes and tries to hack the state chain, they cannot actually take the coins because the state chain has updated its private key and no longer has the key that... it used in cooperation with alice

16:03

Sjors Provoost so maybe it's useful here to consider how a custodial wallet might work yeah right in custodial wallet you give a server slash federation whatever it is you give them your bitcoin and they can do whatever they want with it whether or not they're honest and they could be forced or they could be hacked at some later point. But in this model, like you're presenting now, if they're honest, they can at least make sure that if they get hacked, it doesn't matter. If they get hacked later on, it doesn't matter.

16:32

Ruben Somsen Yeah, so it's kind of like a voluntary non-custodial setup where if they voluntarily give up their control... then they cannot even cooperate with prior users of the state chain and take the money. So they literally kind of give up their control as long as they follow the protocol as intended. And so while this doesn't protect you against a malicious state chain, it protects you against third parties that might attack the state chain, might hack them, or maybe there's a court order, and then they cannot actually comply because they don't actually have the keys to take your coins.

17:06

Aaron van Wirdum Interesting.

17:07

Sjors Provoost And another point that we kind of got to earlier, there's also the situation of what happens when the entity disappears, right? So if the [unclear] wallet disappears, well, you're just out of luck. The money is stuck in that place, and it needs to go through the traditional court systems. I think it's similar with a system like Liquid, where you have a federation that controls the whole sidechain. If they go offline, the money stays in that federation or subset of it. Whereas here, at least if without any malicious actors things break down, you still get your money back. So it's very subtle, the trade-offs, and I would imagine for a novice user, they would not be able to understand those differences, and also sometimes you can't even verify the differences, because you don't know from the outside the difference between a malicious server and a non-malicious server, because it's not written on the server. That's true. One that says, well, I'm trying not to be malicious, but yeah.

18:02

Ruben Somsen yeah there would have to be some kind of reputation involved right where you you know that that federation somehow is is reliable yeah so so that's kind of an important point to make right so with the federated sidechain model you have kind of a minority can refuse to give you your coins if it's six or seven out of ten multi-sig then that means that three or four people if they refuse to sign you're not getting your coins back so this minority can actually freeze your coins Whereas with this model, you need the majority to literally take the coins from you, otherwise you're going to get your coins back. So that is roughly doubling in security, depending on how you look at it. And on top of that, you can even make the federation a higher threshold. You can do an 8 out of 10, a 9 out of 10, because the worst case scenario is that one or two federation members disappear, and then you're forced on-chain, but you don't lose your money. So it's not a huge deal, although it is an inconvenience.

18:57

Sjors Provoost Maybe it's worth pointing out because we still have this very cumbersome property of having to handle the entire UTXO. And as you've mentioned, you can actually build a channel inside of this thing just kind of just like we discussed in the previous episode

19:12

Ruben Somsen yes yeah so so the the interesting thing is that basically all the scripting functionality of bitcoin is preserved and it's kind of done outside of the the state chain itself so the server doesn't really have to know anything it just literally it just signs for whoever the owner is and it doesn't have to look at what it's signing and in fact these can be blind signatures ideally If the thing that the server is signing is a transaction that sends the money to Alice and Bob, we have essentially created a lightning channel that we've opened on top of a state chain. And what's particularly useful and interesting about this is that you now have an off-chain method of creating lightning channels. It kind of solves the main issue of the state chain, which is that, well, I have a one Bitcoin UTXO, but I want to send you 0.5 Bitcoin. How do I do that? So now I can open a channel and immediately give you 0.5 Bitcoin. And this can happen off chain. And basically, I'm onboarding you onto the Lightning Network immediately. And then as long as we cooperate, we can then just go ahead and use it as a regular Lightning channel.

20:18

Aaron van Wirdum Yeah, or you can balance the channel to the exact right amount. wait am i saying that right am i just repeating what you just said

20:25

Ruben Somsen i'm not sure what you're getting at but but even even if the channel is imbalanced right like let's say we have a channel and at some point i just send all my money to Sjors well now we can kind of close the lightning channel and it just becomes a regular state chain utxo again but now Sjors is the owner instead of me

20:41

Aaron van Wirdum yeah no i i agree i was just gonna repeat what you just said because

20:46

Ruben Somsen it's also useful

20:49

Aaron van Wirdum Yes, no, but no, that wouldn't have been useful. You explain it just fine. Okay, so is anyone working on this?

20:56

Ruben Somsen Yes, so there is, in fact, an implementation that's being worked on now by a company called CommerceBlock. And they are considering we don't have this eltoo, SIGHASH ANYPREVOUT soft fork yet. They are restricted in the degree to which they can make kind of the full picture happen. and one of the things that i think will not be possible for them is to have this be some kind of lightning channel that that is probably not going to be possible or at the very least they're going to have utxos that are going to expire the more you transfer them so this is what Sjors was explaining earlier if you want to do it without eltoo you basically have kind of a ticking clock that goes down so The first thing is that you have to start with a high clock. You have to start with one year from now. And then with every transfer, you probably, like ideally you want a week between each transfer. But okay, so maybe because of this limitation, you do it one day. So you count down one day. Well, that means that you only have 365. transfers until you're at zero, and now your UTXO needs to be refreshed on-chain. So that's kind of one of the downsides with the implementation. But that said, I think it's realistic to try and utilize what you can utilize instead of waiting for a soft fork, because these things can take a long time. Schnorr has been taking a long time. Who knows how long SIGHASH ANYPREVOUT is going to take. I hope we're going to get there soon, but at the same time, that's not, you know, that's not how you build actual protocols today. You've got to make it.

22:24

Sjors Provoost It also helps the soft fork, right? If you have something that actually needs it. So, you know, the case for a SIGHASH ANYPREVOUT can be made just by Lightning, just by looking at Lightning actually exists now. There's all sorts of complications with it that people have shown, hey, SIGHASH ANYPREVOUT will make that just... easier yeah it was very it's a very clear case for it already but if that case didn't exist then maybe something like state chains could exist and even the end would be cumbersome but people would still be using it because that's of course the metric you can have a really complicated system and if nobody uses it then Nobody cares, but if a lot of people are using it, but the complexity is there, now you've made a case for the soft fork. So it can be useful to try something with a sub-optimal technology just to see if there's any demand for it, because maybe there's none. Maybe people don't care about it. There's too many trade-offs.

23:16

Ruben Somsen That's a good point. Yeah, no, I totally agree. And it is, I guess, yeah, to your point, it's kind of yet another reason to get SIGHASH ANYPREVOUT. So that's a plus, I guess. Well,

23:28

Sjors Provoost it could be.

23:29

Ruben Somsen It could be, yeah. Who knows?

23:33

Aaron van Wirdum We haven't mentioned what part of this is actually called the state chain, I think.

23:37

Ruben Somsen Okay, yeah.

23:39

Aaron van Wirdum Where is the chain?

23:41

Ruben Somsen Where is the chain, yes. So there is a chain. So when Alice sends her money to Bob... What Bob has to do is actually go back and check all the signatures that the state chain has made with this key to see if there's any conflicting transaction. So that is the chain. There's going to be a chain that is just linear for each UTXO, where the entire UTXO goes from Alice to Bob to Carol to Dave. And with each transfer, there's a signature from the state chain. And that is the chain. That is the state chain. It's very simple states, linear states. And just transferring, basically, ownership of that, of the signing rights, essentially, of the statechain key from one person to another.

24:25

Aaron van Wirdum Yeah. And I think that's also what makes it obvious if the federation or the server tries to cheat at any point.

24:32

Ruben Somsen Yes.

24:33

Sjors Provoost If you publish the chain.

24:34

Ruben Somsen Yes.

24:34

Sjors Provoost That's another part that you mentioned. You could make the chain itself public in a privacy-friendly way so that... The participants can see whether the server is doing a double spend.

24:45

Ruben Somsen Yes. Yeah, no, that's exactly right. So this is, I think, a difficult point for people to comprehend, but an important one, which is that what if I have two states, essentially? So I have Alice to Bob and I have Alice to Carol. And I just make sure that Bob only sees Alice to Bob and Carol only sees Alice to Carol. And now there's one UTXO, but there are two owners. And only if they go on -chain will they figure out what's going on. And even in this scenario, eventually they'll find out and eventually the state chain will be dead. But if it's, let's say, a very successful state chain and people don't go on-chain very often, this could mean that for a couple of months, the state chain is just cheating and then eventually people find out. But by then, it has half the coins. Not ideal. So for that reason, ideally, you have some kind of... some kind of chain that contains every UTXO that it controls. And ideally you do so with a so-called sparse Merkle tree, which has basically one slot for every possible hash you can imagine. And that means that if you have a single UTXO, there's only a single slot in which it could fit. So you could never publish both Alice to Bob and Alice and Carol at the same time.

26:04

Sjors Provoost Right, so what does the slot look like? It's the hash of the UTXO?

26:08

Ruben Somsen Yeah, it would be. And

26:10

Sjors Provoost then the new owner? It

26:12

Ruben Somsen would be probably the hash of the public key of the state chain. So every state chain has a different public key for every chain. And ideally, you don't really tell it which UTXO it controls. It doesn't really have to know that information. So it would be the key with which the state chain signs that would be the slot.

26:31

Sjors Provoost Right. At least some derivative of the UTXO and some derivative of the owner of the key, essentially. And you can see, or you look up the UTXO and you see that you're the actual owner according to the thing that's published.

26:46

Ruben Somsen Yes.

26:48

Sjors Provoost So where is it published? Where were you?

26:52

Ruben Somsen One way of doing it would be to have another peer-to-peer network where people share the chain, essentially. But actually, what's interesting, one thing you can do is just you can use the Bitcoin blockchain and just publish on there. So you would have for every 10 minutes, you would publish a new hash or a new set of hashes if you want a faster, faster chain. And that would mean that, you know, it's kind of the you're utilizing Bitcoin as a censorship for censorship resistance where, you know, only one chain is published. So, you know, if in the Alice to Bob, Alice to Carol scenario, both Bob and Carol, they go to Bitcoin blockchain, they check the hash. And then they check their specific slot for the UTXO they own and they would figure out that, oh, Bob owns it or, oh, Carol owns it.

27:35

Aaron van Wirdum But that would then have to be like a Merkle root in the blockchain? Because otherwise, what's the point? The point is to do it off-chain, right?

27:43

Sjors Provoost The only thing you need to put in the blockchain is a Merkle root.

27:46

Aaron van Wirdum Of all the state chains.

27:47

Sjors Provoost Yeah, or like all the state chains plus the Library of Alexandria. The point is as long as you offline have all the information that you need to reconstruct the whole Merkle tree. then you should come to the conclusion that the Merkle root is what is in fact in the Bitcoin blockchain. My issue with this sort of stuff is you're really proving why Bitcoin exists. Because all these problems, like, oh, but what if somebody double spends? What if somebody's lying about what the truth is? Well, now, imagine we have this blockchain where we can just fix that. But you run into, at some point, some scaling limitations. So it's nice to have creative ways out of it. But it's also nice to see that whenever you run into problems with this... a new layer, you can see that Bitcoin kind of solves that problem.

28:31

Aaron van Wirdum Absolutely, yeah. But I mean, that is sort of the point of second layers, partly. Like, we're making some sort of trade-off somewhere in order to benefit in other ways.

28:42

Sjors Provoost Well, it'll be interesting to see which of these solutions tends to win out. I mean, I am a little biased towards the Lightning working. But, and at this point, I don't see so much adoption of Lightning that I'm worried that the main chain is going to run out of capacity. In other words, We don't necessarily need another layer below or above lightning.

29:02

Ruben Somsen Yeah, I agree with that.

29:04

Sjors Provoost And also, my experience with human behavior is that people will absolutely ignore the next scaling problem until they [unclear] face. Yes. So, you know, Segwit got deployed a lot faster when fees went up. Yeah. And my guess would be that if and when lightning hits serious capacity issues, because, you know, you can't close channels anymore if too many people do it at once. Then people will look at all these proposals like state chains and then the other...

29:31

Aaron van Wirdum Payment pools.

29:32

Sjors Provoost Yeah, payment pools. And then they start really seriously implementing them. But then they notice that there's all sorts of practical problems they haven't really thought about in the theoretical observations.

29:41

Aaron van Wirdum Ruben has thought of everything, I think.

29:43

Ruben Somsen I don't think so. I'm trying, but obviously, once you get to the actual implementation, you run into issues. And there are definitely some more complex issues that are difficult to even explain now on a podcast like this. So I definitely think that it's not going to be that easy. And Lightning is the perfect example, to your point, Sjors. The Lightning Network, in theory, it's... relatively simple to understand i mean not super simple but now you know if you look at how it's working in practice with the routing and everything it's like super complex and most of the problems are only discovered when you really are doing it

30:22

Sjors Provoost yeah yeah so i'm imagining these cycles where you start running at max capacity you then start trying this this new layer solutions but by the time you you have some experience with it the capacity is already sort of subsided again yeah and then you have a few years to work on it and then You know, it repeats.

30:40

Ruben Somsen And, yeah, you know, like, I think... You know, I look at this from the perspective of where does Bitcoin have to go? And for me, it's kind of obvious that there is some kind of role for federations. And I think Lightning is kind of the superior option in terms of trustlessness, where you don't have to, there's no federation with Lightning, right? So that is better in that sense. But the issue you get with Lightning is that it's limited in throughput, right? You have routing, you have channels. And you have to send money through channels that are available that have enough liquidity. Whereas with state chains, you don't really have that problem. You can have a 100 Bitcoin UTXO and you can transfer it from one person to another person. No issues there. Obviously, there's a tradeoff there. But I think once. There will be a point where we hit the limitations of the Bitcoin blockchain, we hit the limitations of Lightning, and I think that's where federations fit in, and then we see federated sidechains becoming more popular, and hopefully statechains as well.

31:42

Aaron van Wirdum They work good in combination with each other as well. Yeah. Do you have an opinion on, have you looked into payment pools, for example, because they have sort of the same benefit?

31:52

Ruben Somsen Yeah.

31:52

Aaron van Wirdum At least when it comes to hosting Lightning channels.

31:55

Ruben Somsen Yeah.

31:56

Aaron van Wirdum How do they relate to each other? Why are state chains that much better?

32:00

Ruben Somsen Yeah, so it's kind of a different problem, right? Where the payment pool can actually work on top of the state chain. So... With a payment pool, at least like I think the scenario you guys described was where you kind of go on-chain periodically. So you have a UTXO. It's controlled by, let's say, 10 people. And when one of them wants to pay, you go on-chain with all 10 people cooperating. And you send a little bit of money out. And that money came from kind of the inside of the pool from that one person. But from the outside, you just see a single UTXO paying a little bit and sending it to another UTXO. moments of going on chain can be completely off chain now that that would be the state chain

32:40

Aaron van Wirdum but that can happen with payment pools as well

32:42

Ruben Somsen right but then uh once you do that so you could then you would have basically a lightning channel factory right where and so then the first thing is you can only pay people that are inside of the pool Or you have to have a lightning channel with enough liquidity and route it through the lightning network. So then you go back into the lightning limitations. So even there, you have a limit that you're hitting that is not really there with state chains. Although, obviously, you have a trade-off of trusting a federation. So you don't get that for free. But you really have total freedom with where to send your money on a state chain.

33:18

Sjors Provoost Yeah, that sounds like a main big difference, right? So we talked about these payment pools before. So you cannot simply move money out of it without doing something on-chain or with Lightning.

33:31

Aaron van Wirdum No, but you can send it to people who are not in the payment pool. They just got to join then. So that's sort of similar benefits.

33:39

Ruben Somsen That's an on-chain action. You can't join off-chain. There's no way of joining a payment pool off-chain. That's not possible.

33:46

Aaron van Wirdum I think there is. Yeah, you can pay someone.

33:49

Sjors Provoost Maybe we have to re-listen to our own episode.

33:52

Aaron van Wirdum No, I'm pretty sure that's possible. You can just let someone join.

33:54

Ruben Somsen I don't think so, because you have a multisig, and they're not part of the multisig. They don't have the key.

33:59

Aaron van Wirdum No, but they are in the new version.

34:01

Ruben Somsen Yeah, but then you have to go on-chain to put them in the new version.

34:04

Aaron van Wirdum I don't think so.

34:05

Ruben Somsen There's nothing on-chain that gives them ownership. If nothing happens on-chain, they won't be in the UTXO. Who controls the UTXO? Well, it's not that person, right?

34:16

Aaron van Wirdum No, but they are... Okay, so Sjors and me, we're in this payment pool, right? Yeah. So we got a shared UTXO. Okay, then we now want to pay you. We both have, I don't know, I have two Bitcoins, Sjors is one. Now I want to pay you one, so we both have three in the new payment pool. Yeah. So we create a new multi-sig, where you are also part of it now. And we distribute it in such a way that we all have one Bitcoin. And we do this through eltoo. So we can do it off-chain, and now you're part of the pool, and we did it all off-chain.

34:49

Ruben Somsen Okay, so let's say I'm part of the pool now.

34:51

Aaron van Wirdum This is not about statechains at all anymore, by the way, but that's fine.

34:54

Ruben Somsen No, no, it's still related. I can bring it back to statechains. Okay, so now the question is, okay, so you brought me in off-chain, but now who owns the UTXO on the blockchain? What is the script there?

35:08

Sjors Provoost Well, that's basically this off-chain transaction that you have. You can send it to the blockchain. And then you have a coin.

35:16

Ruben Somsen Yeah, but you can...

35:17

Sjors Provoost It's a funding transaction.

35:18

Ruben Somsen Yeah, but you can update... Who can update that funding transaction?

35:23

Sjors Provoost Well, the funding transaction is already on the blockchain, so nobody can update it.

35:26

Ruben Somsen So the same way you added me... The same way you added me to the pool, you can also un-add me, because you guys control that key. I don't control it.

35:37

Aaron van Wirdum Yeah, we still control the Schnorr, the original Taproot.

35:42

Ruben Somsen Yeah.

35:43

Sjors Provoost Yeah.

35:45

Ruben Somsen So that's where the pool party ends, I'm afraid.

35:48

Aaron van Wirdum I think you might be right.

35:50

Sjors Provoost If we are right, collectively, then you can sum up some of the differences, saying, okay, with state chains you can add arbitrary people without doing anything on-chain, but you need to trust server-ish, and with both of them you can do lightning channels inside of it, so that's kind of cool. Yeah, what else? So there's one thing. You can compare it with, you know, you can go all the way from a custodial wallet where you have some trust. You have complete trust, but account balances can be moved completely arbitrarily and people can receive Bitcoin by getting an email without any on-chain action if they trust that model. Or they can take it out until it goes Ponzi. And then, you know, you go to a federated sidechain where... you trust the federation to actually give you your money back. But within that system, you can move arbitrarily and you can send it to people who are new. You can send liquid, for example, to any person on the planet as long as they create a wallet for that. They can then withdraw it with some restrictions, but they can do it. And with state chains, you can also send it to arbitrary people. And then... Right. With the coin pools, you cannot send it to arbitrary people. That's right. So that's kind of where it goes down. And with Lightning, you most certainly can't send to arbitrary people because you also need to have inbound capacity to receive. So that's another barrier, but it's completely trustless. Yeah. Well, yeah.

37:17

Ruben Somsen Yeah, that's absolutely right.

37:19

Sjors Provoost You need to be vigilant with Lightning, right? So that's a big trade-off. You can't just go to bed and ignore what's happening on the chain in Lightning. So on -chain, you get it, it's yours, and you're done.

37:29

Ruben Somsen Well, so I would have to add that with statechains, that there's a similarity there, right, where you do have to watch for Alice. Like if Bob receives the statechain off-chain, you think so, Alice can still send her transaction to the blockchain, and then Bob has to override it. So Bob does have to check the blockchain once a week. or so.

37:47

Sjors Provoost So that's similar. This is what I was trying to get to the point of how complicated is your actual wallet and node that are going to be to do this. So we know lightning software is not simple. It has to watch a whole bunch of things. And we discussed this with the coin pools as well. You probably need lightning -ish kind of complexity to move money around and see which of your pool, your co -poolers are actually there and make sure that all stays synced. So if you have to build the complexity anyway, I would imagine people will just use lightning because that complexity is already built. And I think with state chains, you have maybe similar complexity, maybe less because you can stop paying attention when you're done.

38:24

Ruben Somsen yeah there's a there's the interesting thing is there's a lot of overlap with how lightning works so i think a lot of the stuff that's being built for lightning will be operational for state chains for instance watch towers right so there are all these proposals to have other people look at the blockchain on your behalf and send a certain transaction when something occurs and that exact same model would apply here for instance well

38:47

Sjors Provoost that applies to what i said before too right so yeah you can reuse a lot of the complex software that's already out there yeah especially if there are good generic libraries. But it's not a completely existing software package here. No, no. Somebody has to make it.

39:00

Ruben Somsen There's a lot of work that needs to be done. So it's always

39:02

Sjors Provoost easy to use a software package that's already there.

39:04

Ruben Somsen Yeah. So there is one point that I want to go back to, which is the payment pool example where Aaron was saying, okay, let's add Ruben into the pool. So one way you can do that is through statechain. So if inside of the payment pool, the aaron's utxo is actually controlled by the state chain then through the state chain inside of the pool you could give me that one bitcoin and you would not need Sjors to cooperate with you in order to do so so this is a subtle point but kind of an important one and it's very specific to kind of what we're getting at with the whole payment pool limitation of a you can't add new people b you have to cooperate with everybody to do so so if if instead of the payment pool your key is actually controlled by a state chain you are free to move that coin however you like without the other payment pool participants having to get involved so that's a kind of a Important point, but I think a difficult one to grasp. So hopefully it's clear.

40:05

Sjors Provoost It's a lot of layers.

40:07

Ruben Somsen Yes, it's a lot of layers.

40:08

Sjors Provoost Especially because you can nest this stuff forever. You have state chains inside of coin pools, inside of state chains, inside of lightning channels.

40:15

Ruben Somsen That's right.

40:16

Sjors Provoost Aaron, do you think we have more questions to ask this time?

40:19

Aaron van Wirdum That's enough nests for me, Sjors.

40:22

Sjors Provoost Okay, in that case I'll say thank you for listening to the Van Wirdum Sjorsnado Special Somsen Edition. Yeah, there you go.