Towards Hybrid L2s by Alexei Zamyatin

ETHDubai 2024 · 20 Apr 2024 · 28:23

Alexei Zamyatin explores hybrid layer 2 designs.

Speakers

Topics

From ETHDubai 2024, hosted by DeFi Dubai.

Transcript

all right hey everyone I'm alexe I'm the co-founder of Bob and I'll be talking about hybrid leer twos um for the few people who are interested so we've seen an emergence of Lear twos on ethereum right everybody can spin up using conduits Caldera it takes you like 5 minutes and you're good to go but with the emergence of Bitcoin layer 2 is in the last kind of couple of months we've seen more and more interest of people to go back to bitcoin what we want to explore is okay is there a way for us to combine The Best of Both Worlds build something on the intersection of ethereum and Bitcoin trying to combine security but also liquidity and to explore what the benefits could be so

why why even look at Bitcoin right obviously this is an E2 buy conference so why is a guy here on stage talking about BDC well Bitcoin has over 300 million users it's the most widly ad up to digital asset in the world and if you look outside of our web3 bubble it's usually picked when that people actually experiment with and over the last 10 years what we experienced is well 90% of people get into crypto through Bitcoin but then they leave and they start building things on ethereum and l2s and l1s because they cannot do all these cool things on the pcoin based layer and what we want to experiment with and explore if we can do is well is there a way for us to create a rollup ecosystem around Bitcoin that will allow us to bring

functionality back to BDC and offer a product that does not require me understanding what ethereum is and just is much easier to distribute globally because ultimately outside of crypto if people talk about you know the price is going up if they talk about crypto they always talk about Bitcoin now building a Bitcoin later to is is actually quite tricky there's a reason why none exists today it's because it's not really possible with the technology we have now but with the latest Innovations on the Bitcoin side we're actually getting very very close but taking a step back right I mean you see a lot of like Bitcoin L 2s coming out and we've seen attempts by root stocks Stacks liquid but the one

thing that people forget is there's like three problems the Bitcoin problem which is quite tricky how do I get Bitcoin security how do I get Bitcoin into my Layer Two just like arbitrum has native ethereum and has ethereum security but then there's two others there's the ecosystem problem and there's a liquidity problem the ecosystem problem means well you need to provide users with best-in-class infrastructure in tooling so we could go and you know tell people go use Bitcoin script but that's not going to work it's very clunky it's very limited and it's just so poorly documented the funny thing is what people don't know is actually you can write any program in Bitcoin script you can do any smart contract it's universally you know compatible you can build T and complete things in script but the size of the Pickin transactions

and blocks just does not permit that because script is so basic you know instead of using solidity using like an almost assembly like language so we could tell people you know okay we're going to increase the block size now you can use script people try that of course it doesn't work because it's just hard to use and then that's where for example evm obviously has a massive Advantage but then there's the other problem that's liquidity right Bitcoin has a lot of liquidity in the native BDC asset we've now seen your runes b20s all these other tokens but realistically speaking the actual assets that people want are stable coins and they just do not exist on the Bitcoin layer Tron uh us the tether actually started on bitcoin and then moved away because it was so inefficient so we

could tell people sure here's a Bitcoin layer too you know it inherits security you maybe have some good tooling maybe even you manage to squeeze the evm in but if you have no liquidity you have nothing else to do with your Bitcoin nobody's going to use it and again we've seen that over and over again if you launch an isolation it's you're going to have a very hard time actually competing with other networks and so the idea is well can we perhaps build something that eventually will be secured by Bitcoin and ethereum at the same time integrates with the Bitcoin stack and the technology that we've seen created on bitcoin for the last 10 15 years really lightning noer ordinals BC's runes all these new assets that are coming out on

the Bitcoin um Network and there is a lot of interest I mean Franklin templon tweeted about runes and wrote a report about runes which which is basically the E20 version of Bitcoin so stuff is happening there but at the same time we want to bring new developers we want to allow people to start quickly you don't want to tell a evm smart contract developer well you know you have to first learn about what the utxo is you have to understand how these things work there's no toolings you have to build your own so we want to actually embrace the evm and for example this is what we do at Bob we try to combine Bitcoin with ethereum we try to be as compatible as possible possible with the ethereum stack so for example you take the op stack you use the evm as smart contract

