L2^2: multi-chain L2 settlement

ETHCC 7 · 10 Jul 2024 · 18:27

Avihu Levy explores L2^2, a design in which one Starknet-style layer 2 settles to both Bitcoin and Ethereum. He lists three motivations for an L2, scalability, expressibility and global state, and says Bitcoin lacks the last two. He assumes the OP_CAT proposal is accepted, since he says it enables holding state and verifying STARK proofs on Bitcoin. He compares options such as a trustless bridge or separate L2s, weighing Bitcoin maximalists, wizards and degens, then proposes a symmetric finality rule where pending state must match on both chains and expires. He says it could extend to N layer 1s.

Speakers

Topics

From ETHCC 7, hosted by Ethereum France.

Transcript

Um today I'm going to present a concept that I call L2 Square. What am I going to talk about? So the first thing, and it's an important part, is I'm gonna chit-chat a bit about the motivation for an L2, particularly the motivation on L2 on different L1s and Bitcoin. Um I really want to mention at least why an L2 on Bitcoin is relevant, why it's relevant now, and why Starknet is a great fit for it. And then uh we'll explore a bit the solution space for what we want to do.

And at the very end, I will get to the concept of L2 Square and why is it interesting, what problems does it have, and basically guide you and myself through this rabbit hole. Okay, so um when people are thinking about L2, the motivation for L2, they usually think about uh scalability. But I claim that scalability is a very simple and well understood uh motivation, yet there are other two things that uh people should focus on. Uh the second one that is sometimes uh unclear even for Ethereum people is expressibility.

I will explain in a second what does it mean. And then there is another tricky one that Ethereum people wouldn't notice because usually they are just used to have it. So on Ethereum L2s, they treat they they don't need to take care of global state because Ethereum already got that. But they do need to treat, I claim they do need to uh to threat expressibility. So, what is expressibility? It's basically expanding the language and capabilities of the base protocol. So I'll give some examples.

Um Ethereum, you don't have account abstraction as the on the base layer, you can expand it to it, but you don't have it right away. And some L2s are focused on just let's reproduce the exact EVM but more scalable version of it. Um in Starknet and with Cairo, we are focusing also on expanding the expressibility of the base layer. And while on Ethereum it's uh a possibility but not but not a necessity, on Bitcoin, we really want to get all three. So scalability it's pretty clear why.

Um expressibility is because writing logic in Bitcoin is very, very limited and very, very hard. And we basically want to open the door for more developers and more applications and more logic. And the way to do it is really opening the door to more uh programming languages, more capabilities. Um an L2 is a very good opportunity to achieve exactly that without expanding too much the security assumption. And what is a global state? So think about the fact that um first of all on Bitcoin, unlike Ethereum, you don't have one single state that everyone can access.

You're very used to it when you write smart contract that every user can see variables from other that were changed by other users, that nothing doesn't have to be sequential, but on Bitcoin, this is not the case. On Bitcoin, usually transactions can't access some global state, and in particular, they also have like a sequentiality issue. Okay, why do we care about L2 on Bitcoin? So those numbers are uh from probably a week ago, so they're a bit different from what it is now. Um, but it's still mind-blowing because if you look on the market cap of Bitcoin, it's over a trillion dollars, it's a trillion and a quarter.

And at the same time, if you look at how many bitcoins or how many dollars are in any, and I'm being very, very flexible here. Any L2, any scalability solution, this one here is wrapped Bitcoin or WBTC. This one over there is Lightning Network, altogether it doesn't get to 1% of the total uh Bitcoin market cap, which is crazy. And if I just look at Lightning, this is like such a small number, 300 million dollars compared to a trillion. So it's definitely Bitcoin is definitely not there.

If I compare those numbers to Ethereum, by the way, you'll see that on Ethereum, even on the just on the L2s that are listed on L2Bit, it's over 10%. Okay. Um I've been told I need to explain this. So why why do we talk about L2s on Bitcoin right now? Why didn't we talk about it three or four years ago the same way we are now? Well, um so in Bitcoin, there is a very because there is a very limited uh programming capability, we are also missing some basic uh elements, and one of them is opcat, which is basically the ability to concatenate uh two elements on the stack. Now, I'm not going to explain it.

