Quickstart Tutorial

Send your first interchain message in under 5 minutes
This tutorial demonstrates how to send a simple interchain message to a pre-deployed TestRecipient contract. You can also check out the hyperlane-quickstart repo for running this out of the box.
Note that this tutorial does not cover paying for the cost of relaying the message to the destination chain, which will eventually be required.

Inputs

  • $OUTBOX_ADDRESS: The Outbox contract address on the origin chain. Hyperlane contract addresses can be found here.
  • $DESTINATION_DOMAIN: The domain ID of the destination chain. Domain IDs can be found here.
  • $RECIPIENT: The address of the TestRecipient contract on the destination chain, left padded to a bytes32. In our case: 0x000000000000000000000000BC3cFeca7Df5A45d61BC60E7898E63670e1654aE

Send a message

Sending a message is a simple matter of calling Outbox.dispatch(). This function can be called easily using Etherscan+Metamask or cast.
Using Metamask
Using Cast
  1. 1.
    Navigate to the Outbox contract page on Etherscan (or its equivalent if you're sending from a non-ethereum chain, which you could find here).
  2. 2.
    Under the Contract tab, find the Write as Proxy button.
  3. 3.
    Click on the Connect to Web3 button to connect your Wallet (i.e. Metamask). Make sure that you are on the correct network.
  4. 4.
    Expand the dispatch box.
  5. 5.
    For destination domain, enter $DESTINATION_DOMAIN. You can find some here, or you could use 0x706f6c79 to send to Polygon.
  6. 6.
    For the recipient address, enter $RECIPIENT. Remember to make sure to zero-pad this to a bytes32 if you are using your own address. Alternatively, you can use 0x000000000000000000000000BC3cFeca7Df5A45d61BC60E7898E63670e1654aE (our test recipient address).
  7. 7.
    For the message body, enter whatever you like! A string-to-hex converter website can help you write your message if you want to send a human-readable message. In the example below, we sent the "Hello World" string as 0x48656c6c6f20576f726c64
  8. 8.
    Submit the transaction via your wallet/Metamask
How to send an interchain message using Etherscan + Metamask
You can call Outbox.dispatch() directly using cast. Make sure that you have a valid RPC URL for the origin chain and a private key with which you can pay for gas.
cast send $OUTBOX_ADDRESS "dispatch(uint32,bytes32,bytes)" $DESTINATION_DOMAIN $RECIPIENT $(cast --from-utf8 "your message") --rpc-url $RPC_URL
--private-key $PRIVATE_KEY
If you view the transaction on a block explorer, you should be able to see the Dispatch event.
You can see an example message sending transaction here.

Confirm delivery

After the transaction that sent your message is finalized, you should be able to see a corresponding transaction delivering your message to the TestRecipient contract on the destination chain. You can watch for this transaction on Hyperlane's Message Explorer by entering the transaction hash or the sender/recipient address in the input field. You can see an example message delivery transaction here.
Test "Hello World" message sent from Ethereum to Polygon, shown in the Hyperlane Message Explorer
Read more under the Where is my message? section to use tools like the Hyperlane Message Debugger.