layer and then you start customizing it and then you start building infrastructure around that in theory can be applied to any other layer to that arbitrum or polygon but makes this much easier to interface with Bitcoin so you build things like uh the Bob SDK which gives you a few tools so for example it gives you a way to read every single Bitcoin transaction from your smart contract so using something called a Bitcoin like client so the same thing that you would have on your phone when you have a Bitcoin wallet you can build this at a smart contract so this thing reads every single Bitcoin block header and allows you to check well did a certain transaction happen we can also do things like integrating Bitcoin into metam mask we've seen that metam mask snaps already

exist what we built is a metam mask snap that also allows it to hold Bitcoin but also ruins orinal b20s in your metam mask wallet so essentially trying to unify The Experience get Bitcoin holders to start experimenting M menting and actually using this new tech like things that are new to them it's very like normal to us to have like evm smart accounts and dexes and so on but that does not exist on bitcoin so the goal is okay create a unified experience where it's easy for me to get my Bitcoin into the system and at the same time for an evm developer to easily deploy products and start making them available to this wide community that is just currently sitting on centralized exchanges and cannot do anything else now the question is how do we actually go about this because as

mentioned Bitcoin layer 2s did not exist yet and I'm going to walk you through like the steps in terms of technological development that we see happening now over the last couple of months in the next 12 months to really get to a point where we might have optimistic Roll-Ups on bitcoin so if I were to build this and that's actually what we're doing on Bob so of course we're biased but usually would want to start with an ethol up why because that gives you access to liquidity it gives you access to Native stable coins on and off ramps all these things that matter on the product side that you simply do not have on bit but then at the same time what you want is you want to have things like a Bitcoin like L and different types of Bitcoin Bridges so DB wbdc tbtc that

allow you to get Bitcoin into the system but you have to make it very easy so unify the wallet experience don't send users to five different Bridge interfaces have one Gateway for people to deploy Bitcoin and then be able to access it in The metam Mask ideally even plug in like coinbase wallet already supports Bitcoin and there'll be more and more multichain browser wallets that make this available the cool thing here is is and look this is a super simple kind of bootstrapping technique you start as an EB but you actually build Bitcoin products so now you can build things like a peer-to-peer swap so I can have people swapping ordinal or b20s or Bitcoin against any ec20 asset and what we can do is we use so-called again like clients so if I want to swap some usdc

against your Bitcoin I would lock up usdc in the smart contract and submit my Bitcoin accounts this can be done directly from a Madeas wallet by now and then whoever wants to do the trade with me just sends the Bitcoin and then the smart contract accepts a proof that you actually made a Bitcoin transaction this can be abstracted away from the user you can have relayer Services user interfaces that just take the proofs from the Bitcoin chain and plug it into the contract and what happens next is the Smart contract verifies that hey this is actually a miracle proof for a block header that I have verified and I know that this is the longest chain that I've seen so now here you can have your usdc because you actually completed a Bitcoin transaction and this actually works in practice and this is the easiest way for people to actually swap

Bitcoin against usdt usdc ordinals for Bitcoin ruines for Bitcoin uh ruines for USC 20s and the goal here is well the Bitcoin Community is still rather small right and when I talk about Bitcoin Community I'm talking about probably the half a million users that are very active in ordinals Ruins trying to build new things because there's been a paradigm shift people now really excited to build on bitcoin it's okay again to experiment but at the same time we have have 30 m met mask users that you know they have 40 different ethal tools that all kind of do the same and they have Bitcoin somewhere on their Ledger and now what we want to allow is to actually the 30 mil metam mask users to get the Bitcoin into the metam mask and then start doing stuff with it so that's easy right and then obviously we need to

bring in Bitcoin security because ultimately if we don't have Bitcoin security is just another ethereum layer too that you know maybe specializes in Bitcoin tooling and the way we can do this is using something called merg mining now I'll this is a slightly complicated image I'll walk you through the steps so normally a rollup on ethereum if we go the optimistic way works as follows you have blocks sequenced every two seconds so the sequencer you know collects the transactions builds the block and then every minute you would post the da commitments to eth or somewhere else now what we now do is before posting the data to ethereum we give it to the Bitcoin minor so the Bitcoin miners run full nodes for the ler two validate all the

transactions and if they're valid they do something called merged mining now merged mining is a very very old concept it was invented by Satoshi Nakamura himself with the vision ofate doing two things preventing fragmentation of hash across 50 different new chains where miners would have to choose their M Bitcoin or something else and at the same time enable side chains so the whole vision of bit coin and Satoshi cell is actually well you know we will have experimentation can we create this in a way that actually also benefits Bitcoin and I'll explain exactly how it works but think of it this way merge mining is the grandfather of reaking Bitcoin miners can run Bitcoin mining Hardware they mine Bitcoin but at the

