As we have seen a small sneak peek into Hyperlane in the Introduction blog, this blog series involves the implementation of Messaging API of Hyperlane on the contracts to let your contracts work on different chains communicate with each other.
Hyperlane makes interchain communication straightforward by providing a simple on-chain API for sending and receiving messages.
Messaging API is very useful for sending data from one chain to data onto other chains. It can be used in cases of
This is a highly effective way to seamlessly transfer data on a permissionless deployment at a very low cost. As this technology is state-of-the-art and enables you to build an interchain ecosystem of contracts for your dapp, leveraging a wide range of elements such as user bases on other chains or the uniqueness of other chains, building a contract using the Messaging API becomes the stepping stone to facilitate the communication link between your contracts.
So let's get started by writing our own contract and implementing Hyperlane's Messaging API ****into it!
We would walk you through the following:
Since we've observed that Hyperlane connects two different chains, we'll construct 2 distinct contracts. The main contract will reside on chain X, where we want the dApp to be, and the child contract will be located on other chains. This setup allows users on those chains to interact with the Main contract positioned on chain X.
The implementations differ only slightly for both contracts, making it beginner-friendly.