Send a message to any Hyperlane supported network.
Developers can send interchain messages by calling theOutbox.dispatch endpoint. At the moment, dispatched messages must be received by a contract with the handle() function. You will learn more about this in the Receive section up next, but for now let's cover the message sending interface.


interface IOutbox {
function dispatch(
uint32 _destinationDomain,
bytes32 _recipientAddress,
bytes calldata _messageBody
) external returns (uint256);
You can find the address of the Outbox contract on each chain here, and chain domains here.
_destinationDomain is the chain you're sending to, it is not the chainID, rather it is a unique ID assigned by the protocol to each chain. Domain ID's can be found here.
_recipientAddress is the receiving contract, it needs to be a contract with the handle() function, you can read about it in the Receive section.
_messageBody is the message you're passing. More on example usage below.


Recipient addresses are left-padded to bytes32 for compatibility with virtual machines that are addressed differently.
The following utility is provided in the TypeCasts library for convenience.
// alignment preserving cast
function addressToBytes32(address _addr) internal pure returns (bytes32) {
return bytes32(uint256(uint160(_addr)));

Example Usage

The code snippet below shows an example of sending a message from Ethereum to Avalanche.
uint32 constant avalancheDomain = 0x61766178;
address constant avalancheRecipient = 0x82825C0884558C9c5A94B545e7563c95aBA49197;
address constant ethereumOutbox = 0x2f9DB5616fa3fAd1aB06cB2C906830BA63d135e3;
bytes("hello avalanche from ethereum")
Copy link
On this page
Example Usage