Messaging
Send your first interchain message in under 5 minutes
Last updated
Send your first interchain message in under 5 minutes
Last updated
This tutorial demonstrates how to:
Send a simple interchain message to a pre-deployed TestRecipient
contract.
Make Interchain gas payments to have Relayers deliver the message.
$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
Sending a message is a simple matter of calling Mailbox.dispatch()
. This function can be called easily using Etherscan+Metamask or cast.
Navigate to the Mailbox
contract page on Etherscan (see contract addresses for other chains).
Under the Contract
tab, find the Write as Proxy
button.
Click on the Connect to Web3
button to connect your Wallet (i.e. Metamask). Make sure that you are on the correct network.
Expand the dispatch
box.
For destination domain, enter $DESTINATION_DOMAIN
. You could use 137
to send to mainnet Polygon, or see other Domain identifiers.
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).
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
Submit the transaction via your wallet/Metamask
For your transfer to be executed on the destination chain, you must Manually pay for interchain gas, using 100000
for the gas amount