#DappCon22 : Day 3 - Building xChain Applications With xCall, Arjun Bhuptani
DappCon 2022 · September 2022 · 21:30
Connext founder Arjun Bhuptani discusses building cross-chain applications with xCall at DappCon 2022. The talk covers how Connext's cross-chain calling infrastructure lets developers build applications that interact seamlessly across multiple chains rather than treating each as an isolated silo.
Speakers
Topics
From DappCon 2022, hosted by Dappcon Berlin.
Transcript
we have Arjun bhuptani with connects the talk entitled building X chain applications with x-call hi everyone how's it going last Talk of the morning um this talk is about cross chain stuff and connects how many of you know what connects is before I get started great for the rest of you I will be going through it so um already so we live in this really weird and wacky multi-chain world right now uh this is the Ave UI and the experience of using Ave right now is app like if you're especially if you're a person
that has funds living on multiple Roll-Ups all at once is absolutely awful so like if you for example want to invest into an Ave pool but you're trying to find the best rate to to lend into um uh if you make the mistake of actually lending in the wrong Market the process to get to the right Market is is god-awful uh basically you have to pull your funds not only do you have to kind of Select through each and every single one of the chains on Ave tool to figure out where the best rates are to begin with you have to pull your funds out go find a bridge uh hopefully a bridge that you know is safe and is giving you the right assets on the destination chain and and then hopefully also has a good price and then go back to the Ave UI to
lend again onto platform um that's something that like for people like us who have been in this space for a while it's a giant pain and for new users coming into this basis it's completely unintelligible I mean try explaining to a new user who has never interacted with blockchains before what the difference is between arbitrum 1 and arbitrum Nova they really just don't know or care and really what we want is this cross chain experience right we want a an experience where as a user you are interacting with a single unified interface and behind that interface you are able to invest into whichever Ave pool you want a good analogy is something like Google Search right when you when you search for cat photos on Google you're not consciously aware of the fact that Google is in the
background running a search across all of their index data across multiple like sharded databases you're just seeing cat photos and like that makes sense users don't need to know what's going on in the background the fact that we force them to know that right now is absolutely terrible um and I know some people in the audience are not like oh no he said the c word uh look it's no it's no uh it's no secret cross chain is like really the the reputation of bridges and cross chain is absolutely in the [ __ ] right now um and it's it's fair there's a good reason for that we've lost two billion dollars in hacks in the last year um and I think it's because as a community we've really like undervalued
and underappreciated the extent to which Bridges play this very very critical role in our ecosystem um as as a piece of infrastructure that like helps connect all of the different chains not only other alternative elements but also like Roll-Ups and other chains within the ethereum ecosystem we've really not spent enough time thinking properly about how to make them secure and this also brings up the the other question which I think always comes up anytime there's a bridge hack do we even need Bridges um why do we actually need them and the answer to this is is yes I mean there's no real way around it right because uh every single time there's a bridge hack you'll undoubtedly have some person on Twitter post saying oh well you know if
you're using Roll-Ups this wouldn't happen but that's also not true right Bridge hacks largely have been implementation bugs and Roll-Ups are also Bridge implementations they you know roll ups post data to their underlying da chains which is a bridge eventually when we move towards a more modular World those da layers will post under their data to underlying consensus and settlement layers that's also a bridge and not just that we also need to be able to communicate between the rollers because again we want to have make sure that users have a consistent experience so execution layer to execution layer communication also a bridge it's all bridges like we are heading towards a world where everything is going to be layers and bridges uh because bridge is really what a bridge is is just a way to synchronize data between two distributed data source um
and so if we're if we're living in this world where we do have to have Bridges no matter what how can we find ways to actually build safer Bridges and there's a bunch of things here fortunately there are actually answers to these questions it's just that we haven't collectively had enough time to figure that out yet and unfortunately the bridge Market matured really really quickly in a bull market where everybody is really really focused on growing rather than actually finding the right way to build these things but there are ways to actually simplify Bridge infrastructure and reduce the risk for example we can modularize the bridge stack what this means is I know modularity is a bit of a buzzword but what this really means from the perspective of bridges is like separate out each piece of the the uh the life cycle of making a transaction
that goes across chains and isolate the risk of each of those pieces so for example have a transport layer which is really just a mechanism to take hashes from here and then put them over here right and have that be separated from the verification layer which proves that that hash is actually correct and have all of that be separated from the execution layer which takes a hash that now you know to be correct and executes a function call or some data against it by separating out all of these components we can actually end up in a world where you can mitigate the risk by isolating all of your risk only to the verification layer or something like that aside from that there's a bunch of other really easy tactics too minimizing external dependencies I'm really really bearish on bridges that use lots of fancy cryptography because the
cryptography implementations on each chain are actually very different and even envelopes are completely different and they all have artifacts those artifacts will become relevant if you're living in a world where you're trying to use the same complex cryptographic protocol on every chain all at once um but even beyond that minimizing external dependencies means using what already exists right we have an existing network of arbitrary messaging Bridges between all of the chains in the ethereum ecosystem um you know there's the roll-up Bridges there's the gnosis chain amb there's the polygon POS bridge and users are already inheriting the trust of those systems if uh if you are building a system on top of the polygon POS bridge and you know the polygon POS Bridge gets hacked uh the entire polygon ecosystem is is kind
of [ __ ] like there's not anything anyone can do about it and that's that that means that there's you know of course that is a systemic risk that we have to be concerned about but it also means that when you're building on top of that bridge you're not adding any additional truss assumptions for the user which is actually a really good thing um separately from that there's also delays in off-chain Watchers so this is a you know basically fraud proofs similar to optimistic Roll-Ups you can add delays to bridging interactions um and have a network of Watchers that can help the system basically pause or disconnect a chain if something goes wrong this is powerful because it basically means you can have like a again similar to an optimistic rollup have a one event system where you only need one person really watching the
system to be able to make sure that that you have safety and that safety is preserved when you're moving data and funds across chains and then lastly and this is a relatively New Concept rate limits right if you think about it logically there's not really any reason why uh you know if you have a bridge that has 100 million dollars in it there's probably not any good reason why 15 20 of that should disappear uh and so you should it's it's actually fairly trivial to bake in on chain rate limits where you can say okay uh more than x percentage of the funds within the system have left in the last 15 minutes something is wrong and that should trigger an automatic halt or at least a a disallow additional people from withdrawing funds these are kind of ways
that we can stop attacks before they happen or even if they are in the process of happening at least curtailed risk because otherwise you have this like broader risk of contagion something that we've started to see a little bit which is a bridge gets hacked or an ecosystem gets like a you know like a this could happen to a roller bridge too which is a nightmare scenario but a bridge gets hacked and all of a sudden every single asset that is on that chain is now unbacked and that entire ecosystem because you know everything that was worth one of itself is now worth zero of itself how does Connects work and how do we kind of play into this model so connects is a mechanism for cross-chain communication we're trying to find the right safe way to build uh build Bridges and build ways for people to build
cross-train applications the way that we do this at the moment is by you know as I mentioned earlier modularizing we send messages through existing Bridges things like the roll up ambs noses Chain Bridge etc those bridges take a slow path quote unquote which means that they uh you know any data that goes through these digits is posted to to ethereum and then is batch like posted to every other chain and then we have an execution layer that sits on top of all of that that basically relays data and funds in a fastpath method um and and what this means is that you have a network of off-chain actors that are fronting Capital um and in in some cases in some specific cases able to even call contracts uh to execute transactions across chains and then reconcile against messages that
have that come later using the slow path and importantly what we do is we introduce a you know 30 minute delay in Watchers to every single amb that we use so effectively what we're doing is again similar to a rollup creating fraud proofs that can secure the system even further Beyond any any like the security that the AMD provides um it's kind of nice where you know regardless of whether or not the bridge that we're using as transport so basically you know the the data that is going across chains in the slow path is basically just being posted between Chains It's a transport layer so regardless of what the security is of the bridge that we're using we are adding our own security we're basically turning every bridge into an optimistic Bridge whether they want it or not what does this mean um and what does
this actually let you do connects lets you build cross-chain applications and this is something that we really really believe is like the Holy Grail of of decentralized application development we need to move from this Paradigm of having applications living on one chain to having them live on multiple chains and Roll-Ups Etc all at once and until we do that we will just continue having this really fragmented shitty experience how does Connects do this so connects introduces this really simple primitive called x-call xcall is a way to do a basically any kind of generalized function call across Chains It's a good analogy is to think of solidity's built-in call method and in the same way that call lets you call a contract on
the same chain x-call lets you make an asynchronous contract called asynchronous call to a contract on a different chain what does asynchrony mean um a good again a kind of a good mental model here is to think about how we do web development today so when you when you're building a web application that's using JavaScript or whatever um you are interacting with resources that exist on servers all across the globe you're not actually just hitting a single machine and that's a core part of how we think about building on the internet right because it's it's not possible to make sure that there is data available everywhere that you're trying to build all at once and implicitly the Assumption here is you're going to go fetch data from some remote
resource you need to know you don't you might not know whether that data will come back you don't know when that data will come back but you can wait on that data and then execute other kind of functionality based on when that data is returned in JavaScript these are callbacks so we can introduce this core idea into solidity as well and create what is called asynchronous solidity so again you can have a source contract living on one chain optimism for example that calls a Target contract on another chain arbitrary um similar to JavaScript that call happens asynchronously so you know the the execution of that transaction and a single block on optimism ends and then it begins an execution on another block on arbitrum and again similar to
JavaScript you can then make a nested X call back to the origin or actually even to other chains um this is similar to a callback and the core idea here is very very powerful right it's I can build an application that accesses resources so I have my solidity contract sitting on optimism I can build an application that accesses resources and funds living on any other chain and do this with any kind of functionality how do you think about gas in this kind of Paradigm it's a little bit tricky but what we've tried to do is just like constrain the the complexity of this as much as possible so that it's like as similar to existing development patterns so um with connects you just pay gas in origin chain native asset On the Origin chain um you basically just include it
as part of the message.value if you don't pay enough gas you bump gas uh you just bump it and then it gets processed faster you'll see the execution halt if it doesn't actually like complete because there was because it ran out of gas what does this look like in practice again the goal is keep it as simple as possible right we we want this to be a very simple primitive and like an open kind of mechanism for people to build these kinds of applications that can just become a standard because the bottom line is you don't actually need a ton to to call a contract somewhere else right you need to just know where you're calling the contract so you know the Target contract address and the destination domain uh domain is chain ID but also kind of broadly applies to other kinds of things that may not have
a chain ID one day and then you need to specify you know data that you're passing between chains and asset and amount params in case you want to send along funds what can you build with this this is where things get kind of interesting because this is such a generalized primitive we've seen a lot of projects building all sorts of really interesting use cases and I think that that's that's honestly something that like that I am most excited about is that cross chain development unlocks not just let me take Ave or uniswap and make it a cross chain application but also a whole host of other kinds of new use cases that people haven't really thought about a lot some basic ones are super fluid is building you know cross-chain money streaming so basically set up a stream on one chain
pay it out on any other chain or multiple chains simultaneously keeper network is bridging uni V3 t-wap oracles to every other ecosystem so uh you know oracle dependencies like the the consistent problem that a lot of projects have with being able to deploy on new chains or new ecosystems is is not having an like an oracle available and even if you do have an oracle available there are still a lot of projects that really do want to have you know uni V3 like oracles that are not relying on external actors things like chain link so bringing being able to with in a fully trust minimized secure way actually bring that uni v32 update across chains is extremely powerful fujido is actually building the solution to the problem that I mentioned at the
start of this talk which is uh they're sort of like a lending aggregator they they allow you to borrow on any one chain and land on any other chain and the way that they do this is by plugging into Ave and other kinds of lending poles across all chains and providing users with a seamless interface rather than one where they have to again jump between chains all the time um nft Hashi is bridging nfts between chains they're a bridge and protocol um the thing that's really powerful about this is if you think if you look at like the nft ecosystem today it's almost entirely isolated per chain so like yeah you know you think that uh treasure Dallas Marketplace competes with openc but it doesn't because there's no the the nfts that treasured out like their Marketplace actually deals with are the ones that are on
arbitrum and then openc deals with an entirely separate set of nfts and this creates a bit of a like not just a fragmented experience but also just a bad market for nft marketplaces right you want to be able to go where the collections are even if you your implementation is built somewhere cheaper um and lastly and this is actually one of the ones I'm most excited about is um is gnosis uh zodiac gnosis Guild is building a project called zodiac which is uh basically a Dao tooling ecosystem and one of the key things that they're doing there is building a cross-chain dow governance uh and voting so uh the idea like a good example of how this would work for example is uh um you know say you have unit swap trying to update features on polygon from its Dow running on optimism how do
they do that right that you don't want to have to deploy the end copy of the dial on polygon just to be able to update you know and create a one BPS view tier what you want to do is allow people to vote on optimism where uni tokens are already available and take the outcome of that vote take it across chains and use it to call a contract on on polygon um and and I think there's a much kind of broader array of use cases here around crosstain governance that I think a lot that like projects are now starting to run into because they're managing deployments across multiple chains at the same time separately from these These are projects that are being actively built but I think there's there's a bunch of other really interesting things that are near and dear to my heart um for example I think like cross chain
yield vaults are very interesting uh you know the entirety of the market for Bridges at the moment is basically people chasing yields you can destroy that entire Market just by creating a single Vault that Aggregates yields from everywhere it's pretty fascinating um another really really cool one is uh is basically allowing metaverses like decentral end sandbox Etc to interoperate these are completely isolated systems living on pretty much completely isolated chains but there's no reason why you can't Port pieces from one to another or actually even build a portal that allows people to go from one of my metaverse to another taking all of their stuff with them and lastly this is actually the one that I'm most most excited about um uh there's no reason why cross-chain communication needs to be limited to evm
chains there's no reason why it even needs to be limited to like you know stateful execution blockchains the way that we think blockchains work right now uh in fact you could build connectors into things like our weave or filecoin and what this means is you can have communication that happens from within a celebrity smart contract living on ethereum directly to uh storage living on our weave you can have contract owned storage data if you take this too it's kind of like theoretical end State and you have contract you know you have cheap execution layers you have storage and basically data stores living in on another chain you can even plug in things like compute and caching you can actually build full stack decentralized applications only in solidity that's
really powerful right like that's that's not just oh I built you know a 200 line 500 line solidity contract that is doing one very minimal thing because everything costs too much and it's too expensive to store any data on chain it's I'm actually able to build an API that stores like Global GIS data can that can never be taken down um that's really where we get to like World computer stage which is really it's something that at least for me that's that's why I got into theorem in the first place in 2017. um anyway there's a lot out there uh and I understand like this is a whole new world for for a lot of folks it is for us too so um I we have about five minutes for questions but in general I'm hit me up if you are interested in this in these
topics or if you want to hack on it at etherlin God thank you arjune for such a nice talk and yeah we have five minutes for uh questions uh thanks Arjun this was super cool um I have a question about you mentioned that every bridge essentially becomes an optimistic Bridge right so that means there is this 30 minute waiting time in what scenarios does the user actually have to wait 30 minutes for finality yeah that's a really good question I wanted to add a slide in here but I just ran out of time when making flights um so there's a there's something that so like obviously there's this broader concept of like generalized communication between blockchains um but there's actually like subsections
of that so you can you can actually break that up into certain kinds of things that can be done fast and then certain kinds of things that require a slower like this lower path communication and what that comes down to is authentication how do you are you checking who the caller is on the sending chain um a way to build intuition around this is for example say you want to swap like say you're on arbitrary and you have eth and or like usdc and you have you want to swap a hundred dollars worth of usdc to eth um but the best price that you're getting is on optimism you actually don't need generalized communication to do that what because what you could effectively do is like lock that hundred dollars of usdc into an escrow and I could pay a service writer and say hey like can you swap 98
worth of usdc into eth and send me the result on optimism and then if you do that I will unlock from this escrow and there are trustless ways to do that and that that can so as a result that can happen instantly on the other side on the other hand of that obviously something that is like a dow owned function or an only owner function can't be done that way right because you there's no real service writer that you could ever delegate to to to like call that contract function without actually giving them ownership of the contract um basically the way that it breaks out is if you're checking message.center like the TX origin on the destination chain contract um it'll go through the slow path and that actually happens automatically in our system so like uh when you when our routers which are like the the entities
that are providing liquidity and executing executing transaction data um when those routers see a new transaction attempting to be sent between chains they'll actually just run a gas estimation on it so they're dry running and seeing if it fails particularly if it fails because of uh because there was a message sender check that failed then they know that this is something that has to go through the slow path any other questions all right no more questions and thank you so much Arjun thanks so much