Mastering Cross-Chain Bridges

ETHCC 6 · July 2023 · 20:57

Alexei Zamyatin discusses cross-chain bridges, the protocols that let assets and data move between otherwise-isolated blockchains, covering the design considerations involved in building them securely and the tradeoffs different bridge architectures make.

Speakers

Topics

From ETHCC 6, hosted by Ethereum France.

Transcript

all right hey my name is Alexei I'm the co-founder of interlay I've been doing research on bridges for the last five six years so I started my PhD at Imperial College in London where we really work with quite a few people that you know build Bridges and we try to you know come up with the foundations of why Bridges break why it's difficult to build them and how we actually can achieve trustless bridges in the talk today we'll walk you through you know a deep dive into okay why a bridge is important why is it really so difficult to build them and then some sneak peeks on well you know what's coming now I think I don't need to talk a lot about why we need Bridges it's pretty obvious there's not going to be one chain through them all and even now with

l2's roll ups and ethereum coming up you know we need to be able to communicate between different chains but there's a problem right less than 10 percent of the bridge volume today and I don't remember the numbers but it's in the billions essentially um is decentralized and there's a few exceptions with like you know polka dots you know having like some bridges within their ecosystem but that relies it to be requires you to be a poker parrot chain Cosmos IBC right they you kind of can bridge between these changes and that's somewhat decentralized our Bitcoin Bridge works that way and then some L2 Bridges but that's a quite limited amount and we still see the centralized like centralized Bridges being massively dominant in the market and then they

just keep breaking so one important thing to understand with Bridges is that when you're bridging you're actually depositing into a network or a platform right your assets can only exist on the Chain they were initially minted on just from computer science perspective so if I just put on my computer science hat and I look at how bridges work there is not much difference between you know depositing into binance into something like cash app or into an L2 or in another Network the process is the same I deposit into a wallet into an account on the original chain let's say I deposit Ethan to ethereum and you know someone controls that wallet and the question is well who is this person or entity so the goal of bridging is well I

want to deposit Ethan to an option and I use app chain here as the general term for l2's application chains whatever else you want to call it use ether as if it were Native asset I don't want to worry you know whether I can use it with like a swap on ziki sync or or something like a lighting protocol in our bedroom it should just got in the Box just like you know when you deposit your Ethan to binance you don't have to figure out oh is it compatible with trading but maybe it's uncompatible with some of the other products and then I want to get my Eve back right I always want to be able to withdraw my assets back to the ethereum main chain and they use experience ideally should be as good as depositing into a centralized exchange one click I'm there I don't have to worry about

you know figuring out which bridge I should use and it should be secure now trust models I'll briefly skip over that but it's important to remember single chain means I only trust one network I have a wallet I hope that that wallet works and I can you know verify you're looking at the code if I'm going multi-chain there is now two of these networks so I need to trust that chain one is secure and chain two is secure if one of these things breaks well then I shouldn't be using them and I you know I will not be bridging to a layer 2 or another chain if I don't trust it but then I have now two wallets potentially or one wallet with different accounts of different chains that I need to manage and there needs to be a bridge and that's the thing that usually will

be the dangerous part just like think of crossing a Chasm you know you're Crossing between two like Cliffs over like you know very high place that's the dangerous bit so wrapping your privilege you're all familiar rights Point made ethereum only exists on the ethereum chain and to bridge it over I need to create a representation so wrapped eth and I know it's sometimes confusing because we have wrapped teeth as well on ethereum directly but essentially I need to create a representational ethereum on another Network so whatever this thing is is called um let's call it XE just for for the time being that tells me okay if I have this then I can claim one ether on the ethereum chain in computer science terms this means that I'm obtaining a right

lock on the theory on this coin on the ethereum side so this means that no updates can be made on ethereum anymore on this asset so this means nobody else should be able to you know move it around on the ethereum Chain while I'm using it let's say on an L2 but if I transfer this asset to somebody else on an L2 obviously you know only that person should be able to get back to the original ether on the ethereum main chain pretty simple so why is it so difficult then like how come these Bridges just keep falling apart and this brings us back to a very very probably one of the oldest problems of e-commerce or Commerce the fair exchange problem and bear with me like this is I I'll explain why this is relevant so in the fair exchange problem you know Alice has some coins she wants an apple

