LogoLogo
  • ⏩Introduction
    • Hyperlane Introduction
    • Getting started
    • Why Should You Use Hyperlane?
  • Permissionless Interoperability
    • Overview
    • Deploy Hyperlane
    • Warp Routes
      • Deploy a Warp Route
      • Deploy a UI for your Warp Route
    • Modular Rollup Interoperability
  • Build With Hyperlane
    • Quickstarts
      • Messaging
      • Accounts
      • Queries
      • hyperlane-quickstart repo
    • Guides
      • Finding my messages
      • Automatically pay for interchain gas
      • Manually pay for interchain gas
      • Choosing an interchain gas paymaster contract
      • Unit testing
      • Specifying an ISM
      • V2 migration guide
    • Explorer
      • Debugging messages
      • Configuring PI Chains
      • REST API
      • GraphQL API
    • Troubleshooting/Developer FAQ
    • Example apps
  • APIs and SDKs
    • Messaging API
      • Send
      • Receive
    • Accounts API
    • Queries API
    • Warp Route API
    • Interchain gas paymaster API
    • Hyperlane App Framework
      • Example usage
        • HelloWorld
        • Interchain Token
      • Solidity SDK
        • HyperlaneConnectionClient
        • Router
      • NodeJS SDK
        • RPC Providers
        • Deployment
        • Interchain testing
        • Quoting gas payments
        • App Abstraction
    • Hooks API
      • Contract addresses
  • Protocol
    • Overview
    • Mailbox
    • Interchain security modules
      • Interface
      • Multisig ISM
      • Routing ISM
      • Aggregation ISM
      • Optimistic ISM
      • Wormhole ISM
      • Hook ISM
      • CCIP-Read ISM
    • Interchain gas payments
    • Staking and slashing
    • Agents
      • Validators
      • Relayers
      • Watchtowers
    • Warp Routes
    • Implementation Guide
  • Operators
    • Validators
      • Guide
      • AWS setup
      • Monitoring and alerting
    • Relayers
      • Guide
      • Message filtering
    • Agent keys
      • Hexadecimal keys
      • AWS KMS keys
    • Agent configuration
      • Configuration reference
    • Running with docker compose
  • Resources
    • FAQ
    • Glossary
    • Contract addresses
      • Permissionless Deployment Contract Addresses
    • Domain identifiers
      • Permissionless Domain Identifiers
    • Default ISM settings
    • Coming Soon: Hyperlane v3
    • Token sources & faucets
    • Latencies
    • Github
    • Discord
    • Website
Powered by GitBook
On this page
  • Inputs
  • Send a message
  1. Build With Hyperlane
  2. Quickstarts

Messaging

Send your first interchain message in under 5 minutes

PreviousQuickstartsNextAccounts

Last updated 2 years ago

This tutorial demonstrates how to:

  • Send a simple interchain message to a pre-deployed contract.

  • Make Interchain gas payments to have Relayers deliver the message.

Inputs

  • $MAILBOX_ADDRESS: The Mailbox contract address on the origin chain, see Contract addresses.

  • $DESTINATION_DOMAIN: The domain ID of the destination chain, see Domain identifiers

  • $RECIPIENT: The address of the TestRecipient contract on the destination chain, left padded to a bytes32. In our case: 0x00000000000000000000000036FdA966CfffF8a9Cdc814f546db0e6378bFef35

Send a message

Sending a message is a simple matter of calling Mailbox.dispatch(). This function can be called easily using Etherscan+ or .

  1. Navigate to the Mailbox contract page on (see contract addresses for other chains).

  2. Under the Contract tab, find the Write as Proxy button.

  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. Expand the dispatch box.

  5. For destination domain, enter $DESTINATION_DOMAIN. You could use 137 to send to mainnet Polygon, or see other Domain identifiers.

  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 0x00000000000000000000000036FdA966CfffF8a9Cdc814f546db0e6378bFef35 (our test recipient address).

  7. For the message body, enter whatever you like! A 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. Submit the transaction via your wallet/Metamask

You can call Mailbox.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 $MAILBOX_ADDRESS "dispatch(uint32,bytes32,bytes)" $DESTINATION_DOMAIN $RECIPIENT $(cast --from-utf8 "your message") --rpc-url $RPC_URL
--private-key $PRIVATE_KEY

For your transfer to be executed on the destination chain, you must Manually pay for interchain gas, using 100000 for the gas amount

Manually pay for interchain gas
TestRecipient
Metamask
cast
Etherscan
string-to-hex converter website
How to send an interchain message using Etherscan + Metamask
Mailbox