Message Cross-chain
Send cross-chain messages to call contracts or sync data across chains.
Overview
MOS Message enables:
Call contracts on chain B from chain A
Sync data changes from chain A to chain B
MOS uses MAP Protocol Light Client to verify cross-chain message transactions, ensuring authenticity and on-chain traceability.
Prerequisites
Application must be on a MAP Protocol supported chain
Cross-chain executable contract must authorize the MOS contract
Both source and destination chains must have MOS Message contracts deployed
How It Works
On Source Chain
DApp prepares cross-chain message and target chain callData
DApp calls MOS
transferOutmethod, paying cross-chain gas feeMOS emits cross-chain message log
On MAP Relay Chain
Messenger detects message log on source chain
Messenger builds proof data and calls
transferInon MOS RelayMOS Relay verifies via Light Client
If MAP Relay Chain is destination, executes call; otherwise emits new event
On Destination Chain
Messenger detects message log on MAP Relay Chain
Messenger builds proof and calls
transferInon destination MOSMOS verifies message via Light Client
Executes cross-chain contract call
Message Types
CALLDATA Mode
Target contract method is called directly with encoded calldata.
MESSAGE Mode
Target contract must implement IMapoExecutor interface:
Contract Interface
Usage Example
Send Cross-chain Message (CALLDATA Mode)
Receive Cross-chain Message (Target Contract)
Security
Before receiving cross-chain messages, the target contract must:
Call
addRemoteCallerto trust the source chain contract addressVerify
msg.sender == mosin receiving functions
Complete Tutorial
See Build OmniApp for a complete step-by-step tutorial.
Last updated