Bob has an apple he wants the money simple problem well what do they do there is a reason why marketplaces existed in you know the medieval times because obviously you know Alice does not trust Bob and she does not want Bob to rob her so you would meet in a public place you know and then they exchange goods but what happens if you're on the internet and the problem of fair exchange that somebody has to make the first move I have to give you the money before you send me the goods or vice versa and to ensure fairness and 100 of the cases we need a trusted third party and there's actually a formal proof for those of you who really like academic papers from 1999.

right so we need to trust it for third party to always exchange goods fairly so how does this relate to bridging well when I'm bridging I'm wrapping assets and wrapping is basically a swap my native if for the right on the other chain and when I go back what I'm actually doing is I'm swapping the wrapped teeth for the actual ethernet and someone or something needs to do the Locking and unlocking right of ethereum on the main chain and like the wrapped acid on the target chain and vice versa so something or someone so and that's the bridge problem right if Alice wants to bridge over to let's say polka dot from ethereum and mint some wrapped ether there well she needs to make sure that she actually gets the

wrapped acid and Bob who might be the final recipient of that wrapped ether well he really needs to be sure that you know this is actually backed by eth and the goal is to make sure that these things are always Atomic you should never be able to get a wrapped acid without locking ether first and vice versa you should never be able to claim ether without actually burning or locking the wrapped assets and well the way to do this is well it's actually picking a suitable custodian so somehow we need to make sure that the if is locked and unlocked in time simplest way possible use a centralized party send it to binance and withdraw to the other chain trust that binders will do the right thing well we know that some bridges have been

operating in this model in fact I would argue that 90 percent of bridges today that connect different genes operate either in the centralized entity model or in the community Federation model where you say well it's not one person but there's a multi-sig a Federation of trusted entities the next step to kind of you know move along this like spectrum of trustlessness is to say well you know let's not use a multi-saver maybe 10 or 20 people that are always the same you know they might get corrupted over time people tend to get corrupted over time right so or they might at least so let's use the consensus network of a third party system where you know anybody can join and leave it's a it's a center some consensus um that thing is hopefully decentralized

and we'll trust that so that's when we're moving into the space of like axillar for example follows the model this model and I think you know more and more chains are bridges are trying to kind of go in that direction so the idea is now okay it's not a fixed multisig but at least it's a multi-cigarette threshold sake but it's changing but then the optimal case you know is I only trust the source chain in the Target chain and I trust that the consensus of these two things because well I trust these two chains anyway otherwise I would not be bridging and how most centralized Bridges work right you lock eth you deposit eth and this entity right this custodian here and that can be one person a group of people a third party Network they will attest that hey I actually got the

ethereum now please unlock um and they tell a smart contract or another issue like a centralized party on the other side to give you the wrapped ether and if you want to go back well you have to return it and you request again that this party gives you back your tokens on the ethereum side that you previously locked what happens if that party misbehaves nothing you cannot you have no protection you can try to sue them right but you know that we're trying not to you know rely on the legal framework here when we're bridging in the D5 World um and well the question and the argument here is is D5 really D5 if your bridge is C5 right if you're bridging from Bitcoin to ethereum or from ethereum to another system are you really using D5 if you know your counter

like either middleman is essential as their party arguably no right and just these hacks here I mean some of this money was returned but that's over a billion dollars lost and these are just cases where you know private keys are compromised or Access Control permissions were broken so that's just from you know multi-sig Bridges mismanaging their keys and I recently moved this multi-chain is another quite sad example unfortunately and if you're affected I really hope that you managed to recover the funds we don't know what's going to happen but again like team lost access how how is that possible that in a MPC based system team can lose access to all the keys that that should not be possible Right um so the question is how do we build a decentralized bridge

and as mentioned the best case is that we just trust the two chains that we're connecting right um and this way we can ideally inherit the security and the centralization of the connected networks so example ethereum verifies the state of polka dot right or Avalanche or arbitrum right and L2 bridge is our special case because some of them actually really do that um but ideally ethereum is aware of what's going on on the other side and the other side let's say polka dot knows what's going on in ethereum and the only thing that you need in this case right is one party to just relay the data so you need to relayer someone that will make sure that the chains are right of each other and this can be anyone this could be yourself right so if I'm using the

