DappCon 2023: A Deep Dive Into Building Interoperable dApps With IBC - Daniel Burckhardt

DappCon 2023 · September 2023 · 39:44

At DappCon 2023, Daniel Burckhardt presents a talk titled 'A Deep Dive Into Building Interoperable dApps With IBC,' part of the event's Layer 2s track. The Inter-Blockchain Communication protocol, or IBC, is a standard originating in the Cosmos ecosystem for passing messages and assets between independent blockchains.

Speakers

Topics

From DappCon 2023, hosted by Dappcon Berlin.

Transcript

you guys are ready sound is good do you hear me well yeah great okay video Everything we're good all right awesome well welcome early in the morning my name is Daniel uh this is the first Workshop of the day at dcon um super happy to be here um I hope I can get you excited about the stuff that I'm talking about today it has a long title um I actually decided to keep it a bit more simple um so I wanted to talk about deploying your application once and using it everywhere uh the original title was crossing the interoperability Bridge a

deep dive into building interoperable deps with IBC um but one big uh I guess message I want to bring across today is that we're building a lot of really deep core technology but in the end of the day we really actually want to keep things simple um so I'm uh the CPO at altiplanic this is the core contributing company to fmos the fos Foundation or the fmos M uh has anybody heard of os here before okay quite a few okay majority yeah um and uh yeah OS maybe for the people that are not aware is uh evm blockchain uh layer one and I could explain a lot

of things about I guess the like um like compatibility with like ethereum client and everything but the the main thing to remember or to really understand about OS is that we're building The Innovation to really connect applications on several blockchains to really Foster interoperability between different protocols um so we've been initially we built ether which is the evm library that um has been forked over I think 290 times now there's multiple chains actually using this Library as their settlement layer and um building entire defi ecosystems on it there's you know like things like crypto.com uh Cava

Kanto there's a bunch more and obviously also OS that are using this this technology to to build applications and um we really see like more like basically for us like the the real big future and what we've been observing is that there's more and more technology coming out and the types of chains and architectures are really diversifying however um the evm for us has been really the the primary and like the most used um I guess application or like like um layer for for developers to build a top in a permissionless way and so we really

um think that we want to simplify things and and I'll go into this this topic a bit more and I'll also run through a demo of how you can actually deploy these kind of contracts um and build an application that's you know you just need to deploy once on one chain but then it's used from from anywhere from any other chain as well um and before we get into this like one uh thing I want to start with is really um this idea of you know probably everybody here has been uh already working in crypto for a while building maybe protocols applications you probably have uh some friends or family that you've been trying to like get in early early into this new new like system of values and and

decentralization um but like it's I find it still also personally incredibly hard to to Really convince people that uh or like people that don't really have anything to do with crypto um and and blockchain uh that this can be the new future or already is and uh so you might find yourself uh you know encountering this situation that you already see you know the danger coming and you're trying to take all the people and every friends with it uh and trying to get them in on on on this ride early and what I want you to imagine is that that you know you're actually working in crypto but you don't really try to use too many technical words to really convince other people of the values of it so we have things like wallets networks RPC um muv

data availability sampling like zero knowledge all these things that um you know are super interesting and obviously really important to to discover like the the next technological advancement and and make things easier but when we're actually talking about it it's really about keeping it simple and so that's why I want to give a bit more like a simpler introduction to this and what this actually means or actually I mean com back to it like obviously we're still working on all these topics um and and they're incred incredibly important but when you're um you know explaining your your application even in like web 2 projects like Uber or or Airbnb you're not really concerned with

a database that's um you know underlying when you're telling somebody about this product right um and before um I mean I started my journey in in crypto also as a core protocol engineer but before I was working in in product in web 2 and so now I'm working again in in like more the product side where I find this is really important for for really adopting more users um so what I really want to simplify this to is that when you're building your applications I want you to think about you know there's a user that you know once to do something there's some kind of intent it's pretty simple right and uh they get something back that's the result that's how you want to

actually pitch your product and there's something in between that's happening and uh you know for the developer Community it's obviously important but that's the um that's the Simplicity I want to get to and that's how I think we'll also be able to convince people to to use our our products um they're just more concerned about you know like what they can get out of it right maybe it's an investment maybe it's hedging their risk um they're may be Financial most of them probably financially interested uh but maybe also they just want to have fun um or they actually connect to the values that the developer the community um is is building um and that's why they're using your product so if you think about building a new application try to really think big

