Send and receive interchain messages
The messaging API is powered by
Mailboxsmart contracts, which expose an on-chain API for sending and receiving interchain messages. A
Mailboxis deployed on every chain Hyperlane supports.
The network of
Mailboxesfacilitates the connective tissue between blockchains that developers leverage to create interchain applications, and add interchain functionality to their existing applications. If you'd like to learn more about them, read on!
To send interchain messages, developers call
* @notice Dispatch the message it to the destination domain & recipient
* @param _destinationDomain Domain of destination chain
* @param _recipientAddress Address of recipient on destination chain as bytes32
* @param _messageBody Raw bytes content of message
* @return A unique message ID.
bytes calldata _messageBody
) external returns (bytes32);
This function takes as parameters the message to deliver as well as arbitrary metadata that can be specified by the relayer. The
Mailboxwill pass the message and metadata to the recipient's
Interchain Security Modulefor validation.
If accepted, the
Mailboxdelivers the message to the recipient by calling
* @notice Attempts to deliver `message` to the recipient.
* @param _metadata Arbitrary metadata that can be injected by a relayer,
* used by the ISM to verify the validity of `_message`.
* May include things like validator signatures, merkle proofs,
* zero-knowledge proofs of light client state, etc.
* @param _message Hyperlane formatted interchain message.
function process(bytes calldata _metaData, bytes calldata _message) external;
The diagram below illustrates the lifecycle of an interchain message being sent from "Sender" to "Recipient", secured using a validator-based ISM.