bridge I might just run the relayer to make sure that you know it's actually working and this thing is called a light client Bridge because ethereum has a light client for polkorod and it's the same thing that you have on your phone when you use a wallet because obviously your phone does not download the gigabytes of data but it just stores a few metadata stores the block hashes and then that allows you to verify that certain transactions have happened um now fun fact this has actually been known since 2014 and even before that right the famous side chains paper by Adam back and all coming from Bitcoin right actually described it back then right use SPV proofs which is like like client proofs and just do that so how come we don't have this yet

um and we'll get to that at the end so how like languages work is well you know instead of locking eth with a custodian you put it in a smart contract that is controlled by the consensus of that Network on ethereum you send the proof so you or somebody else relays that proof to the Target chain and that Target chain contract unlocks XE to your wallet perfect I don't trust anyone in this case maybe they relayer if I want to go back same principle lock in a smart contract submit proof unlock perfect so actually this is the way to securely Bridge assets what happens if the ruler misbehaves well we don't care because we can't just do it ourselves right and if your protocol that is building on Bridges like this your incentive is to run this

through there yourselves it's not particularly expensive you're just running the full notes for both networks and sending the data but this makes sure that you know there's always some correct data on these chains now how do we verify cross-chain States again like clients right so tracks block headers verifies proof of work or proof of stake um verifies transactions security model if it's in the main chain right so if a transaction actually got into the chain that has the most proof of work or proof of stake then it must be valid because otherwise it would mean that somebody managed to attack ethereum or Bitcoin or something else and then the security model breaks anyway so that's how it works now I will skip over this because we're running out of

time but Economic Security is also something worth considering right so if we have two chains green and gray here and we're bridging assets between them well let's say this the size of the green circle is a security budget so what it costs to actually run an attack over a few like hours on chain a and chain B has a smaller security budget so it's like a smaller cap Network and the assets that we're bridging are like you know the green circle is like the amount of value that we've bridged over that looks fine because you know still secure but what happens if the asset the amount of assets that we bridged over in terms of value exceeds the security budget of the target chain then in theory there could be an incentive to actively attack it to try to steal the assets we haven't seen it

in practice on ethereum today but there have been cases on Bitcoin in fact where chains were 51 attacked um that were kind of connected to bitcoin merge mining with it so one way or the other in the future if we don't if we don't pay attention this actually might happen and theoretically it will happen right at some point if it's possible so it's always worth paying attention um right I'll skip over Economic Security Bridges because we don't have time to talk about that but for Bitcoin you need to use collateral right so Bitcoin does not have Smart contracts so we need to come up with more creative ways to make these trustless Bridges work for Bitcoin and these things really do rely on Economic Security um so Outlook

unfortunately there will be chaos right so there's a dozen of centralized and hopefully some decentralized bridges um and well mainly centralize honestly and the result is that you have fragmentation of liquidity as a new protocol you have to choose well if you're not an ethereum which Bridge do I use Wormhole Axel or multi-chain and I could go on right there's a very long list of bridges I could use but then the assets are not compatible if I have Wormhole eth and axillary that's not the same acid I cannot use them so that fragments liquidity and then the other thing is if you're not an evm chain well bad luck because most of these things currently only support evm so you end up you know bridging and hopping through an evm chain that you might be able to

connect to so for example in polka dot you bridge through Moonbeam and that again creates even more fragmentation and as a protocol or a side chain layer one layer two you have to choose like do I put all my eggs into one basket I trust only one bridge and if it happens to be multi-chin then it breaks well bad luck or do I fragment my liquidity and hope that well if only one breaks my damage will be limited but then you make your network unusable for most people the question is well I've been telling about like climb Bridges where are they why don't we have them today they're well the thing is like there is no one way to build like climb Bridge these things are specific to the chains you're connecting for Bitcoin proof of work Works builds it's possible

