Send Messages

The on-chain API for sending cross-chain messages

Send messages to other chains by calling the dispatch() method on the Home contract.

Interface

The dispatch method is simple. Just specify the destination chain, the message recipient, and the message you want to send!

  • _destination is a Nomad domain. List of domains here

  • _recipient is the address that will receive the message on the destination chain. The _recipient must be set up to receive Nomad messages by implementing handle.

  • _message contains the contents of your cross-chain message

/*
 * @notice Dispatch the message to the destination domain & recipient
 * @param _destination Domain of destination chain
 * @param _recipient Address of recipient on destination chain as bytes32
 * @param _message Raw bytes content of message
 */
 function dispatch(
     uint32 _destination,
     bytes32 _recipient,
     bytes memory _message
 ) external {
   // message is sent to recipient address on destination chain
 }

Hello World

The example app we know and love - but make it cross-chain 🤝

Example Usage

Ready to get a little more advanced? Let's play PingPong across chains 🏓

Advanced Examples

FAQs

Why domains instead of chain IDs?

Chain IDs change during intentional consensus splits such as the merge to Eth2.0; additionally, not all chains even have a Chain ID! We created Nomad domains to have a clean standard for chains supported by Nomad which didn't suffer from these challenges.

Why are recipients bytes32 instead of address?

We use bytes32 instead of address so that, in the future, messages will be compatible with other chain VMs like Cosmos and Polkadot. In the EVM, addresses are 20 bytes long, but most other chains have 32 byte addresses. Worry not - we have a TypeCasts.sol library to help convert between these types easily.

Last updated