Mailbox
Send and receive interchain messages
The HyperlaneMailbox
smart contracts expose an on-chain API for sending and receiving interchain messages. There is a Mailbox
contract deployed on every chain Hyperlane supports.
The network of Mailboxes
facilitates the connective tissue between blockchains that developers leverage to create interchain applications, and add interchain functionality to their existing applications.
Interface
The IMailbox
interface exposes two state-mutating functions; dispatch()
and process()
, which are used to send and receive messages, respectively.
Dispatch
To send interchain messages, developers call Mailbox.dispatch()
.
This function takes as parameters the message contents, the destination chain ID, and the recipient address. Each message get inserted as a leaf into an incremental merkle tree stored by the Mailbox
.
Hyperlane's Staking and slashing protocol uses this merkle tree to verify fraud proofs.
Process
To deliver interchain messages, Relayers call Mailbox.process()
.
This function takes as parameters the message to deliver as well as arbitrary metadata that can be specified by the relayer.
The Mailbox
will pass the message and metadata to the recipient's interchain security module for verification. If the ISM successfully verifies the message, the Mailbox
delivers the message to the recipient by calling recipient.handle()
.
See Message.sol
for more details on Hyperlane message encoding
Last updated