um like runs prefer work right the function that uses memory hard so it's super expensive to verify and I think with the liquids post it takes like what 50 theorem blocks to verify one Litecoin block so that doesn't really work does it ethereum proof of stake yes there are bridges in development but again we saw like this out to your debate whether it's actually secure enough and you know this is a quite new technology it's not that easy to build there's still some uncertainty so yes kind of works but we're not 100 sure if it will work with like billions of dollars per each of that system so you need additional security measures or changes to ethereum so Lana we again people are working on it not there yet so these things take a long time to build there's a quite tough engineering challenges and another

pointer here ZK does not solve this problem right so yes your knowledge proofs allow us to you know compress data right it makes it more efficient but if you cannot do it without your knowledge it's not going to be much easier to do with zero knowledge so yes you might be able to find a circuit for Lycans proof of work to verify that but it's not it's it's going to be very difficult right it's going to be a tough engineering problem you're going to spend a lot of time and this is why basically we don't really have Litecoin Bridges today um exceptions chains that are built to be interoperable like pull code Auto Cosmos but they only really work between each other right same consensus and it's kind of built with like lines and even there right we're still in the early stages um but I do believe that you know there

is good examples of things that already work um sorry my way polka dots near and Cosmos will likely have ethereum-like Clem Bridges by the end of the year if we're to believe recent development so fingers crossed that these examples will go live and actually Prevail and my bet is having spent quite a few years like working on Bridges advising projects looking doing deep dives into different designs hopefully but I'm pretty sure in five years time we'll have light climb Bridges between all the big networks and you will not have to trust Central as Bridge providers so we'll have one like climb bridge between ethereum and polka dot between ethereum and Avalanche for example and there will be no need to use a centralized Bridge provider and with that thank you so much let me know if you have any questions [Applause]

okay time for questions guys otherwise you can also just drop me a message on Twitter thank you for the presentation so we miss a little part if we have sometimes maybe we can go through the slide that you skip do we have time all right well then let's let's quickly talk about Bitcoin so reminder bridging on bitcoin is like bridging in really really hard mode because Bitcoin has no smart contracts so what do we do then what we have to do is well we can trust wbdc which is bitco or we try to emulate what a smart contract would be doing so and this is

something that we've designed in 2018 and that's been actually live on our Network for a while now um so what you do is you say well step one we don't want to trust only one party we allow anyone to become a bridge operators so instead of bitco you have a network of people who can sign up to become a bridge operator now these are the people who will get your Bitcoin so just you know sending Bitcoin to random people is not going to make it better it's actually probably worse so how do we make sure that they don't misbehave you use collateral so the same mechanisms that Bitcoin that make Bitcoin work in practice Bridge operators lock collateral in different assets and if they lose your Bitcoin you liquidate them right and how it works is in Step 0 vaults register anyone in this room can go spin up a

vault now and you log you will have to lock up collateral in dot usdc hopefully Sony ethereum on the network but you can use any asset right should be like a maker Dao voted on a governance risk parameter management properly and so on and then when the user deposits Bitcoin you pick one or more votes you send the BDC and the moment you send the Bitcoin the the collateral is locked and as a user you know that well you know if these guys lose my Bitcoin or they don't return it to me when I want to go back I will get their collateral and I'll be you know reimbursed and I'll not face Financial damage and in the good case in 3A here for example right if the vaults behave correctly and the same bit come back to the user they'll get the collateral back

if they don't if they fail right go offline they will not get their collateral user is reimbursed they can keep the Bitcoin but I have money in different assets I can go and that I can use and go and buy actually Bitcoin on the secondary market and we use cross stream proofs in two steps right so when you mint as a user you have to prove to the smart contract that you actually sent the Bitcoin and the vaults have to in Step 3A prove that they actually return BDC to the user right so you can't really lie to the system it's not optimistic it's not fraud proofs it's you're guilty until you prove that you're innocent and this or we can always ensure that you know if something does go wrong we can liquidate people or you as a user if you never send a Bitcoin you're not going to get

any wrapped assets so that's how you do it for Bitcoin challenge here is capital efficiency in scaling that and this is where liquid's taking risk taking and like reusing collateral in like D5 can actually make it work at scale yep so that's how you do for Bitcoin [Applause] thank you [Music]