hyperlane-quickstart repo
Quickstart Tutorial to help you start with Hyperlane
Last updated
Quickstart Tutorial to help you start with Hyperlane
Last updated
We recommend using the other quickstarts that we have prepared for you in this section, but if you would rather have a repo that you can clone, this is for you. We built this quickstart with both and in mind, so feel free to jump to the relevant sections.
You can find contracts related to this
We have both unit tests as well as hardhat tasks that show you how to develop on top of the Hyperlane APIs. To interact with the hardhat tasks on remote networks, you will need to add a private key configuration. Those keys need to have funds as well, we recommend using the to request funds. Check out our to get different funds on different chains.
When accounts are ready, start up building with hardhat, or see the package.json
scripts for a set of common commands:
If you just want to get started with sending a message, you can use the send-message
task to send a message to a pre-deployed TestRecipient
:
(Any Hyperlane-supported chain name can be used)
Now that you know how easy and quick sending Hyperlane messages are, you can deploy a sending and receiving contract. You can use the predefined HyperlaneMessageSender/Receiver
contracts and tasks to get started:
If you do not want to build a custom serialization format for your messages, you can also just use the Accounts API to make abi-encoded function calls from Interchain Accounts which are universal across chains for a given sender address on an origin chain. ICAs are identity proxy contracts which only accept calls from their designated owner on the origin chain. Thanks to the awesomness of CREATE2, calls can be referenced before they are deployed! This allows contracts on the destination chain with no custom Hyperlane or cross-chain logic to be interacted with from a remote chain!
To demonstrate this, look at this simple Ownee
contract:
We can have it be owned by a simple Owner
contract that lives on a remote chain. First, let's deploy it:
Let's get the ICA account address for this contract:
We can now deploy a (cross-chain-oblivious) Ownee
contract on a remote chain:
We can now invoke the setRemoteFee
function on the Owner
:
After a short bit, you should be able to see that the value was set, without needing to do anything on the remote chain!
What if you want to read instead of write across-chains. The Queries API is what you are looking for. The Queries API allows you to make a view call on another chain and get the result in a separate callback.
To demonstrate this, lets look at this simple OwnerReader.contract:
We can deploy it with:
Once deployed, you can have the contract make a query to read a remote owner. In this case, you can read the owner of a deployed Ownee
contract above:
You can then read the query result via:
\