Protocol Berg Workshop: Federico Kunze Küllmer, Daniel Burckhardt: Interoperable dApps with IBS
ETHBerlin·Wed, Oct 9, 2024, 12:00 AM
This workshop will be led by Federico Kunze Küllmer, who was part of the core team that developed the Inter Blockchain Communication Protocol (IBC). Federico is also the co-founder of Evmos, an EVM compatible blockchain that supports interoperable dApps via IBC. Federico will dive deep into the technical aspects of the IBC protocol, exploring how it enables cross-chain communication and discussing how Evmos simplifies the development of interoperable dApps. Attendees will have the opportunity to learn from the speaker's firsthand experience in implementing the IBC protocol and gain valuable insights into developing successful interoperable dApps using Solidity. Federico Kunze Küllmer - Evmos Co-founder. Cosmos Core Contributor. IBC Core Engineer. Daniel Burckhardt https://protocol.berlin
Transcript
and I'm here with um we work uh at elanic we're the core contributors main core contributors for Eos osol and today we have quite a long time um but we're going to divide it into a bit of like the basic idea of why interoperability is important um and then also have a workshop where you can um if you have your laptop we're going to actually deploy a smart contract or app that does a cross chain interaction um you can follow it I'll show it once um for you and then we can do it together and we also even have some core Engineers from the team here additionally that can help um so just uh I guess uh the original title of this Workshop is is actually very long uh it's about interoperable smart contract U using IBC but uh we thought simpy bits and call it deploy ones use everywhere so idea is we're talking about applications that you just have to build ones deploy wants and then regardless of which protocol they're deployed on um like users shouldn't be very like concerned with where the deploy thing this us uh to me I started uh crypto as AOC engineer uh and then went back to product work um which I used to do in r two companies before and uh yeah maybe you want to give of course um hi everyone I'm F I'm the co-founder of os I've been in the cosos ecosystem since 2017 working on four pieces of infrastructure for the costos ecosystem um such as the cosmos SDK which is a framework for building options then I the I protocol and since 2020 I've been working on uh an evm on top of this technology that we built and with that making smart contracts to interoperable so without further Ado let's get started awesome yeah need have mentioned that we've been working on evm for a bit so actually like we started working on ether which is a evm I guess library that you can basically Plug and Play into building your own chain um but the point is like Beyond just being evm compatible we built a bunch of different functionality for interoperability between evm chains or one chain and the other two um so I kind of just want to first talk about why inter operability is important in the first place and I want to imagine to like when you're actually building an application as a smart contct developer like just take a step back and uh think about you know how do you actually pitch your idea pitch your product without speaking about like more complicated topics like or like things techniques that maybe end users won't really know so like how do you actually explain an application without using wallets rpcs like data ability datability samping gas whatever and so you might still find yourself like to be in the situation if you're trying to you know bring everybody in early um but it's quite hard right there's like a big step leap like of of knowledge and abstraction that we still need to do and that's kind of our main approach that we're taking even though we're building on political level and trying to um you know make the protocol as efficient as possible and dropable uh we still need to think about the interfaces that we provide for developers to make it as simple as possible so if we abstract this even even more we basically um we basically just have this idea like from the user perspective all you want to think about is like what you want to do right so users want to perform an action we can call this intent and and what they want to get back is like something you know that hopefully satisfies this inent and what happens in between can be actually very complicated we just heard it in the panel downstairs about the whole maybe supply chain May You' seen it it's like entire like it even seems like a linear process but there's so many actors in between um but from like a prod perspective like we want to really make it as simple as possible for you to build applications that you know kind of abstract everything way between and obviously as a developer you're like still concerned with you know the underlying security decentralization of the protocol and that's what we're all try to explain still but um hopefully if you have your laptop with you we can actually deploy a contract and it's going to be quite easy um so I want to kind of get into like this overall like idea like why interoperability is so important and the question here right now is or we have made some observations is like why are there actually so many chains um in the end of the day we're all building for some kind of users maybe be or I mean you can also be happy just building for other developers but you know that will not really scale um I guess the whole crypto technology like we actually building for end users in the end and so we're kind of wondering like why are there so new change why do we need a drop down of the same application being deployed on uh yeah several networks and so actually the goal should be like actually remove the drop dog from end the perspective even if it's a pro suumer like a pro Trader um they kind of just are concerned with the best rates so there's two major problems that we observe at the moment and one of them is just onboarding users is quite hard right so each I mean maybe you've used a few different wallets and a few different chains already but essentially every boarding is also quite different the W interface is different you might need to on R to new token to pay for gas fees and each protocol might have like you know different like individual I guess uh Specialties that they have um coded in the protocol so that's kind of hard like why would you have to onboard several times and we can make attempts um see if this is [Music] working okay it's kind of missing like we already made attempts in our in our front end to have you know something like a co-pilot to help users actually on board um with different um uh different like steps I think this video is not working but that's okay um and second okay and uh but the idea is really like actually you just want to do on on board at once right to like one account maybe not concerned with the address that you have but like usually users are concerned with like having one identity that they can you know kind of use on the Internet or like use on different applications um and and log in so even if you have maybe like if you think of B accounts you might have different accounts but they're kind of limited right and they all have just like one way of onboarding so onboarding is really hard if you have bunch of different networks to think about so the goal should be just once to using know crypto and then uh use everything else uh the second big problem that we see is kind of this like mercenary uh moving Capital um where we see um Blue Chip applications that are pretty popular right they accumulate a lot of TV on a certain chain and then because of its brand or their popularity or I guess hosle security uh they venture to other chains um but only like if they getting paid or it's kind of opportunistic and that can create a problem because essentially what they're following is like a multichain uh strategy so they're deploying the same version um of their application on different chains um that causes more maintenance it causes franked liquidity and also in the end like a bit more complicated user experience and so what we propose instead is more a cross chain um D strategy where the application really only chooses to deploy on the I guess core protocol or the VM that's most suit suitable for that application in this case this would just be like I mean it's just one example we have a that could be deployed in several chains but uh actually here on the right side with cross chain da strategy you'd have it only deployed on OS and then it will still be accessible from other chains um and just a quick Outlook like what would that mean in the end it's like this kind of we call it Omni liquidity and Omni F so you could have like stories like okay I want to borrow um without actually knowing from where so we can say I want to use a to borrow ad with e but what you notice here you don't actually like mention where from like which network is underlying right so it's different messaging towards the end user um for um that is only possible with interoperability in the same way um for like on nft like you can buy B kit nft if you know them with e open C which is just like a Marketplace if you don't know it um to use it in a game but you don't really say if it's happening on ethereum if it's happening on a COS chainal whatever so that's kind of like the future narrative that we see coming up um so that's kind of just from like I guess more perspective now coming bit more more into like how is this possible if you haven't heard of the inter blockchain communication protocol you see that's basically the uh standard for connecting um you know basically transporting data between blockchains and it's been like for over 2 years now I think connecting a bunch of chains and it's been a very like well proven protocol for conneting blockchains and uh yeah I think is going to talk a bit more deeper of how that works actually thanks yeah so now I'm going to be uh talking a little bit more like deep dive thing into thec protocol how it works and what are we doing on at most to leverage this interoperability protocol to make uh to create better products um by obstructing these complexities um basically offering like one single transaction workflows that leverage this uh interoperability from Smart conts also so the IC protocol is designed in layers similar to what the internet uh protocol Works um and it has two main layers one is a um transort layer which is called here iing tow which defines transport authentication on for of the data that is transmitted from one chain to another so transport between chains like like who's the actor or who's the yeah in this case the actor involved in the um verification of proofs of inclusion in each of the chains the authentication um and The Ordering of the package like do they need to be sent sequentially or send as synchronously uh no matter what packet gets sent before or after and then on top of that we have the application layer and the application layer basically defines everything that is um defined by the chain uh like like business logic so to speak for example when are talking about a cross chain total transfer that means reducting the balance on one on the user of one chain and um increasing the balance on the user on the other chain and simple words but that's sort of like the protocol that defines or the applications that use this transport layer um to Define some business ly and from a like more complex point of view this is what it looks like when we talk about the different layers so we have from one side about chain a and the other ones have chain B um so on on each of these chains the IC protocol is implemented and how it works is that you have a just going to skip a little bit you have this AR called the relayer the one that is like running light Appliance of the two chains in order to verify the state transitions um you going take a picture and I'm going to go back before so um so there's like the client states that need to be maintained so you have like the basically when we were talking about interoperability it's the main crucial point is like how do we prevent double spending like the same problem that Bitcoin first addressed but across different chancee how do we prevent the dou spending and so for that the IC protocol was implemented in a way that you need to have approv from the other P basically you establish a rout of trust and you veryify that the other CH has indeed um made the commitment these proof just for the three standard for for the in the case of a token transfer deducting the balance of the user that is making the transfer so that go goes on for example on chain a and then you have the lifelines that maintain the state how updated the state is and the relayer is the one that keeps the pl updated by for example submitting the latest uh height on the latest proofs from the chain B so the relayer SS update client to to chain a um to keep it up to date and same goes for chain B when they updates from um chain so this way you can keep the two chains up to date in order to verify the the mer yes so does that mean that the security of such a custos EOS system will equate the security of the least secure participating chain uh I can always so you're when you're establishing a and this is where what's going to go next the connection between the two chains you're basically establishing a root of stress between the two chain so the other chain is malicious uh it only affects that chain and that particular chain um it doesn't affect the the entire network so like if there's a buting a behavior on the protocol it only affects that chain so you can also close the channels um and terminate the connection at any so what happens with the NFP from this small chain that no one trusts into ethereum maget and either it's AUP n will be like it will be abrupt like if you implemented the same protocol that we have I we can go on that later when I do the workflow but basically um you would Lo the nft on the malicious chain and then you would meet uh voucher on that's more or less so um so okay we we talk about the proofs that verify the mer the the the Merle proofs on the clients that basically need to keep out dat in order to verify the pro um the connections that Define the basically the RO press between the two chains um that needs to be created with a handshake the handshake is like I initiate the connection then it's like a multi-way handshake um uh so it's three steps or so in order to open a a connection and then uh the same happens with the channels so channels as opposed to connections connections bind the chains itself and channels bind specific parts of the state so for example if you have a smart contract uh it binds a smart contract in one chain with a smart contct chain or we're talking about for example cosos chains that use modules or uh if we think of of the veral tree will only B one side like one branch of the of the of the tree with another side of the tree on the on the Chain G So it's b specific part of the state are supposed to the CH yes so I just between one and what happen CH and handle yes let say some some some Mis Behavior okay and and and the consequence for that change is the the ceremony is there like a trapping of like how uh how good a chain has been over time or something like that uh well there there hasn't been any Mis behavior on Main um just a huh like a incident like um works yeah [Music] the in that sense when terap it was not called the IC protocol itself but it was like the token was crashing and um they Clos the channel so that prevent like liity that was blowing out the the chain same with warm that was like connecting care with um etherum um the connection on the work was also terminated or on the Gateway was also close wa who who controls it on on IDC you can close the channel yeah you can s that transaction to close the channel it's like everything is perion um so again we talk about clients we talk about Connections and we talk about channels that are binding certain specific parts of the State uh and in that in that way once you create this channel binding you can start sing Pockets so so the key part and what applications rely on is sending packets from one chain to another and the packet defines like the the channel basically oh I'm smart contract on chain a talking to Smart contract on chain B basically defining for example who's the Senter who's the recipient um and then you find some other logic specifically for um the packet ordering um that's also defined on the channel um then then you send the pocket over receive it um you receive the pocket and then you abstract that logic that is handled only application so we have send pocket for sending receiving pocket for how to what to do once you receive something on other chain acknowledgement so once you receive the pcket you execute some logic It's s it's successful or and you Sly need to send acknowledgement back okay name and then we have timeout so what Happ like the pet never Ares to chain B if you lock the tokens here you need to send a timeout back to chain a to unlock the to so those are the main um the the main Concepts and then on top of that we have the application so now I'm going to go through uh specific so how does it work in in in reality is that so we have like chain a blockchain a and blockchain CH B that have like a module that's again a channel that is connected with a module or another channel in chv so this for example can be a smart contract with a smart contract or the cosmos side is like the bank module that handles like the logic transfers Etc so how this works is Imagine um Dan wants to send me 10 uh from the cosmos Hub to OS So Daniel defines the sender the receent my address the fancy token and the fancy amount and that is abstracted Packet encoded in the IBC packet which is s sent over to the transport layer uh that it me an event which is picked up by the relayer here dinos tokens are locked d tokens are locked because he's sending from the cosmos F which is a native issuer of that token to so Daniel's tokens are locked um send the P which meites an event with a proof which is picked up by the relayer which also sends on which sends another transaction to chain B with that same information with that same pocket so once it's received on chain B um what happens here is that the it goes from the IC protoc that understands that there was a channel connecting module or the smart Contra or module here um with module V it Rel back to the module and here the pcket data that was encoded in bites is decoded where I can clearly see this pocket was sent by Daniel by Dani address from the C Hub to my address on animal with one token or like one the item tokens with a specific amount and that is handled and I received the transaction mine balance increases and then the chain uh sends the acknowledgement back so the transaction was successful and then goes back to the chain and then after that happens the um yeah the logic isal actually yes so what are the trust assumptions for instance with respect to reacting to the time message like what like what are the trust assumptions in the sad [Music] scenarios like what happens if you have a timeout or a failure yeah um the to the logic is perverted so here for example tokens were locked n tokens were locked and then um then the voucher was minted here which represents like one itom or one virtual itom uh that is Meed online issued to me and then if the logic fails for whatever reason this voucher is never Meed or is burned and then tokens from Daniel are unlocked and send back how how do they know who is able to ex the logic of each of the applications so every the the beauty of IVC is that every module or every application that implemented the protocol is the one responsible for handling this issue from a from a protocol point of view the only thing that you need to get the only thing that IC cares is that a packet was sent a packet was received uh a time of C or Cen and the rest is handled by the application itself on its own so you define it your own application and that's why it's so it it's so game changing when when we're talking about connecting smart contract with smart contract because then we can Implement functionality like interchain farming for example or interchain workflows where you find okay I'm going to send one transtion from chain a to chain B here I'm going to like LP some tokens I'm going to get an LP token which then I'm going to send to another chain I'm going to lend those tokens and get a third token and that is going to go back to my address and that be defined by the application R so you can create like really complex interactions by leveraging this so are you fine taking more questions so what prevents me from forging for instance a time of packets and then double standing you can't you can't because then because you need to create the the connection the connection between the two chains is lightly that is already created but if you you're creating a smart contract that is malicious who's going to bind with you you need to create the channel H so like the other channel and the other chain needs to trust the logic that you're doing on your own smart contract I thought the connection was the Rel the connection is between the two chains on the channels are between smart contracts parts of the state what power does the relay have other than I assume sensoring in defin uh they can I mean there are multiple graters like they likely go if I have seen anything it's like P like so many packets being sent like when there's like high transaction volume across chains that they queue up and they're like stuck for some time and some of them time out and some of them but you need to the the key so to speak the Rel is keeping track the is also checking the proofs on you to get yes yeah that's sound automatically there's like another software that I run malicious relayer like assuming there just one relayer could they then Forge a timeout and double SP um no because then how would they create a proof like they will need to also make their own sort of like proof you need to force the proof which what what proof and is a proof of inclusion in the blockchain but what happens is that assuming never the the the new coin so how can you prove that never there's no uh there was never then okay so if it it's never Meed then it will time up because the user here on on send the token uh over to me for example D send me one he never Rees like the acknowledgement then so they kind of just there's only one which is which is like could be but there's not not a single chain that doesn't have a because they're also most of the time also valers that are running this because they care about the the interoperability and decentralization because they see this as a critical piece of infrastructure for interoperability um and then the other thing um what what could happen for example is that a re layer deys a smart contract on on um one chain and then with another chain and they create a con uh Channel between them uh that is malicious but it's both their own um their own obligation but it's two Mal obligation connected to each other so like if it's not being used for anything could it really have sent back a p m and an acknowledgement yeah will actually get the first one that is received so what's the worst scenario what's the Worst That Could Happen the worst cuz it sounds too good to be true I so just one thing that cl to mind and it's really a question I'm I'm part of trying to so like each chain has its own set of out right could there be an instance whereby um you know there's there there's there's they like storage proofs that St the chain a will send the relat checks chain B will also send storage proof but then the validators and misbehave the valid sense but then the state on chain B said it's minted that's the misbehavior part the misbehavior handling is when on the full node you have one proof but on the light line the light line is another proof so the proofs are conflicting against each other and then what happens is like it automatically sends the mbav the proof for misbehavior you have conflicting proofs and then automatically goes to the [Music] ch no but I mean that the validator is then after after the fact so what the validators is the validators pollute then your entire chain start like it has nothing to do with the protocol the protoc with the chain of course but yeah that's what I mean like if if that happens it's like the chain itself but not the protocol itself but it's like this only chain a then then what's my decision Matrix in was connection like chain maybe or something I don't know well all the stuff from the malicious chain on the good chain is workless right so it's like a big deal um like it really undermines the reasoning behind inter interoperability in the first acknowledge that what that like if the source train Source chain becomes malicious or maybe it's just not secured strongly enough that t with means that the messages that were related to M let's say all of a sudden are are no longer to be trusted so that's a view right can I ask again so just of money on the CH secure so maybe our thinking should be how it is secur because it's good now and just answering your question is there is aous Network then this is what onetwork before was it's you don't know you don't know but you don't know it's if it's you know or you don't it's on this network it's worthless because it's anous Network you are transferring worthless n to another Network then it's your problem because it's work in work out that's a that's a key part of see just like the IC protoc does not care about what you're building on top of it it does only care about the um connections the channels how they're Abed I'm sending the pocket and handling the receipt like who I see AET who am I supposed to give it to am I going to give it to Smart contract a smart contract B module Etc and it routes the the the pocket to that channel and then that that Channel with that specific behav with that specific application logic that distance logic um uh is able to like handle the content of the payload of that pack so in that sense why you're saying yeah it's true that you can have two chains binding uh malicious Channels with one another but then that's again not what the IC protocol cares but what they smart Contra behavior is like that's completely like we're abstracting the transport which is a core protocol from the application which is what smart contracts or even application specific blockchain player wants some cos prer so that in that sense yes you can have malicious behaviors but again that is obstructed from the transporting thanks question yeah I mean so you still have to um you still have to focus on like either the applications or the contracts to like a them properly like there still is some kind of I guess vality in like Community Trust that comes with chain protocol right obviously stand so information for sure I in this case you would have all the change we have standards for different applications this is a good picture because it's I mean this is even outdated there's like more than 60 chains now um connected with IBC right and obviously if you're starting a new connection um or Channel um yeah you should be doing your proper uh auditing and like you know checking the specification checking the chain that's why open source is really important um and also the validators that are actually on the network are incredibly important it's really important they're you know Tech stvy as well and know what they're talking about uh cool really cool exerpt yeah it's great keep asking questions for sure um so yeah this is um I mean yeah we talked a lot about Cosmos chain right there's actually also um some protocols connecting um Cosmos chains with uh nonos chains right using IC like we have Axel we have wor we have a bunch of others that are working on this um but yeah kind of like coming back to the interoperability part like if you have this established basically what it means is like if you start a new chain you can uh work with the standard you already have access to you know a defi ecosystem you don't need to bootstrap uh liquidity on one chain um but rather have maybe different applications that you caness access rather than having to deploy them again um same like the liquidity right like if I'm starting my new chain then I don't know if it's a game or I don't know nft Marketplace or whatever um I can still make sure that I can have access to liquidity on other chains on the Dex um through interoperability and then coming back also to the initial topic for the ux uh actually for end users it's incredibly important to to keep things simple DC did you want to mention as well yeah let's go for it [Music] cool so one of the main problems of IVC is that right now it's only for the most part it's only connecting chains with chains layer ones with layer ones but what happens when you want to start connecting smart contracts to other smart contracts um the and that's when we wanted to introduce this concept of dynamic IC so uh how you to create an application um the IC application layer or an IC app as you call it without having to go through a network upgrade or hard and so what we are introducing is um these obstructions in a form that is very um um really compatible with what solity developers are expecting in the sense of creating an AI interface that basically obstruct all the complexity of like clients connections and channel and the only thing that you need to do is like sending the pocket and handling the pocket that means uh what what you do when you receive a new Pocket Data with the pay and what do you do when you have like an un acknowledgement more time so um this is we hope really going to bootstop and and accelerate the Innovation and the piece of innovation of interop interoperable applications that going to be built using this technology um that is serving us today P Powers more than 160 chains that are alive and many more including dydx Etc um this is for customer this is not foring this is for so okay so this is for um connecting evm smart contracts to other evm smart contracts well yeah um EDM smart contracts with other VMS like coson salana VM Etc and EDM smart contracts with ler one so for example um I have an erc20 I want to send it over to Cosmos that is not IM compatible so that that logic can be handled so why do we need axela and W and so on I I will not com so like the nature um and that's the thing like we we can't have the um IC protocal that connects BFD chains for the most part because we need finality in order to execute the Cru otherwise uh you rely on this protic finality right or any economic finality As We Know or um or checkpointing whatever you whatever is your parameter for defining finality that's why we call it the finality theorum that uses not consensus Etc um so on on VF chains that prior prioritize um yeah finality over less um uh that's the IC protocol is is perfect for these use cases but when you you want to connect for example with ethereum you need to Define like what's theic finality home um and for that there's teams that are already working on this for example uh polymer uh is one team that is building two uh lik line with a theorem that is actually compatible uh where you can Define the this parameters for security and you can connect via IC with Chang in the F EOS system and even the op um the the op Foundation recently released a quest for grants for an interoperability protocol between um OB CHS OB CHS base um optimism cell and many others and so the bridges are just Bas so like what what can happen and what I would expect in the future if the IC protocol really takes off is is that these protocol would exist on top of I so you can have War point you can have ax you can have ccip ccbb and all these other brid brid terminologies that live on top of dynamic IBC or IC General um so that the Pocket Data is the same sent EDM to any message like arbitrary message bridges that we as we have them today um uses and so state of the right now is that they require liquidity provision on both sides is that account that's uh how nexts that's you have both some of the M tokens um some of them require so let's talk about what we have right now um we're still we're still working on dibc but what we actually already have sh sh uh is this thing called evm extensions which if you're familiar with pre compiles ethereum it's actually just a fancy name for it more branded name um and we I think released this a couple months ago and basically what it allows is you um like if you don't have G extensions your smart contracts are really container I'm talking to other smart contracts but they kind really access data or state I guess outside of it and with the extensions we basically about interface with smart contracts tap into core protocol functionality so these are just pre-compiled contracts it's like a given address that's defined and open for anybody to read and um there's specific ones you know for staking voting um or also IBC right so with staking you can build a bunch of applications like taking derivatives managers whatever from a smart contract level which is permission which is great from um Bo with voting you build like subd Downs or any more like I guess quadratic funding or just just more um you know exciting more Innovative applications and uh also open this up for a community to build on top so that's really great and then the IC part here is I guess really important with what we just discussed for interoperable smart contract so this IBC even an extension allows smart contracts to actually send uh like transfer packets any kind of um packets with against IC would be able to Define your custom packet right and send it to any other IC chck if the channels and the connections are set up and so uh what is actually already possible right now is uh a few use cases that that we've implemented so if you're not AA familiar with stride it's a baking chain zon um and uh they basically allow you to you know like send over your token from uh OS like as a user you can send it over to stride then perform a liquid stating transaction and then send over the liquid state uh token back to OS for any other chain use [Music] it so IDE is you still make obviously uh you benefit from the stum rewards but you can also use the um the leid token and and you more protocols so the idea here is now though that with the e extension this is available from a smart contract LEL right and actually this also all happens in one transaction and you only need to be connected to One Network which in this case would be OS so um it actually is a huge step fors I guess the usability um as well as like the the composability that you can to have on top of these uh app chain specific Services right like stride is a chain that not only allows because they OS but also a bunch of other uh tokens like Adam osmo whatever um that's based on their governance so this means they can build a own protocol in this case it's built on top of the c k with like you protocol um characteristics but it's still with like the I guess this wrapper of like OS and PP would be like smart contracts can really build on top of this service um so this functionality basically allows us to um reduce from three or even four transactions to one single transaction so for example here in order to liquid state from OS with liquid uhing functionality from stri uh traditionally a user would send a transaction uh cross transaction to strike it gets Reed then sends a second transaction here to liquid state um and then the third transaction that they would send is send they state to the CH so those are three transaction and potentially four if they didn't have the fee token the gas token here so from three or four transaction go down to one so so you can have all this in one packet is that really what it is or is it like just one call one transaction with event packet so what happens is like you actually send one package with a memo in this case and this memo contains basically all the information that needs to be parsed on the stride Zone they have a middleware for this and then it basically recognize oh this is like a liquid state call that's cross chain um call the liquid state message and send back the M token um to to the to the um defined address that was in the first place we have a similar example um coming up here with osis um but yeah we'll get to that um wait does that make sense yeah um I mean the cool thing here is also like you can also use the entire evm tooling right you could have I mean on for example we have safe safe multi right so um if you're familiar to with that or you require this kind of workflow this Poss wouldn't be first of all you have to Som get support for St sa on St chain or any other but um actually this it's already you given and you can basically use the stri service with all the tooling and and support that you already have from the beginning um and then for I guess the user perspective like this is actually the stride website like usually you connected to a stride chain but here you would only have to be connected to atos do one click transaction and U it'll to the whole um um process of sending over to State and sending it back and um we also have the dashboard and this could even you know kind of we're getting to this this place where like like I said in the beginning you only want to be on boarded once to to a chain or to a network I guess and then be able to still use a bunch of services without knowing where they're deployed and so this is something that's also going to come up we're going to try out offering like widgets um for you know the exist Community to to easily perform these [Music] transactions and uh yeah second um uh example I want to give is uh osmosis so like we want to actually perform a cross chain transfer um to swap EOS for osmo toing using the osmosis deck this is a tweet from BL who's also here in this room so this done work now we try this on Main and this is the part we can um uh also take part and and I'm going to run through it once performance transaction and uh then if you want we can repeat that with like if you if you have your own with um but what basically happens here is like you're connected to the OS Network you send the E transaction to um we call it like osmosis Outpost which is a smart contract um you can also admit this um moment this but having like Outpost contact is is kind of better for the usability because basically it defines all the um the memo and like the data that you want to send the medium extension um so it's easier interface for SM contract developers to interact with and what that will then do is for example uh send like an token over on Theos chain it would parse thiso um perform a um a swap the de and then in this case we have like Adam I guess we would also SW for osmo and then send back that Oso token through obvious trans um same way I think this is also still B blocked but um currently there's no um the IBC team is working on a standard to send two tokens at the same time to IBC there's currently no packet standard for this but as soon as that's alive we will also be able to basically provide liquidity cross okay so let's try this out um [Music] basically what we're going to do is uh just check out this this contract and then perform a um yeah basically a IBC transfer from a smart contract uh that will send over fos token from the fos main to osmosis chain there it's going to do the swap from OS to osmo and we'll send back the osmo token to the sender on onos um and so the way that this works is we have you deployed this or we've set up this um Outpost contract and um basically we just have like one one transaction called osmosis swamp um which has approval um so that like the smart contract is actually um has the authority to like actually use S these tokens from user perspective and then what it's going to do is it's going to um use the transfer message from this ic20 contract and the Isis 20 is just the name for the um like normal transfer package so that's the standard that's uh has been defined by the IC protocol and basically all the all you have to uh enter or all the parameters you have to provide is the amount of tokens the base data that you're sending over the output um which will be the osal token and then the receiver of um you know who actually wants to receive back the osal token um so what we're going to do basically is um maybe also to mention it um implements this ics2 um interface which is the um extension that I mentioned earlier and also has some types um but basically if you go to the trans um you'll see like actually just gives you the interface right you have input data and expected return um but what actually happens or where this is executed is on the core protocol in go um so what we're going to do is select the um Outpost contract make sure we have the right compiler file the contract and then um I guess we can actually it uh in a new way um so make sure we're connected to metamask um to the atos main net and then deploy this [Music] contract so we see the it's a bit too small but uh you see the the confer this actually Dey you can also check on the Block explorer that this [Music] happens um so we'll have the um like new smart contract address which also I mean I guess you could verify it but um like in the BL Explorer but it's also going to be already loaded into reix and so basically now that we've deployed The Outpost contract on the main we can already um perform this cross chain swap um so let's see how much we actually want to send over let's say like two FS put that in here um then we have the base denomination which is a A+ then we're expecting um the OS token you you also and then the receiver which will be my um my own address but it's in given in the I think the back 32 representation it's just because um like the I guess OS is kind of in between the the evm and the cosmos world so we actually support the X representation but also more like Cosmos native per representation um so this is the v21 um but soon I think it doesn't actually matter which one you use but I just want to make sure and so maybe to also check um the current balance so this is one of our dashboards and uh let me just connect with my address so currently we have like 30 here and uh 10 off tokens about 10.5 I guess um this bit later and um let's do a cross change trans why you laughing it's been for a while so so the internet question uh okay cool nice so we actually um so basically what we did is we um initiated or we we um intera with the smart contract deploy atos that then sent this IC transfer with a memal um actually I didn't show this but the uh memal composition is basically hard qued here right so this is that makes it easier um for the smart contract developer that's what I mentioned earlier for this Outpost so in this memo you have like the specific destination contract on theosis chain and any other like information they need so understand this is going to be a swap on mosis and I want to send it back to so if I look here um I guess we can actually go into the um block Explorer so if we look at the latest um contract interaction um on Ean then what we'll see is we actually interacted with contract right this is also called the um the transfer module um which is like the IC transfer you can also look into the logs um I already mentioned it's kind of performal authorization first and then the IC transfer all of this is already also emitted in evm logs and uh um you know we also see that we spend like the two and if we go back to um the balances we also see actually perform this SL so we had 30 before um and we now have 11.1 also which is obviously dependent on the uh Tex price spot price exactly uh we can also verify this um even more so if I go TOS if I go to my own address um what I basically want to see is like the incoming IC transfer of the osmo toen um so I can go to the C transactions and we see like a minute ago there was the IBC receip transfer um which should include uh the AO tool gate um 0 0.55 exactly so um this is pretty cool you can try it onet and um yeah if you want first of all have any questions for this like what we did uh so I'm curious maybe this is more like back I broke stuff but how how how's execution how calculated how does how are fees I mean so the fees are paid in case yeah in Atmos um on the precompile level you can um you define like how much um how much cost how many fees have actually accumulated so that's I guess customizable by by the protocol can also be upated if we have more protocol great I don't think it's a parameter yet but you could also say okay this is the governs that anybody can suggest yeah we know how we um we haven't I don't know by thees right now I think yeah so the base guess is just um the length of the input B time a flat uh constant yeah so that's the minimum you would need but then the guas estimation happens depending on how obviously how much logic you have in the function um right so there's some that that's yeah Yeah so basically like xtm stuff it's really hard to estimate execution clim so this is just a challenge that like overall world that exists to accurately extion accurately measure always doing the worst case scenario um yeah I mean and it sounds like that's pretty much the same here right no yeah pretty much worst case yeah I think so worst case it depends I guess on other factors like uh the fee Market and how much you need or how much I guess is congested the network at the time but yeah the followup question I have is that what happens if the transaction get R back uh right so like time time out uh and and how this so execution was already done on the receiving chain and how does like Reimers and stuff curious about how that works so in this case uh we're only interfacing with the contract once um the contracts basically us and fix F the bottom the smart contract sense the transaction with the instruction to swap but then the contct does not handle anything related to the when you receive the acknowledgement Etc that's what dynamic IC is going to be for um with the like handling the receiving Logic on the time Logic on the acknowledgement so right now it's like if you send it the pocket you you sorry you lock the token um um you send the pocket over is successful or failure if it fails then you unre the token but the contract itself the contract that D just interruped with uh does not handle that failure case that's that's not LLY by by the protocol but the ideal ke scenario is that the contract contract the contract is [Music] standards also Yeah [Music] question cont and for another you am so can interact with a contract to send another wallet tokens I mean for that you have authorizations that you can improve and that's dependent on the smart contract logic right so you could build an app that I don't know is like a manager right and if you've um I don't know whisted certain certain other addresses and they've given the approval then yeah from a smart contract you could spend another [Music] wallets yeah I mean it's uh it always depends on the the authorization that um a wallet gives to a Smart contract if there's no authorization to the smart contract then the contract won't be able to spend that Fus but it depends on the contract develop to L sorry no yeah um what I was I was going to add is that now was an EA inting a smart contract but the but the whole case about this is that now smart contracts can talk to these like interoperability uh Outpost to get outside of the chain so that's an inovative uh thing about this Outpost model extensions so that for example you can have a portfolio manager that for example um deposit some liquidity on another chain or creates a or liquid States on tokens you get the Liquid token back and then you provide liquidity on on same chain in this case edmos or somewhere else and so on and so forth so like the the possibilities to compose are endless with this architecture and that's what it's uh it's really interesting for for this mag cases so just to revisit the like IVC protocol logic yeah um so in the case where you get a timeout and then the transaction on the remote chain succeeds you've unlocked those tokens and they've also sent you the result um you won't get a time now um like what if the receiving blockchain is is slower right so if it's received on the so if the token is successful on the other chain it will automatically send your acknowledgement so the adment is part of the logic so it's not someone else needs to send the acknowledgement like is serving the chain and then oh I'm going to send an acknowledgement back it's automatically sent by the back to the original so it's like happens automically as you finalize the logic on the on the receiv receiving team okay so like I guess I guess you can't have an acknowledgement on time at the same time yeah could you have acknowledgement After Time yeah but then the time rule would already have been processed on the acknowledgement handling like like you would try to send the acknowledgement with the success or the failure and you would say oh this already time out so I already have a the time out it will drop it will drop the acknowledgements like on dismissing yeah and with the I guess how would you reverse the transaction on the remote chain um cuz that succeeded right not on the acknowledgement of the time so the time the acknowledgement failure is the same uh case as the acknowledgement as a time which is a failure case so for example Daniel transfer wants to tr for me some Auto to at most So Daniel first logs the tokens as part of the protocol he doesn't know that he's loing the tokens that's that's the part of the application itself he LS the tokens then I get some vouchers that are Meed but if the pcket time outs then um the time is receed on the on the COS p and then the to are unlocked but if someone Rel by mistake sends back on a failure acknowledgement he would say oh I already process this packet because it has a sequence we saw it before but the whenever you send a um um a pocket over it has a SE number and I would say I I already process this pack with a sequence so like anything that you say afterwards would fail because it's already hand I think the like where it becomes complicated that is like when you do these cross chain transfers you actually have two I transactions right so the one first actually has to succeed for the second one to be initiated so the first one this timeing out is not acknowledged uh there won't be any um actually swapping or sending back a token but hopefully makes [Music] makes but yeah of course like the um the logic that's happening here in this case on osis side like needs to um set I guess the cases in which the initial transaction might time out or um um fail right so I don't know I don't know if the address of the contract is is uh not cor for something like this um okay um are you guys interested in actually running through this yourself U deploying contract um or was that enough of a demonstration because we still have some time but we also have documentation is your yeah what's the best place to like start tinkering stuff um I mean we do have like I would say like do this this process like if you want I can send you some elos right now yeah um so we can try this right now um if you um go to this um page we will have some instructions and you can put your address in there and I can send you some atos and you'll be able to deploy the contract and um swap it to us but yeah for the people who are like um you know we were just going to run through this um so work with you together um if anybody else like if you don't want to do this exercise anymore that basically was the end of it but also your question for you awesome I guess like one thing that comes to mind is like that you could always front run a a uh instruction Yeah by by filling up the block such that it'll always CL out or you know by us of then it's understand um well if there's a if there's a packet that's being sent to do let's just simplify with one instruction um well I can I can send um I'm just trying to figure out a scenario where you front run that yeah like exactly yeah um but but not yeah not not for anything else other than making sure that it's timate time out well for for sending transfers it's not or swapping like yeah it's not not I mean what you can do with what the reler can do is uh de code the backet data so for example for the swap they can decode that those instructions and say like oh there's like as SW I'm going to front run them to profit and then they send they send one bucket before that one um to so you can get like so many me and then you get uh and then they send you other Market um person was origin sending it originally have like a whole like less favorable swap right um righty the TR again after you can estimate sort of the the the fees Associated for the gas execution time associated with one packet um and then you just send a bunch of smaller ones the block producer is probably going to accept the smaller ones over the big one yeah the only problem is uh not C you have a at the moment you only have a um first in first out me pool um there's also a prioritized me pool like e but it's not beh by default and so most of the on Cosmos is still fairly small I think if you also especially talk to the skip team um they've done some great analysis already but a lot of communities very in general but yeah this can be uh you knowability or using RC extended [Music] like great Workshop cheers thanks for the questions so yeah do you do you want to run through this I see like but yeah we can do it quickly so at least you can run run on with some freeos and um so if you're on the um okay if you're on the document and then B have you guys set up um so basic what if you if you haven't set up metas or doing it for the first time you can uh use your documentation here and then click on connect to myet um and then I'd probably choose like one of the rpcn points that are down here that are GRE so taking the second one example or the first one have you said that I am okay to confirm you should be able to like have your account here and then it says most and if you have that then uh you should copy your address and uh put it into this uh document here so I can send you some some real [Music] tokens you [Music] okay let me know if youve [Music] received first one should be out already got four got four at you're $4 more richer [Music] congratulations maybe okay so next step is you can also check out your your address on so you get scan it's just it's pretty similar to um um e scam I guess just different um so you can check your transactions that you do there as well um but basically what you want to do next is open remix um so let's do that and then you'll um you'll create three contracts I'll just on the root level that's the easiest um the first one will be the types uh interface so you can either copy it from here or you go to um our extensions so we will basically just have to like make sure you have the correct file name so t. so copy this contract for the set type interface you'll have the ic20 uh solity interface which again is the standard transfer package for RBC This One Imports the that's why we needed it recently and the third one you can copy um is the actual [Music] out let me know if you guys have trouble doing that did did you [Music] [Music] that's
Automatic transcript — names and jargon may be misspelled.