If you want, you can come to my talk later today. But at this point, you will just to believe me that if we would have string element concatenation on Bitcoin, we would be able to do amazing things, and L2s in particular. Um, so sometimes it's hard to believe for people from regular uh programming languages, but yes, this capability concatenating elements is what you need to enable L2s. I'm gonna I'm not going to get into how, but I'm just gonna say that from now on, I'm going to assume that we have opcat a proposal for opcut will be accepted, and I'm going to talk based on this. So, what opcut enables is one thing to hold state on Bitcoin.

You remember this global state I was mentioning earlier, it's very much needed. I want to be able to do load and store for elements in my contract. And it also enables to verify Stark proofs. And the reason that Stark proofs are particularly uh efficient on Bitcoin or the verification of those is because they are first of all hash-based with opco that exists on Ethereum. They our flavor of Stark, uh, what we call STU is also working by chance on the same field size that Bitcoin can handle arithmetics, and it also operates over Cairo and not EVM, and for some Bitcoin people, this is an important part, not to be uh bound to a different uh L1 VM. Okay, so this is just a graph that shows the um well what requires what, and the dashed line is because you can also do smart contracts on Bitcoin just with opcut with end state without Stark, but Starks makes the life much easier.

And if you have smart contracts and stack verification, then well, you could have a Bitcoin L2, sorry. Okay. So what are we trying to achieve? For me, it's very important to take a look at what are we trying to achieve from the perspective of the users. So we want an L2 on Bitcoin. We also have L2s on Ethereum. And most of the world in our mind is made up from characters that live on both Bitcoin and Ethereum with different flavors. So at least conceptually, in our mind, there are like three characters that we are going to look at.

There are the maxes, the Bitcoin Maxis. The ideology is basically Bitcoin only. They don't care about Ethereum, they don't trust Ethereum. And therefore they also don't really care about fragmentation on Ethereum. There are the wizards, which uh represented here by Eric Wall. And you don't need to read the text just for me. And they care about both Bitcoin and Ethereum, but the ideology explicitly will also include uh Bitcoin. They don't want things just on Ethereum. Um, they probably trust both L1s, they not necessarily trust the L2 consensus.

And then we have D-Gens uh such as Lawrence Day um representing here, and they honestly don't care so much about ideology, or at least sorry, Lawrence if I misinterpret you. Um, but they really want to be able to trade as many assets as possible with as little fragmentation as possible. Okay, so I'm going to iterate real quick because of the short time on the well, a list of potential solutions, and I'm going to explain them very, very little, but mainly get to the to the last one that I think will potentially satisfy the highest number of users. Checking the time.

Okay. So the simplest one, and maybe some of you heard about it, is uh to say, okay, let's create a trustless bridge between Bitcoin and Ethereum. Basically, take Bitcoin assets, which means BTC, and trustlessly create a bridge between Bitcoin and Ethereum, and then use this bridge to also transfer assets to Starknet. And voila, you got a scalable solution for bitcoins, which is great. And the way that this would work is that you'd need a Bitcoin light client verifier on the Ethereum side to be able to say, hey, Bob actually transferred one Bitcoin to this bridge. And you would also need an Ethereum light client on the Bitcoin side because you would want to say Alice received this uh Bitcoin from Bob and burn it to receive it back on the Bitcoin side.

The problem with this solution, I would say the main problem is around the mistrust or ideology of Bitcoiners to accept something of that sort. Because while it's um while it's potentially scaling Bitcoin payments, it's not really running on top of the Bitcoin network, it's running directly on Ethereum, which will be an issue or potential issue for some of those users. So we can talk about a different solution, which will be let's just put an L2 on Bitcoin and a separate N2 on Ethereum, and then whenever we want to transfer asset, we will use a bridge. And the rest of the time we will just have scalability for Bitcoin asset on one side, the ability to create new assets on Bitcoin as well.

This is from Starknet 2. And Starknet 1 will be basically an L2 on Ethereum. Well, here the Bitcoin maxis they will be satisfied, but the problem arise because we create fragmentation. So now it's not just fragmentation between different L2s on the same L1, but it's actually fragmentation between different L1s, and then maybe the maxis will be happy, but everyone else will be slightly disappointed. But instead we maintain the bridge on L2.

What you earn by this is well, it's first of all much less expensive, and second, you can transfer uh some some native assets that you cannot create directly on the L1 on Bitcoin. So this is like okay solution, but it still has fragmentation. And this is what brings us to a proposal. And I'm telling I'm saying I'm stating it in advance. This is like uh rabbit hole meaning maybe this proposal works and it's good and it has advantages, but it still needs a lot of exploration uh into it. So, what does this solution mean?

