Receive Messages
The on-chain API for receiving cross-chain messages
Receive messages from other chains by implementing the handle() method in your cross-chain application.
Interface
The handle method passes a cross-chain message to the application.
_originis a Nomad domain. List of domains here_nonceis unique for each message within a (origindomain,destinationdomain) tuple. Many apps won't need to use this field, but it can be used to ensure uniqueness of a message._senderis the address that sent the message on the origin domain_messagecontains the contents of the cross-chain message
/*
* @notice Receive a message from a sender on the origin domain
* @param _origin Domain of the origin chain
* @param _nonce Unique nonce for the (origin, destination) tuple.
* @param _sender Address of sender on origin chain as bytes32
* @param _message Raw bytes content of message
*/
function handle(
uint32 _origin,
uint32 _nonce,
bytes32 _sender,
bytes memory _message
) external;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 ensure messages come from onlyReplica?
This ensures that the message is a real cross-chain message coming from the Nomad system, not an impostor!
Last updated