picture first and uh yeah abstracted in this kind of way and obviously this word intent has already been used a lot now for uh more or this kind of like uh a user is requesting or making some kind of a demand and then there's maybe different like actors trying to demand also becomes kind of way one of the observations we make right now is like why are there so many chains right so if you look at uh the most like I guess like the triip applications out there like a for Lending or or curve as a de

like what you'll find is obviously this big drop down of a bunch of different chains and I want to really challenge this and and at LT planning and OT we really want to challenge this and say well why from a from an endurer perspective is there you know this drop down really necessary right on the background you obviously know like there's these teams deploying this uh application multile chains um with individual um liquidity um which might also be fragmented and as well as like different maybe wallets or onboarding experiences but that can be very overwhelming and from the way that we use applications at least nowadays as a everyday user you um you know you don't you will will not really make you're not

really able to make a decision here okay which is the best chain to use and you probably shouldn't be it's really not really the the end goal as we find and so there's two major um problems that we observe at the moment um that I want to get more into first one that we see is that oning hard right like if obviously like you can explain to somebody or go through some docks to maybe set up your wallet uh on ethereum or any other chain but um you know if you have to think of like having to do this for eight or nine different chains um to really um you know also manage your wallets it can be quite overwhelming so

why do we actually need this and um so I think this is a challenge that we really need to overcome and and think it of it in a way that you only want to onboard a user once to like having an account the notion of an account or a wallet or an address uh even like using these kind of terms is actually super important right um so what we did for example as a first step and there's obviously many more uh not just on OS but what we did is built such a um like an onboarding guide which we call co-pilot um and play this little video here um basically it's just you know it's like a widget to like help the user on board to

metamask or Kepler and then um you know create create their wallet and um there's some like fun things here built in there but it also lets you on board like on ramp with either um like Fiat or crypto and the idea is really like trying to abstract all the um yeah the crypto wording away so if you even like look at um like simple things like in the ux if you look at the connect button usually like many applications have connect wallet on it but having just connect um sign in or things like this make a make a big difference and so the idea really for like um like onboarding users is like the goal should be you should be only onboarding them once to have some kind

of idea of a wallet of some kind of account that they hold Assets in and can interact with or identify themselves obviously for security reasons you might simply similarly as you have it with your normal bank accounts you might have several ones because of you know you want to diversify your risk but uh we really want to get to that that parody uh the second second big problem that we see with this like why are there so many chains is really um this idea of uh mercenary like multi chain Capital um where we have um really more like um I guess a successful applications like

widely used applications popping up and you know like originally starting an e ethereum um like defi summer and um they um you know obviously they're they're also opportunistic and try to deploy to as many chains as possible maybe even getting paid for it but like basically you're deploying the same code on several on several ecosystems and so what we here see is you know this or what we actually want to see and what we're building towards is Shifting this idea of a multich multi-chain Dap strategy to a cross-chain Dap strategy so if we take the example for instance of a like we saw before you could have uh the a protocol for Lending be

deployed on several chains at the same time um this causes you know you have to also maintain the different upgrades or um kind of take part in maybe like understanding what's happening and and you have different liquidity and liquidity pools everywhere but it really is more like a redundancy and it creates this idea of um like it's not really scalable that's the point and uh so what we actually were building towards uh with like the evm on OS is this idea that you'd only have to deploy it once either on OS or another evm uh chain but then you can really um access this application in Cross chain from other networks from like other um accounts um

and so you'd only have to really maintain like one interface one API to interact with this application and um but still be able to you know like access different chains so those are kind of like the the two um I guess major problems to that we see and if we solve them what we actually see in the future is you know two specific things and I wanted to give some examples which we call Omni liquidity and I guess Omni nft um so if we run through like stories like yeah you can borrow something like borrow assets Without Really knowing from where you just like trust the protocol based on you know other other users and and

the verification of the contracts and you could say something well I want to use a to borrow some atom with eth but the important part in this story here is that you don't really say where it's from right the chain is not really part of this sentence and so that's how we kind of um are thinking about yeah building new new applications and the same thing um with with nfts like one thing you could say I want to buy a bad kit nft uh if you're familiar with these ones they're pretty pretty um popular in Cosmos at the moment uh with eth on open C application and use it in my game or whatever um but again this really doesn't uh have this notion of a chain specifically and then so that's that's

how I want you know actually us as developers to really think about what we're building um okay and so how does this actually work how um are we like what are we really relying on to really build these cross train applications and um I think the big benefit uh of of using you know the OS technology is really that we we are using IBC which is the inter blockchain um communication protocol and it's basically just a standard um view it as a bridge um to really transfer data safely between chains and it's been in production in like plus 60 chains um since the last two years and never