same time they use the hash rate to also secure the hybrid layer too which means that to now attack the system you not only need to attack the sequence concern and prevent propers happening on ethereum you also have to attack the majority of the Bitcoin moders that are actively participating in this merge miningbitcoin reaking protocol and right now today on some altcoins like rootstock namecoin and so on we see 60% of the Bitcoin hash already doing this and in fact because we work with almost all the large mining pools we'll see this number going up to 89% over the next year and I'll explain why now briefly you know to talk about merge mining this is slightly more technical

talk here um the way it works on the example of namecoin namecoin was a first altcoin and the first coin to introduce merge mining it was also the first cross-chain concept ever designed what namecoin would do is namecoin would create its block which would reference a previous block it would have like a coinbase transaction all the other transactions in there but it would not yet have its own profer work so this is basically the block template and then the miners would hash this part above that commits to all the namecoin transactions but they don't do proof of work over that they include it as data into the Bitcoin block they're currently mining on and then when they find a proof of work solution

that is suitable and diff and hard enough they would send this kind of data this block hash and um the proof that this data is in the Bitcoin block back to the nameco network and then nameco full nodes would check okay look we have this namecoin block we have this Bitcoin block and actually they're linked and now I know that there was proof of work made over namecoin because now if you would want to attack this you would have to actually do the same proof of work level that Bitcoin is actually doing and the way it works is you can actually be very variable with the difficulty so you don't have to wait for 10 minutes for every single block to arrive you can actually go much much faster depending on what your target

block time is there's a limit you can go as fast as 1 minute without starting to break the consensus as opposed to proof of stake where you can go much much faster than that um so what you have is if you look at this very kind of simplify graph here you have the difficulty Target for Bitcoin Which is higher than for namecoin namecoin had faster block times and then you would every time you'd find a Bitcoin block it would implicitly be a namecoin block but you could find multiple blocks in between a namecoin that accept the proof of work from Bitcoin even if you don't actually see a Bitcoin block now this is cool this is not new this has existed for over 10 years years like rootstock has been doing this but there's one problem with this design if you require every single block to have proof of work

over it you actually are limited by the throughput because you cannot go faster than 30 seconds probably even 1 minute without starting to see shallow Forks so where miners find a solution within a short period of time and then due to network latency they just continue mining obviously because they don't want to lose even a nanc of mining curent of operation so they just continue mining the moment they find a block they fire it out and they continue mining on their own chain they don't wait to see if somebody else did something at the same time and if you go below a certain time limit there's good academic research that shows you start getting forks and that destabilizes the network and that's why for almost all of the merge mind chains today they have like one minute block times which makes it completely

unusable for any modern with 3i use cases so what we can do is we can apply the same hybrid consensus design that we see on E rabs to merge mining so what we would do is instead of having miners validate every single block and merge mine the every single block what we do is we have a we introduce a sequencer which as you can see is already going in the direction of ler 2os you have a sequencer that basically optimistically pre-produce the blocks pre- signs them and then the miner only merge mines on every hundred blocks so what happens in practice is a sequencer is constantly collecting transaction proposing blocks the minor constantly runs a full node and actually constantly just fetches the latest data

but because a proof of work Target is set to have like that a block happens once per minute or like a solution is f once per minute you basically always commit to let's say the last 100 blocks and you basically now have a trilling finality Gadget you pre-produce 100 blocks you have very fast use experience you can do defi basically can plug an OP stack or arbitrum into this but then every minute you actually get bitcoin's perer work over this over this kind of chain which gives you the combination of very high security Fork resistance much faster finalization in practice but still fast block times and then if you plug this back in into our hybrid kind of rollup road map what you get is again very fast block times every few minute every minute you get the

proof of work and then on the E L1 level we will modify the contract to actually check if the proof of work has been done so if there's no proof of work the day commitment is not accepted and then you can of course balance the security between the sequencers and the miners you can say well okay we there's a maximum time out of 10 minutes before we stop accepting day commitments or you basically allow miners even to Fork the chain which can be implemented so you could also say that the miners can actually Fork out the sequencer if the sequencers misbehaving this is a kind of parameter that you need to balance between do I trust the sequencers more or do I trust the Bitcoin miners more arguably you know instead of trusting one sequencer you would rather give miners more power to actually for work

out a malicious sequence that is trying to produce things but you might not you might not have to do that because obviously an ethereum may have fraud proofs now the benefit that we get here is a security as mentioned you now need to attack the sequencer sensor propers on ethereum but at the same time you need to prevent them you need to corrupt the majority of the Bitcoin mining power because they actually see what you're doing and without their sign off using proof of work you cannot post it to ethereum but they also see that it's happening so they can also just challenge you on E if you're not posting any day commitments they have all the data it also gives you economic alignment with Bitcoin we might not care about there's a lot on ethereum um I personally do care because I think if