It basically means we have one L2, and this L2 has a trustless bridge capabilities to both Ethereum and Bitcoin at the same time, and it can settle to both Ethereum and Bitcoin. So it doesn't even necessarily have one chain that dictates the consensus, it can choose at each time which chain will be dictating its consensus, which is pretty cool. And in this case, I think maybe, well, it's a very big maybe, but maybe we manage to make all users happy. Okay, so uh the the simple uh the one interesting fact about it um about L2 square.

Oh sorry, I maybe missed some slide here. Oh yeah. So I just wanted um skip this one for now. I just want to say that um how much time do I have? I want to explain two problems with it and their solution. Let's see. So um one problem if you do the that if you want to have just one L2 that settles to both Bitcoin and Ethereum, is the following. If you if you just verify Starknet uh execution on both and L1s, then the L1s know that there is no fraud in the L2. But what it doesn't know in this case is what messages the other L1 received.

So for example, uh let's say there is an evil operator and you want to trick Bitcoin users. So what it could do in this case is it could say it can't forge execution on Starknet because this is 100% proven. But what it can forge, because the Bitcoin network in this case doesn't see Ethereum, you could say, hey, look, I deposited 1000 ETH on the Ethereum network, and then please credit me this 1000 ETH on Starknet, and then I'm going to swap those thousand ETH with Bitcoin and withdraw it on the Bitcoin side. And from the Starknet point of view, it's legitimate.

Um it won't be passing on Ethereum because on Ethereum you can check those messages, but potentially it could pass on the Bitcoin side. And this is a dangerous case for Bitcoin users that mix both tokens. So the cool solution for it is that inside Starknet, we run both a Bitcoin light client and an Ethereum light client. And what this enables, it's actually two things. First of all, now both the Bitcoin network and the Ethereum network are well aware of what is happening in the other network from the perspective of messages. So you can show them that all the messages that you are consuming on one side, you can show them to the other side, which is pretty cool.

But in fact, it also brings this mind-blowing opportunity, which is because this Starknet L2 settles on L1, then now Starknet alone can inspect its previous settlement, which means that by running Starknet alone, it is able to rec you are able to recognize all the messages to it to Starknet and the previous finality of Starknet. So this gives you potentially the ability not to run L1 and just L2 and still get the L1 finality, which is kind of crazy, and I see it as some sort of inception. I got a sign of like the one minute.

So I'm gonna run real quick on this, and I'm just gonna say that there is also this cool question of how do you do finality on both chains? And the problem is, of course, that you may have a state that is different on both chains, which is an issue where you don't want to get to this. And one there are a couple of interesting solutions, but one solution that is very nice and very symmetric is to say, okay, I always have the latest status pending. And my rule of consensus is that the latest pending state doesn't matter for anything. But when I want to move forward from the latest pending state, I always have to show that the pending state is the same on both networks.

And then if you use that plus a very simple timeout for pending state, then you always either get to the same finalized state or you have different pending state, but then they will expire and you can set a new state. So that's a pretty cool idea because it means that you have a full symmetry of the L1s to the same L2. Um here is what we talked about today. Why do we need an L2? Why Bitcoin now? Why starting on Bitcoin? What are different users' wants and what are the possible solutions and how would L2 work?

I didn't get into, but it's very interesting to talk about. How do you do escape patch? How do you make sure for Bitcoiners that doesn't matter what is happening on Ethereum, their bitcoins are safe and they can take them out? It's a very interesting direction to look into. How do you satisfy data availability requirements for both Bitcoiners and Ethereum people? And also this concept is possible to expand to extend, sorry, for more than just two. You can do L2 to the power of N with N different L1s if you care about those. And I think things might work roughly the same way.

And to just add a quick uh final note. So those are our Bitcoin plans uh that are coming for Starknet. We have a $1 million fund to just do research for and against OPCAT activation. We have a very cool GitHub repo for those of you who are either zero-knowledge researchers or developers and want to explore what we already did. We have a cool repo called Bitcoin Wildlife Sanctuary, and we develop there all kinds of elements that can work on Bitcoin with Opcat, and I don't think they have never seen before. And in particular, we have a STU verifier there in the work, which will be ready soon.

Also smart contract and so on, skipping all that. At the end of the day, when an Opcat, when and if Opcat will a proposal.

Related talks