really uh I mean obviously there's like smaller smaller um fixes that have to be made and and so on but there's it's really improving to be very secure protocol um and even with uh hacks like ter or not hacks but like I guess downfalls of of like protocols like Tera or whatever um there's like the this protocol really um like with stod the test of of like um some protocols I guess dying but like still um being able to run Sovereign blockchains and um yeah be secured and so um the way that this works is that I mean if you have more questions if you're not familiar with it

happy to like dive into it deeply but it basically is just a way of like Define like a packet data standard and you can send it between chains and as long as your chain adheres to the standard um um and you're setting up like like lines on each chain um you can like safely transport data um so this is just a I think an older um a screenshot there's like I said more than 60 uh chains now they call them zones here at the moment but this just an example of like how many um um uh application specific blockchains are already using IBC and are connected and transferring data so there's a lot of potential um of this

Omni liquidity this access to a lot of liquidity uh instead of really thinking um that it only has to be located on one chain and so there's like I think three top topics for interoperability um that that I want to highlight um so the first one is that if you'd start you know your own um chain for example using uh revm um then you still have like these these this problem that you actually need to bootstrap um the building blocks in defi right you have to have a DEX you have to have some kind of um notion of a stable or secured asset uh have lending things like this um that will really be able able to or

allow users to actually uh make make good Financial um or like a healthy financial transaction um and that's that causes a lot of you know effort in the beginning um but if you have access or if you have an interoperable um chain then you don't really need to bootstrap this on your own chain but you can make use of these applications that are already deployed somewhere else same with liquidity if uh we're all talking about tvl and um um see how like developers move to the ecosystems that have the biggest liquidity um like the the idea is really that if you are adding your chain or your application in this in this world where

interoperability is a given then um you can you know you have access to all this liquidity by default and it's super important and the third one I mean I already mentioned this quite a lot is really the ux um that can be enabled for for end users um all right and the um the thing that we're building at the moment is this thing called Dynamic IBC so I was talking about interoperability between chains um and and I guess users on on different um like IBC enabled chains but what we actually want to get to is really that smart contracts on different

chains can talk to each other um and are interoperable with each other and this is called Dynamic IBC because it's really uh permissionless and you don't need like core protocol or chain upgrades um to be able to add new packet types but rather say hey I want to deploy my smart contract and my protocol on one chain and um I'm able to Define my custom like packet type like packet data and be able to send that to another chain and so that's why we call it dynamic because it really is uh more flexible or like custom and uh and permissionless it's not really riing on the the core protocol updates um all right so I want to get

into like two use cases and and the second one also will do a demo um of what this means um so I think I moved one of my slides actually I'll get to back to this one afterwards um this one is actually the next one um so so what we recently um did is uh upgrade on the on the fos chain which really was the big first uh milestone for like um making this deploy once use everywhere narrative um uh reality and what this upgrade entailed is this thing called evm extensions

and basically um this really Ena it's like a shift of thinking about like having a tvl in one chain but rather saying hey you have access to to a bunch of other chains and the way to think about EV evm extensions is that without them smart contracts on the evm are really contained only to um um the evm itself right you can talk to other smart contracts um but you cannot really break out of it or don't really have access to the core protocol level um and with evm extensions we actually provide an interface in solidity that smart contract smart contract developers can can uh use to really access core protocol

functionality like staking voting anything really that's uh you know also custom on the core protocol um and especially IBC which would allow smart contract developers to uh transfer data to other chains um and vice versa so with staking you can build things like um like uh staking derivatives um staking managers things like that with voting you could build subd Dows um anything really um um on a very permissionless level and and IBC like I said um can be used for these these cross chain applications or we call them IBC daps um so now I'm getting back to the to this one um so the the first one that

we really want to showcase is this um uh gu Outpost with stride have you guys are you guys familiar with the stride chain yeah okay so stride is basically uh its own chain that off provides liquid staking um for Native Cosmos uh tokens um so OS is one of them and right now what you can actually do is like it takes um a few steps as a user you would send your OS token to the stride chain then you can liquid stake it there to receive uh a liquid staked acid like staked OS and then send it back either to Os or another chain to to use it in a defi protocol and for that you'd have to

be really connected to the OS chain first then once you uh have that asset on the stride chain you have to also um create your wallet on on the stride chain and send it back and you like keep connecting and switching between the the networks and uh what our evm extensions actually allow is that you can deploy a Outpost contract which is just a smart contract that uh users can interact with um with all the wallets that are supported such as um metamask and then do one transaction to do this whole flow of like sending the token um over to the stride chain liquid staking it and sending it back and so a user just has to say my intent is I want a liquid