Bitcoin falls apart everything else falls apart and essentially we had the Bitcoin having yesterday night we'll have the next one in four years this one will probably wipe out a few small miners in four years we might say a wipe out of some of the big ones and that's actually why almost all the bitco miners that's currently are looking into Innovation they actually work with us to do merge mining on this new concept and then the actually interesting thing for ethereum because it's an e conference what this does for the euser it gives you faster withdrawals because now instead of waiting for 7even days to receive a challenge we can actually after a few minutes be certain that there is no way that this will Fork because you'd actually have to corrupt the majority of the Bitcoin mining power

so what you're doing basically is you're timestamping the state of the roll up to bitcoin and that gives you withdrawals back to the L eel one within a few minutes still too slow for the user but arguably much better for liquidity bridges that now don't have to wait for seven days but that can rotate their liquidity every few minutes and then last but not least and I know we're already kind of short on time so rush over this this is probably actually the most interesting part of the talk bit VM so bit VM you know there been a lot of hype around it people actually you know very few people know what this actually does it was initially presented as smart contracts on bitcoin it's not smart contracts bit VM is a way to do optimistic execution of programs

arbitrary ex computation offchain and then doing challenges onchain and obviously we're at an ethereum conference everybody knows well this sounds very familiar this is like arbitrum but on bitcoin and that's exactly what bit VM does so bit VM takes the idea of taking programs off chain running it and this can be an L2 this can be an addition program like like in this case um and then basically only committing a part of the data to bitcoin right why do we do offchain computation in arbitrum because it's too expensive to actually do all these things on the eel one so we take the computation of chain and then one option is to do zik proofs right but there are some limitations there the other option is okay we take the program

we break it down into its bare components like here so for example you can take any program and you can break it down into nand Gates because nand allows it to create any program by chaining them together and then what you would do on bitcoin is you would take a Merkel tree or a so-called taper tree and you would basically create a circuit and you would represent the circuit that basically can be any program you would place it in a tree and the cool thing is that the root of this Merkel tree commits to that program so now if I change any piece of the program the root will change and that's the same concept we obviously use with transaction inclusion proofs and so on

now the cool thing is again similar as arbitrum you and I for example we will commit to execute a certain program we will post this hash on chain we will do a lot of pre-sign transaction and that's the difference between arbitr and Bitcoin and Bitcoin we have to work with pre-signing certain transactions there has to be certain ways of spending this so how it looks like let's say we want to build a bridge using bit VM we have 10 people they that we trust or we have a thousand people that's even better they create a setup they basically all together have an N of n multisig where at least one person needs to be honest and burn the key cuz if one person has burned the key you can no longer spend from that deposit so that's unsp unless you have a pre-signed transaction and then you have let's say

50 operators that get pre-signed transactions during the setup and these transactions allow them to withdraw a certain amount from the bridge deposit but then there's an additional set of pre-sign transaction that allows anyone on bitcoin to challenge the operator by asking the operator to reveal a certain part of the program essentially in this tree and then you can easily prove in Bitcoin script that actually the operator changed a certain part of the program if they get a different result so if we take a very simple example let's say we have an addition program everybody knows 1 plus 1 should be two if the operator says it's three obviously we all off chain know that that's not correct so now what

will say is okay wait a second that can't be right Challenge in a onchain Bitcoin transaction um and we know that the operator is cheating because the operator announced hey I made this computation I want to withdraw the Bitcoin out as payment for example now what we will do is we will take that transaction and we will challenge it and then the operator has to respond by revealing part of this tree and it's actually a bit more complex there's actually two other Merle trees that you kind of tie together but simplifying the operator has to respond by showing a part of his program and if that program is if that part is it correct I can slash it and then there's two designs as bit V mv1 which uses the same bisection style protocol like arbitrum where I

will check part one part eight part four part five and ultimately by jumping back and forth I will Zero in on the exact place where the operator must have modified the program now obviously 99% of the cases we don't need to do that because if somebody's misbehaving they just try to steal but if they're smart and they try to encode like change only one bit in the program to really change the behavior if they're really smart about it we will still find it and what we will do is we will invalidate the Bitcoin transaction and kick the operator out and this in a very complicated way because it is all implemented in Bitcoin script and enforced by all Bitcoin full nodes gives us optimistic robs on bitcoin this is very new the first paper came out in

