Omnichain DAPP
Use MAP Protocol to build Omnichain dApps.
Last updated
Use MAP Protocol to build Omnichain dApps.
Last updated
Omnichain dApp refers to decentralized apps that do not rely on any trusted third parties, but use truly decentralized methods to achieve cross-chain capabilities. You can use MAP Protocol, the peer-to-peer omnichain network focused on cross-chain interoperability, to build your Omnichain dAPp.
In the building process, MAP Protocol is primarily responsible for cross-chain message transmission. Core logic such as asset management, staking, Mint/Burn, etc., are completed and maintained by the omnichain dApps.
The following diagram illustrates the process for omnichain dApps to achieve decentralized cross-chain functionality, showing transactions related to dApp logic activities transmitted from Ethereum through the MAP Relay Chain to Polygon
The specific process is as follows:
Users interact with the dApp logic contract on Ethereum.
After the relevant logic is completed, the contract will call the TransferOut
method in the MOS contract.
The **TransferOut
**method will Emit an Event containing the calldata of the transaction in the logic contract.
The Ethereum-MAPO Messenger will listen to this Event.
The Ethereum-MAPO Messenger will construct proof data of the transaction that the Event is in.
The Ethereum-MAPO Messenger will pass this proof data to the MAP Relay Chain through the TransferIn
method in the MOS contract on the MAP Relay Chain.
The TransferIn
method will verify this proof data in the light client of Ethereum deployed on the MAP Relay Chain.
If the verification is successful, an Event will be Emitted; its content also contains the same calldata as passed by the Messenger.
The MAPO-Polygon Messenger will listen to this Event.
The MAPO-Polygon Messenger will construct proof data of the transaction that the Event is in.
The MAPO-Polygon Messenger will pass this proof data to Polygon through the TransferIn method in the MOS contract on Polygon.
The TransferIn
method will verify this proof data in the light client of the MAP Relay Chain deployed on Polygon.
If the verification is successful, the MOS contract will call the logic contract of the all-chain dApp on Polygon and execute the passed calldata.
The logic contract of the all-chain dApp can Emit an Event similar to 'execution completed'.
The MAPO Omnichain Service Contract is the core contract of MAP Protocol responsible for cross-chain message transmission. MOS Contracts are deployed on the source chain, MAP Relay Chain, and target chain to send, undertake, and receive cross-chain messages. The omnichain dApp involves two key methods:
TransferOut
: The transferOut method will be called by the logic contract of the all-chain dApp and pass the constructed calldata.
uint256 _toChain is the target chain chain id.
bytes memory _messageData is the calldata to be passed.
address _feeToken is the address of the token for which the fee is to be charged.
TransferIn
: The transferIn method will be called by the Messenger and pass the constructed transaction proof to the target chain. It will also pass the proof to the light client on the same chain for verification and execute the contained calldata after successful verification.
uint256 _chainId is the chain id of the chain where MOS is located.
bytes memory _receiptProof is the transaction proof calldata constructed by the Messenger.
Messenger is a non-privileged inter-chain program responsible for cross-chain message transmission in the MAP Protocol. Its main responsibilities are:
Listen to MOS's transfer out transactions and construct the corresponding proof data on the source chain.
Call the MOS's TransferIn method to complete the transmission of cross-chain proof data and its contained cross-chain messages.
The MAPO Executor is an interface that developers need to implement themselves, allowing the MOS contract to execute the specific logic of the all-chain dApp when called on the target chain.
uint256 _fromChain is the chain id of the starting chain.
uint256 _toChain is the chain id of the target chain.
bytes calldata _fromAddress is the initiating address of this transaction, which is the address of the all-chain dApp.
bytes32 _orderId is the unique ID of this cross-chain transaction.
bytes calldata _message is the execution logic contained in this transaction
Through the MAP Protocol's omnichain interoperability infrastructure, developers can design and develop many creative and practically meaningful Omni-DApps. Here we list some possibilities.
Omnichain DeFi refers to protocols that can accept different assets from different chains to participate in economic activities by leveraging the underlying infrastructure of MAP Protocol.
Omni-Swap aims to enable users to easily complete asset exchanges across different chains by creating liquidity pools on different chains along with the non-privileged role of MAP Protocol for cross-chain message transmission.
Omni-Loan refers to a protocol that allows using assets of one chain as collateral and borrowing assets on another chain. This enables users' single-chain assets to easily participate in different chain's economic activities without cross-chain transfers.
Omni-Staking refers to a kind of staking activity where assets of one chain participate in the staking pool of another chain without cross-chain asset exchange and earn rewards.
All-chain NFTs are NFTs that can circulate between chains while maintaining all-chain uniqueness, maintaining a unified tokenID sequence across different blockchains.
Omni-PFP is a unique Profile for Picture NFT that can be freely displayed and circulated across all chains. Users can burn their NFT on Chain A and choose to mint an NFT with the same tokenID on any other chain. These tokenIDs are unique across all chains.
Omni-DID is an all-chain ID/domain name system that allows users' Omni-DIDs to be registered and recognized across all chains. After a user registers the DID associated address for BNB Chain in the Omni-DID registration contract on Ethereum, users on BNB Chain can transfer to the user or perform similar actions through the Omni-DID.