stake I sign this one transaction and voila I'm receiving a staked asset I'm not not really even aware that like this is happening on a different blockchain right I only need to be signed into the OS Network and so this is really cool from a user perspective but even better or even more Innovative I guess the big big difference here is that this service um like the liquid staking with one transaction is also available from the smart contract level so you could build an application that uses this almost like an API and then uses the results to do some other further action right um taking the liquid stake AET and um deploying it in a in a in a DEX or like

a liquidity pool or whatever um so this is be this is really interesting and from a um I guess from a user's perspective like this is the normal stride interface and the big difference is you're not really connected to the stride chain but uh to your to the fmos network right and you could also build and that's what we're also going to have quite soon like a widget on our application where you can from a as soon as you're onboarded to stride or sorry to to OS uh you can yeah liquid stake your tokens with with one transaction all right I have vlad's post here who's also sitting in audience and is is giggling

at me so that's kind of hilarious um but yeah the second um second thing I want to show you is um an outpost and we call these Outpost just maybe to explain like because like in the in the stride example um we not we don't have to redeploy the stride protocol right on OS it's just like that one one protocol is laying there and it's not OS only there can be other there can be other chains um that are using this the service right um and so we say we have an outpost on of OS on the stride sorry an outpost of stride on the OS Zone um and so same thing uh I want to go into is uh osmosis

Outpost so um what we want to go through um also in the code and I hope the the Wi-Fi will be good but we're going to try to make a transaction on mainnet uh where we are um sending the OS token to the Osmos osmosis chain performing a swap and then this um from OS to osmo and then the osmo will be sent back to the OS train in one transaction so basically you're just using those mostos decks from the fos train and um that is accessible like I said not just from users but also from a smart contract level and this was also introduced in in our latest upgrade um yeah so we're going to we're

going to try to attempt this um on on mayet um so let me let me zoom out here I've tried this before today already so a backup we'll have it here but first of all any questions questions for what I'm trying to do here is it clear okay all right so so um we're just going to look into kind of the contract that's deployed and um what kind of interaction you can do there and and like I said the the goal is do one transaction to perform the swap if I look into uh my assets here

right now of of the account that I've connected I have like around three OS and you know one point or a bit more than um one osmo and we're going to attempt to like send two um like sign a transaction that swaps two of the OS um to the osmo tun and so what we have here is just uh this Outpost contract and there's one I've already actually loaded it into a remakes right you can like we've deployed this before at a given address and uh you can load the interface into remix so you can just interact um with the contract and we have this one function called uh osmosis

Swap and um this basically does two things one is um you approve the transfer and then the second one is you're um creating uh an IBC uh transfer um that is going to initiate this whole cross chain swap uh the approval um is basically just uh approving the contract to kind of like spend the amount that you want to send in general so there's um basically like um um this approval that that is happening uh and is also imported from um the the interface of the evm

extension so if I go um to this ics2 um Sol contract IC for those who don't know ic20 is just the packet type for a normal IBC transfer and um what we basically build on the core protocol is this uh this is basically the the interface for the evm extension uh for for the IBC transfer and so this is like a given address at which anybody can really um perform IBC transfers from a smart contract and then it'll give you the interface uh such as transfer and the actual Lo and and the returns and the actual logic is um you know deployed on the core protocol um and so first basically we're

just running through an approval um um of the amount that we actually want to want to transfer and then we uh compose the um the actual transfer um transaction or message I guess and the way that this works is that um the normal ic20 packet just has you know the denomination um you want to send the amount as well as this additional thing called the memo memo field and this memo field can be I guess be misused a little bit to really in include all the information um that would be required to do this cross-chain transfer um so um on the osmosis side what they've

actually provided is this almost like a middleware that um understands or pares this memo once once the IBC transfer arrives performs the swaps Swap and sends it back and so this memo is then also included uh in this in this ICS 20 transfer and all of this is basically one function that you can call which is osmosis swap um so hope it's big enough so if you uh are interested in actually doing this yourself um then you can also follow um this uh this tweet right

so I'm to shout you out Vlad um because all of this information is really um explained here um with like the extensions repo this also includes the The Outpost contract that we just looked into as well as um the dependencies um or the Imports here um of like the evm extension interfaces which are also in this repo um just note that I think by default it is connected to test net um so you might have to actually change the addresses on if you're working on on Main net but all of this is also described in the in the thread um so let's do it let's try to

actually um perform this uh this cross chain swap so just confirming that I'm using the right things here so basically the the inputs that the um this function requires is the amount right um um the base denomination that you want to send and uh the one that you want to receive from the swap uh as well as the the receiver account um so we want to get the osmo back as a at a specific given uh address right um and so we have like two um two OS here um you have obviously like the ad OS um just to to provide the

