Improving user experience is a goal at the forefront of Moonbeam’s cross-chain connected approach. Moonbeam is working to free users from the constraints of chain fragmentation by making it easy for developers to design smart contracts that communicate across chains — which will reduce the complexity facing the user. This scaling and connectivity is achieved using secure messaging enabled by Polkadot’s XCM, and other secure messaging.
As we move toward an increasingly interoperable multi-chain world, teams across many ecosystems work to solve the problems of isolated blockchains and the lack of cross-chain connection capabilities and applications. XCM is a solution.
XCM is a format for Cross-Consensus Communication (XCM), or “messaging” between Polkadot or Kusama parachains, smart contracts, pallets, bridges, and shared enclaves created by Polkadot for use across all blockchains.
XCM defines how messages are sent between blockchains and the format allows for the transfer of messages and Substrate tokens between Moonbeam or Moonriver and the Relay Chain, as well as other parachains on Polkadot and Kusama, respectively. This, combined with Polkadot’s heterogenous sharding (fancy speak for “each chain connected to it can be architected completely differently while still enjoying shared security”) means that applications built on Moonbeam can tap into diverse functionality and resources across the broader ecosystem. So, Moonbeam dApps can use storage, identity, or even privacy functionality that lives on different “layer one” chains within Polkadot, but from within the Moonbeam experience. This kind of functionality, plus the Polkadot and Moonbeam tools suite, create new cases for developers to create cross-chain applications.
For the end user, XCM is significant because it makes communication across blockchains possible, which means a less complex surface experience — the complexities are handled by smart contracts behind the scenes so the user doesn’t have to do everything manually.
Generally speaking, users won’t craft XCM messages themselves but will be able to benefit from apps and smart contracts that use it. Users can access and interact with applications on Moonbeam that feature functionality and tokens from many Polkadot-based projects, without having to use a bridge between independent networks. That means that people who are new to Polkadot can take advantage of Moonbeam’s Ethereum-compatible environment by using MetaMask and Ethereum-style addresses to interact with the many applications that are live. By allowing users to tap into many functionalities from a single dApp on Moonbeam, XCM streamlines the user experience.
Innovation of XCM Technology
XCM’s innovation is in the fact that it is powerful, yet remains open-ended and versatile so developers can use it to achieve whatever message-passing work they want to complete across blockchains. XCM can be used to move tokens from one parachain to another, trigger a transfer on one parachain from another, send instructions for token staking on another chain, and more.
Polkadot’s XCM protocol allows the use of any connected chain’s tokens in cross-chain DApps when the asset has been recognized via governance. Using XCM, smart contracts directly communicate, so there is less time and gas fees wasted switching between wallets and platforms and manually moving tokens across chains. Transactions and activities like gaming are simplified and faster to perform than before. With XCM, it is like every blockchain speaks the same language.
XCM creates a space for developers to create applications that can communicate across chains without traditional bridges. The XCM format is flexible because XCM itself does not send messages between systems as it is a format for how message transfers should be performed. No matter the format of the message sent on either end, messages can be delivered between them with XCM and XCMP.
XCM is not a type of protocol but rather a universal language that connects otherwise incompatible dialects to deliver information accurately between blockchains. Allowing different consensuses to speak the same language provides solutions to cross-chain problems that are not possible by other means.
XCM, along with XCMP, GMP, and XC-20s, are part of the many interoperability solutions available to builders on Moonbeam that make it a leader in secure cross-chain communication.
Defining Technical Key Terms for Cross-Chain and XCM
XCM stands for cross-consensus messaging. It is a format or language that defines how a message can be sent between interoperating blockchains, and makes sure messages are delivered and interpreted accurately, in order, and on time. It is created for, but not exclusive to, Polkadot.
XCMP stands for cross-consensus message passing, which is one of the transport methods of XCM. XCMP allows parachains to exchange messages with each other on the Relay Chain of Polkadot or Kusama and do not require a specific format.
Using a simple queuing mechanism, XCMP ensures accurate communication between parachains and all kinds of information sent between smart contracts, pallets, and more. The flexibility of this communication allows for ultimate future-proof interoperability not only between the parachains themselves but also between the other mechanisms of the unique blockchains, like smart contracts.
HRMP channels are horizontal relay-routed message-passing channels. It is a stop-gap protocol that passes messages using the Relay Chain. The temporary HRMP channel is intended to be phased out when cross-chain message passing (XCMP) takes over allowing direct parachain to parachain communication.
GMP stands for general message passing. It is the term used to describe the latest evolution in cross-chain interoperability using XCM outside of the Polkadot ecosystem. GMP allows developers to connect smart contracts on different chains together to move tokens, data, and payloads.
Cross-Chain Connected Contracts refer to the cooperation of smart contracts on the “backend” of the DApps users interact with on the blockchain. These contracts are connected across blockchains so there is no need to bridge tokens to use them in any application, on any connected chain. In addition to token movement, Connected Contracts can interact with data and resources located on other blockchains behind-the-scenes. Connected Contracts communicate using XCM and GMP.
XC-20 is a token standard unique to Moonbeam that represents ERC-20s that are cross-chain-ready. It allows Substrate tokens (from other Polkadot projects) to interact as if they were ERC-20s, while also benefiting from the cross-chain capabilities of Moonbeam. For Moonbeam-based tokens, this means they can be easily created like an ERC-20 and move across the Polkadot ecosystem with ease once onboarded via governance.
XC-20s Allow Moonbeam to Serve as an Expansion Point for Polkadot
XC-20 is the easiest way to integrate DOT or other native tokens into an existing application where an ERC-20 is needed. All of the complexity of Substrate and Rust-based development is gone and developers can work with these tokens from Moonbeam’s Ethereum-compatible environment.
Many multi-chain teams have chosen Moonbeam as their Polkadot expansion point because of its secure messaging options (including XCM), XC-20, and the full Ethereum compatibility that Moonbeam offers. Lido and Osmosis are two protocols that access the functionality of the Relay Chain for more than just token transfers.
The Lido team used Moonbeam’s Ethereum developer tools and accessed the special cross-chain functionality of Moonbeam smart contacts to control staking operations on the Relay Chain of Polkadot so that users can enjoy the flexibility of liquid staking and stDOT.
Osmosis works with Axelar GMP as does Moonbeam, which enables the addition of DOT to Osmosis exchange via Moonbeam. This process uses a combination of Axelar’s cross-chain general message passing and Moonbeam’s XCM capabilities on Polkadot.
For other parachain teams, being able to access DeFi and other services on Moonbeam with their token is also a major win along with getting access to tokens like USDC without a bridge. A larger number of parachain tokens are instantly available as XC-20s when deposited on Moonriver and Moonbeam Dapp.
For developers of new protocols, creating their token as a minted XC-20 gives maximum optionality. They can start building their app and community locally on Moonbeam, but ultimately move their token to other chains to access services there, or even to their own parachain in the future.
Impact of XC-20s on Moonbeam Ecosystem
As the technical standard for representations of fungible tokens on EVM-compatible blockchains, ERC-20 implementations have a common set of instructions necessary for dApps to interact with tokens. These consistent token standards employed by Moonbeam and other chains set the stage for developers to use common coding which is familiar, but also, to envision cross-connected contracts enabled by this foundation.
The combination of the shared communication standard of XCM and the compatibility of ERC-20 style XC-20s allows for rich interaction between non-native blockchains in that not only tokens can move between chains, but data can be shared and functions accessed from remote blockchains through a simple application interface.
The introduction of XC-20 enriches the tokens available on Moonriver and Moonbeam ecosystems and promotes token diversification. Tokens from other parachains on Polkadot will be able to seamlessly circulate on Moonriver and Moonbeam, which will enable on-chain protocols (including DeFi, gaming, NFTs, and other domains) to leverage this feature to design and build different use cases, and thus scale the imagination of users and projects.
In addition, XC-20s allow tokens from the Relay Chain to appear on parachains, allowing many users who have tokens in Polkadot.js to seamlessly and quickly transfer KSM/DOT to Moonriver/Moonbeam via Cross-Consensus Messaging formats without the assistance and security implications of cross-chain bridges, adding many new utilities to the Relay Chain governance token.
How to Interact With XC-20s
The basic steps are listed below, but a detailed tutorial for interacting with XC-20s like xcDOT is also available.
- Add Moonriver or Moonbeam network to your MetaMask wallet
- Navigate to the Moonriver or Moonbeam official dApp
- Locate “add to MetaMask” in the middle of the page. The Xc-20s are listed on the main page with simple instructions.
Cross-Chain Message Passing (XCMP) Protocol and XCM
With XCM established, Polkadot implemented common patterns for protocol messages between its parachains, one of which is Cross-Chain Message Passing (XCMP). XCMP allows parachains to exchange messages (tokens, data, and payloads) with each other when connected to the same Relay Chain and when XCM channels between the two parachains are established.
XCM is the language to describe the message being sent between networks. It does not have to be on Polkadot. XCMP uses the XCM format to allow parachains to talk to each other inside of Polkadot.
XCMP is exclusive to Polkadot (and Kusama) and overcomes compatibility issues between chains to prevent alterations that can happen over time, like new features and updates which might change native translation or messages, whereas XCM is not exclusive, and is meant to be used by other blockchains too.
XCMP allows parachains to grow and develop with not only the shared security of the ecosystem but protection from unintended alterations to transactions, creating an ecosystem that is uniquely flexible and securely interoperable.
How Cross-Chain Messaging Enables Connected Contracts
Moonbeam allows developers to design smart contracts that leverage secure messaging to connect remote blockchains. Moonbeam is the optimal location for creating these cross-chain applications since it offers access to the widest array of message-passing protocols. These include XCM and general message-passing protocols that allow developers to interact with chains outside of the Polkadot ecosystem.
Some chains that are accessible through each protocol include:
- XCM: Polkadot parachains like Acala, Astar, Bifrost, Statemint, and more (see all XCM-related announcements)
- Axelar: Avalanche, BNB Chain, Cosmos, Ethereum, Polygon, and more
- LayerZero: Avalanche, BNB Chain, Ethereum, Polygon, and layer two chains like Arbitrum and Optimism
- Wormhole: Avalanche, BNB Chain, Ethereum, Polygon, Solana, and many EVM-style chains
- Hyperlane: Avalanche, BNB Chain, Ethereum, Polygon, and layer two chains like Arbitrum and Optimism
By connecting with Moonbeam, projects can access the functionality of the Polkadot Relay Chain, including its secure validator set, and interoperability with the other parachains. Developers using these connected smart contracts are not limited to locally-available tokens and functionality on a single chain but instead can tap into resources across Polkadot (through XCM) and external chains like Avalanche and Ethereum (through the general message-passing protocols listed above) without the use of traditional bridges.
Upgrades continue to strengthen what XCM can be used for, including the XCM-to-EVM capability, for example, which allows developers on other chains to trigger function calls on Moonbeam’s EVM and access all of its features from their home chains.