Build in Hyperlane
ETH Vietnam 2022 · November 2022 · 10:01
Choosing a blockchain determines which users, liquidity and protocols an application can reach, and the speaker argues interoperability should shift into applications rather than burden users. Hyperlane is presented as smart contracts that relay arbitrary messages between chains through mailboxes and validator-signed Merkle roots. Further interfaces cover cross-chain account control, remote state queries and multiple value bridges, but the base messaging layer sends data rather than value and the planned demos are skipped.
Speakers
Topics
From ETH Vietnam 2022, hosted by ETH Vietnam.
Transcript
um well I hope everyone's good time sorry for the technical difficulties um I'm here to talk about hyperbole uh what we call it interchange Highway and so if you're interested in building multi-chain applications maybe go give it a listen so you could ask yourself what is The Interchange Highway uh what is the state of blockchain state today we're basically living in a world where we have these really cool valuable States but they're on all in very different blockchains and they're all super isolated so we have like ethereum polygon arbitrum optimism all these different chains uh but just surprisingly it might as well be in different galaxies
um and so when you deploy let's say your application that you're building on here today you have to decide like which blockchain do you deploy this on right and that shows the blockchain has like huge ramifications for your application it decides what users can access to your application the science which uh liquidity can access your applications it also decides what other protocols can you compose with and so we believe that that's just not uh the end State like that's just not going to be how crypto scales and so the question is what is the end state um we believe we've gone through several different eras of interoperability so we first started in 2016 when like Cosmos
and polka dot had their uh kind of like intellectual I guess start where interoperability happens within a very set structure right so IBC and xmcp all work when you are able to run like clients uh that kind of understand natively the consensus of the other chains however 2020 come about and there's this explosion of alternate layer ones and with that came the need to be a droppable between very heterogeneous chains right so like Avalanche polygon all these things needed to be droppable and so we came up with this what we call Asset Centric interoperability where users had to figure out how do you move from chain a to chain B
and so that's what most people associate Bridges today is basically user figuring out okay how do I get E from ethereum over to Malik on polygon however this requires users to interact with infrastructure and I think if you've learned anything from the last like 30 years of building digital and so we believe 2022 will be the start of the era of app Centric interpretability where interoperability actually gets moved to the application of the developer and so that allows you as application developer to basically like internalize the trade-off of like how do you move state from one trade to another um and remove that burden from the user
and so I think that Canada is so undefined but like this year was the first year where people started to realize that um and so hyperlane is what we call the road to that interchange and Singularity right well blockchains and applications are all connected with each other oh I haven't provide this kind of super seamless user experience where users don't have to interact with infrastructure and so this avoids kind of just like oh like Aptos coming around and solving all of our blockchain problems like no single blockchain will solve our blockchain problems it will be this like large internet of blockchains and so hyperlane is the network between those blockchains okay so how does hyperlane work hyperlane ultimately is a set of smart
contracts that you as a developer can use to send them from An Origin chain to a destination chain so the course very simple you as the sender call our mailbox Mark contract with the dispatch function the mailbox basically is an incremental Market Tree on chain and so once you added your message to that vertical tree we are calling the dispatch validators will sign the root of that Markle tree which allows that tree to be relayed to the mailbox from the destination chain and then that mailbox will call handle on the recipient contract and so conceptually that's pretty simple and the API looks like this so on the mailbox
you call dispatch with the destination chain ID the recipient so like the address on uh the destination chain and then the message which is just arbitrary message bytes um note that in this case the recipient is not an address type the device 32 because while we are currently only supporting the VM other chain environments may have not just 20 bytes for an address identifier uh they're in destination your recipient just needs to implement this interface called handle and that handle function gets called the three arguments the origin chain which again is just the ID of the chain the sender just the entity calling dispatch On the Origin
chain and then the message itself you can use our message Explorer to basically then track the progress of a particular message from one chain to another and get links to the equivalent block explorers of those chains as well um normally I would show you a demo here but I'm just going to keep going uh so at the base that's any interoperability protocol right like the passing of arbitrary message bytes uh but what we realized is that a lot of times people actually like a lot of people always want to do more than just send arbitrary fights and so the manage API is very much unapinated in a sentence you can send anything you want
but oftentimes applications have like very specific things that they want to do and developers would have to kind of specify that themselves in terms of like how to structure basically intent and so common things like ownership uh we can basically abstract away in what we call interchange accounts so basically internet accounts allows smart contracts to affiliate control and account on another blockchain um and so think of it basically as like a like custom proxy account for a particular uh sender and origin tune and that proxy account will basically make arbitrary calls as defined by the owner On the Origin chain
so it's a slightly more complicated than the original messaging API but basically you still call dispatch on an hyperlink contract that hyperlink contract will serialize your call uh on onto the messaging API it will relate that to the destination chain the hyperlink contract will basically a relay that call to that custom ICA which basically acts as a proxy of the sender um and then the ICA will make that specified call as specified by the sender and so the really cool thing here is that the origin chain interface looks very same right you can call dispatch the destination chain the recipient and then the data which is just like the Avi
encoded function calls but then on the destination chain you have to have no hyperlane specific uh contract because the ICA just makes that uh function call for you so that allows I think developers to build these kind of cross-interactions without even like much less service area again would normally have a demo but I'll keep going uh in the next kind of API that we have is interesting queries so again like uh normally you could totally build this yourself to realize that oftentimes developers what they want to do is On An Origin chain just be able to read State on a destination chain and so we have a very simple API for that as well you call query on the
high blank contract with the call that you want to make on a destination chain as well as a callback that will be called On the Origin chain with the result of that remote uh view call and so yeah you can see us here I'm going to speed level forward on the origin chain you once again have this very simple uh interface you have a destination chain the Target on the destination chain the API encoded view call and then the Callback and once again on destination chain you have to have no surface area or do a demo we'll do it later if you want uh the last API that we can present is the liquid layer API so only sense data it does not send value um there's a whole topic that I'm happy
to go into uh find me offline if you care about uh basically the question of canonical versus rap tokens the hyperlane security layer is basically unified interface that will allow you to use multiple value Bridges like the recently announced circles that have used to see Bridge um so the interface is a little it's basically the same as the messaging API you have to dispatch a function now you have three added arguments the token address the amount that you want to transfer and then the bridge identifier so like in this case we'll Circle a portal and an investigations change you have exactly the same panel interface except you also get the token address and the amount and again we'll skip over the uh the API demo all of this happens in five minutes
you can go into our docs and you can just do it yourself with metamask simple all right um I think everyone's busy here but if you have any questions uh come find me um I'll also be at the booth um and yeah like definitely uh you can contact me I'm happily like so Z on Twitter um or come check out uh our docs and docs.xyz um cool um I think that's it um yeah happy hacking thank you so much I made a YouTube right now for your very detailed