right denomination and we want to get uh osmo back and this address is um I believe my um um yeah like we basically have two representations if you're not familiar with this but this is the the classic hex address that you know from from ethereum and uh this one is more from a cosmos ecosystem which is be 32 um but yeah I believe you can also provide both yeah um so yeah we want to perform this transfer let me just collapse this last one uh and do a cross train swap so we're going to have the um like metamask um connected here

with in injected provider so make sure to to actually do that before um pay the gas fees and then it's going to send it's going to actually approve right and it's going to um send the IBC transfer and okay the Wi-Fi worked I'm happy about this so if we look into this a bit more in detail maybe make it a bit bigger um it gives me you know the the address that I interacted from and um the contract direct address that I interacted with um and most importantly it gives me the logs um which are the transfer authorization for the IBC transfer as

well as the the IBC transfer itself right um I can also um look into this on ecan which is our block Explorer so if I'd go to this uh latest contract interaction um I can view it on the Block Explorer where you have a bit more our nicer interface I guess also of the logs and see exactly uh what's happening here um and they've yeah this this block explore is cool because it also you know actually lists the evm extension that you're interacting with um so yeah we hopefully have uh two OS less so let's see and some more Osmos osmo um received afterwards

um okay so if you remember it was at 1.2 something right so we actually did a cross chain swap which is pretty cool and you know if for the more visual people um if we actually go to the osmosis um interface which hopefully loads um we'll wait we'll see um you know usually like like I said I think the important part is that this is you know accessible for for users right but even more important from the smart contract level this is really what we're what we're focusing on um so yeah we just did a cross chain swap on on on

mainnet which is amazing and you could say like hey I want to actually um I don't know swap a th000 ammos um get osmo back and then use the result to like provide liquidity on a on a deck on on OS for example or on another chain or even on uh on osmosis um so that's kind of the the idea of like um this osmosis Outpost any questions this okay um did this one load no um let me check if I can show anything else here I guess in the block Explorer if I refresh this what we do see is um this

is the um um the contract that we interacted with so 2 minutes ago right we did this uh interaction um so it's all already here and if I'd go to uh my uh wallet I should also be able to see the uh incoming IBC transfer so as soon as you actually swap on osmosis um you will actually there's a second IBC transfer that's initiated to send back the osmo token to to the fos chain and so you can also see that this actually is uh captured in the logs and also displayed here in the um in the block

Explorer all right cool so jumping back into here um yeah if you want to try this at home you can um do this on mainnet or on test net there's both is possible um I like to do a main because there a bit more of a rush happening you know um so where does this all lead us or bring us to um um I was talking about yeah you know want to provide like applications to end users right and the one way that our team is really thinking about it is um we want to provide you know an interface where users can do

this in a really simple way and where developers can also understand that like hey this can be really easy and I also want to um build my application the same way or used as like cross-chain connect or interoperability to um yeah not have to bootstrap mod defi not have to um worry about liquidity on my specific chain uh things like this and at the moment this is our you know our normal like app. eos.org interface but um what you'll see quite soon is that this will be also replaced with like basically like more widgets more uh like call to action uh things where users can directly use these protocols right you not actually you just um connect your

wallet to to this interface and you can already like liquid stake you can uh cross train swap on on OS on osmosis you can do all these things and and developers can also build like more I guess Advanced strategies um um and offer them to users so that's really our I guess our end goal and that's what we're working on at the moment and we'll be really exciting to see um people use um just zooming out like I guess I when I give this Workshop or this this talk I really try to not talk about Cosmos too much because I feel the theorum world is really still like so much bigger and for us really the um

we're really like a port of entry for for this kind of world and and and um yeah evm developers uh exploring what other technology there is right and it doesn't really matter so much in the first place that there's you know that I guess our ch is also built on the on the cosmos ecosystem um but the important part is really that that um we're like leveraging this technology to really um have um the ability to use IBC um in a really like standardized way and but just still like there's actually if you account for all the liquidity and tvl in the cosmos ecosystem it amounts to almost I think this was at a time like a

billion a month ago or something something billion dollars and um yeah we are also seeing already more uh ethereum like layer 2 applications also trying to adapt IBC and there's a lot of big interest there so we really see that uh that's going to be like the future so just remember deploy once use everywhere and uh thanks you thank you for for listening and if you have any questions uh happy happy to answer anybody no worries I'm also around um happy to talk about anything and uh yeah

enjoy your day thank you