Stakely Blog
September 13, 2022

What is XCM? Cross-Consensus Message Format on Polkadot

September 13, 2022

The Cross-Consensus Message Format, abbreviated as XCM, is a system or messaging format, not a protocol, enabled in Polkadot that defines how the exchange of messages between two interoperable blockchains should be carried out. Please note that this is not intended to be a Polkadot-only language, it is intended to be extended to different consensus systems, or in other words, to other blockchains outside the ecosystem.

In the same way that the IBC system exists in the Cosmos ecosystem, the XCM format allows Polkadot's parachains to communicate with each other driving interoperability between different blockchains.

In short, Polkadot allows other blockchains to connect and exchange data and value with each other. This is possible thanks to XCMP (Cross-Chain Message Passing), which is one of XCM's communication channels. This ensures native interoperability, which is one of its standards.

Types of communication channels in Polkadot

Polkadot currently has three different ways to exchange messages between its parachains: UMP, DMP, and XCMP, not counting bridges and contract pallets. Let's see what each of them consists of:

  • UMP or Upward Message Passing: allows parachains to send messages to the relay chain.
  • DMP or Downward Message Passing: allows the relay chain to send messages to any of its parachains.
  • XCMP or Cross-Chain Message Passing: allows communication between the different parachains.

Differences between XCM vs XCMP

The abbreviations XCMP and XCM are similar. Here, we need to make a distinction to avoid confusion. XCM is a message format, not a cross-chain protocol in Polkadot. In other words, it provides instructions on how the message should be understood, but it cannot transfer the message itself. XCM messages not only can be used for cross-chain protocols such as XCMP, but they can also be transferred between consensus protocols.

How does XCMP work?

Let's take an example to understand how XCMP works. Let's assume the smart contract on Parachain A wants to send a message to Parachain B. This message will then be sent to Parachain B by another smart contract that transfers some assets. Along with its destination and timestamp, the collator will place this message in Parachain A's output queue.

When Parachain B requests a new message from the network, the collator finds this message and puts it in its input queue. In order to verify that this message passing took place, the validators of Parachain A and Parachain B will also read the output queues and input queues. In order to complete the asset transfer, the new message from the input queue will be processed by the collator of Parachain B when it produces the next block on Parachain B. When the collator submits the block to the validator, the validator checks that the message has been processed and that other aspects are fine. Then, it includes the block on the relay chain.

To initiate XCMP queues, two parachains must first open a channel (similar to Cosmos' IBC channels). It's a one-way channel since both the sender and the recipient parachains identify it. At most, there can be two channels between parachains, one to send messages to the other and one to receive messages. In XCMP, a deposit in DOT is required to open the channel, and the deposit is refunded when the channel is closed.

Executing the XCM format

In the same way that smart contracts in Ethereum are executed through EVM, in this case, XCM is executed through XCVM (Cross-Consensus Virtual Machine) and allows messages to be interpreted in each of the aforementioned communication channels. XCVM is an ultra-fast non Turing-complete computer and its instructions are designed to be approximately at the same level as the transactions. XCVM includes a number of registers, as well as access to the overall state of the consensus system that hosts it.

In short, a message in XCM is a program that runs in XCVM. With this, Polkadot seeks to establish a virtual machine capable of executing a wide range of instructions that allow it great flexibility in performing different operations.

XCM goals

The XCM messaging format is at an early stage, and has some applications in the Polkadot system. However, its development must be constantly evolving if it is to establish itself as a state-of-the-art communication format. To this end, XCM must be:

  • A general language that allows intercommunication across an ever-growing ecosystem.

  • An extensible language applicable to situations that involve a change of direction, as the blockchain ecosystem is changing and evolving.

  • An efficient language that can run on-chain and in controlled environments.

XCM vs. Bridges

In recent years we have seen emerge different bridges for the purpose of sending cross-chain data and tokens from one blockchain to another. Although most of them achieved their goal, some of them have been affected by attacks, as is the case of Wormhole and

We can say that bridges are the first attempts to achieve interoperability between blockchains, but they still have certain limitations. Vitalik Buterin, co-founder of Ethereum, urges developers to create multichain systems that allow assets to be exchanged between blockchains at the same layer, rather than resorting to cross-chain solutions such as bridges.

Polkadot took the initiative to design the XCM messaging format, a native multichain system capable of transmitting data and value between blockchains from the same layer, ensuring a secure exchange environment and being operational today.

What's the future of XCM?

XCM was initially developed to share data and assets between the different parachains that are connected to the Polkadot relay chain, however, its plans go beyond that, as it allows communication between smart contracts and Substrate runtime modules, also known as pallets. XCM builders aims to make it compatible with other blockchains outside the Polkadot ecosystem, in order to ensure that there is a fluid communication of data.

Enjoyed this article?

Share it with your friends!




Types of communication channels in Polkadot
Differences between XCM vs XCMP
How does XCMP work?
XCM goals
XCM vs. Bridges
What's the future of XCM?

Top articles

Join our newsletter!

Subscribe to stay informed about the latest updates, industry insights, and exclusive offers from Stakely. Be the first to know about new features, supported networks, and expert tips for optimizing your staking experience

© Stakely 2024 | Stakely, S.L. | Company Number B72551682

C/Ferraz 2, 2º Izq, 28008, Madrid, Spain