December there is bit BNB 2 which actually is a bit more more efficient um and we expect probably that we'll have a prototype by the end of the year and then towards probably 12 months from now on we actually expect to see first onchain deployment this is not going to be easy to use so this is if we build a bridge using this design it will not be something that a user would go and say hey like I want to bridge in Bridge out there's a few limitations like only fix deposit sizes so you can only create like different bit setups we like always 10 Bitcoin sorry for that so what you will see is you'll see liquidity St pulled bridges on top of that and just users swapping in swapping out but under the Hood you have this guarantee that

you can always exit back to bitcoin which is something we've never had before and the best thing is this does not require a fork so we don't need to change Bitcoin and we can get to an optimistic style rollup using this kind of Technology now what does this give us in our hybrid Ro weap design because ultimately we can build this on bitcoin but again we solve the Bitcoin bridge problem we Sol the security problem but we haven't solved the ecosystem and liquidity problem yet because again I can put this on bitcoin but how do I get stable coins in how do I actually get users sure I can beg usdt and and pay them like what $50 million currently is the price to get T3 PL natively doesn't really work so what we would do is we would say okay now we move settlement

from ethereum over to bitcoin we have the fra proofs occur on the Bitcoin network instead of of ethereum or you can do both but in our example let's say we move it to bitcoin but if a fra proof happens on BTC we will relay it to ethereum because the cool thing about ethereum is as mentioned we have things like l cines so we can verify Bitcoin transactions and we can easily check that hey somebody triggered a frer on the Bitcoin Network okay let's let's trigger a scape hatch or do something on the E the side and the vision here is a user that's bridging Bitcoin from the BDC Network should have the security enforced by Bitcoin somebody that's bridging stable coins E e20s from ethereum should be able to exit back to ethereum and then the fra proof Escape logic should be

enforced by the ethereum network and that's exactly what you get here of course you could run FR proofs here on ethereum and really them to Bitcoin but the problem is that you know this bit VM construction it's not that easy to implement and given that ethereum still does not have a proper L line right we know that we need kind of a multi for the sync committee it's easier to do it vice versa we move the logic for propers to bitcoin but then we verify it on ethereum because it's much easier to build a Bitcoin lik line and read state from eth uh from Bitcoin on ethereum then vice versa and then to make it even easier and more compatible you can plug in the Bitcoin miners which you can then use for two things faster confirmation

times and guantee data avability because they have actually seen the data and it's easier to actually make sure you have the data necessary to the fra proofs and that basically is how we can create and that's also what we're building above a hybrid layer to that sits between Bitcoin and ethereum can import liquidity from both networks is secured by both networks and can access a much broader user base um namely the additional 300 million Bitcoin users and more given now the spotf has been approved that we see today so in short it's a Bitcoin L2 it's an ethereum L2 it's a hybrid layer 2 and um actually we're launching with phase one this week so we're launching with phase one as an eth optimistic prup with

Bitcoin tooling merge mining will follow probably towards the fall we're working with Marathon digital antpool bit Main and I'm also talking with Foundry and F2 pool almost all the big mining compan companies to start offering Bitcoin security to ethereum rollups um now I know we're over time so I'll pause here the other design that you probably heard of is Bitcoin staking you can also try to do Implement a proof of stake protocol using BTC um you do that using extractable onetime signatures it's a very technical concept but think of it you if you sign twice just like on ethereum your Bitcoin is lost this is also cool there's a protocol called babyon that's doing it there's a few other that are experimenting with this the difference

here is in proof of stake you have Capital cost so you need to get people to actually stake the Bitcoin put it at risk so it's not really reaking whereas with merge mining you actually the miners already mining it's much easier to bootstrap you don't need to ask them to do anything extra just like on igen layer you just run an extra node yes you risk that you know you might actually do something wrong um and that's essentially the balance I need to find here we cannot replicate igen layer one to one you have to pick either you have higher Capital cost on bitcoin and you kind of use a restate Bitcoin as an asset as a security model or you go with merge mining but then you don't have the slashing component or you combine them or you say Okay um the sequencers have

to stake some Bitcoin to be elected as sequencers or the miners have to take some additional Bitcoin to be allowed to merge mine and then they do merge Mining and if they misbehave if the miner tries to do something fishy you not only kind of take away the rewards you also take away some of Bitcoin so that model can also be done still pretty early but then you can really get to igen layer style security where you can run this across multiple different applications and have this additional reaking or merge mining security um with that thank you so much and yeah I'll be around if you have any questions