Moonbeam and Moonriver are Ethereum-compatible parachains on top of Polkadot and Kusama, respectively. This compatibility enables ERC-20 tokens to be easily deployed on top of the networks, which is a key ingredient of making a successful EVM DApp. Now, with the introduction of the XC-20 standard, ERC-20 tokens on Moonriver and later Moonbeam will become compatible with the Substrate native token format. This will have profound implications for cross-chain interoperability, so let’s review why the new XC-20 format matters, and how it works.
The post was originally published in Moonbeam.
Currently, locally-created ERC-20s exist on Moonriver’s EVM, but they aren’t able to move into the wider Kusama and Polkadot ecosystem of parachains. With cross-chain capabilities enabled, the Moonbeam team has introduced a new format, called XC-20, which refers to fungible tokens that are natively cross-chain ready but also act as regular ERC-20s on Moonriver or Moonbeam.
The Basics of ERC-20s and Wrapped Tokens
The term ERC-20 refers to a token standard, a set of instructions shared by all those who adopt it. ERC-20 has established itself as the technical standard to represent fungible tokens on EVM-compatible blockchains (ERC stands for Ethereum Request for Comment, by the way).
The standard represents a shared set of functions that each token smart contract should implement (in programming terms, it’s an interface). All ERC-20 implementations must have a set of key functions that define their behavior, for example “transfer,” “mint,” “burn” and others.
Having a set of common instructions for all tokens is absolutely crucial for building DeFi apps, as they will often have to interact with tokens. With the ERC-20 standard, apps like Uniswap or Aave can support tens of thousands of unique tokens with just one code implementation.
The standard gives developers the “peace of mind” of knowing that if they call an ERC-20 function on an ERC-20 compliant token, the function will work, and it will work as you’d expect. This is a huge benefit, as it saves developers time by not having dozens of different versions of the same code (prone to bugs and complexity).
ERC-20 Tokens Outside of the Ethereum Network
Though the ERC-20 standard is most commonly associated with its namesake network, it is in common use on many networks outside Ethereum as well. The proliferation of EVM support across many ecosystems has had a strong role in this: ERC-20s are often the defacto standard for native tokens on EVM-compatible networks like Moonbeam. However, outside of this scenario, most ERC-20 tokens are wrapped versions of a particular token.
In general, the process of wrapping is usually facilitated by a bridge, which provides the infrastructure required to move assets between different chains. They will create special copies of the ERC-20 contract on the destination chain that can be minted by the bridge. Then, whenever users make bridging transactions, their assets are locked on the origin chain while the corresponding wrapped token is minted on the destination chain.
The wrapped token usually maintains its value on the other network, because it can be easily redeemed back through the bridge. But the system is frequently operated by middlemen and requires custom integrations for each destination chain and for each token. This design can also introduce risk: the bridge must maintain a 1:1 balance for wrapped tokens and their native counterparts, which has proven to be an attractive target for hackers looking to exploit the system through faulty smart contract logic or poor security hygiene. However, not all bridges are the same, and each handles security risks in different ways. Despite these risks, token bridges remain a common way to bring value to new networks and move Ethereum-based ERC-20s to new ecosystems.
Cross-Chain ERC-20s (XC-20s)
XCM Allows for Interoperability
Polkadot’s architecture allows parachains to natively interoperate, enabling cross-blockchain interactions and transfers of any type of data or asset. XCM (cross-consensus messaging) provides a shared communication standard between all parachains on Polkadot, meaning that rich messages can be passed natively between the different layer one parachains with ease. This serves as a common messaging standard that simplifies the complex cross-chain communication process into one main implementation. Polkadot and its parachains can communicate with each other via XCM and transfer data in a language that both can interpret easily.
With XC-20s, the Moonbeam team created compatibility between the EVM and the Substrate framework that powers Polkadot. Substrate-native tokens are made accessible in the Moonriver and Moonbeam EVMs via the use of precompiles — special built-in smart contracts that are made to look like ERC-20s. Calling functions on an XC-20 actually invokes underlying Substrate functionality, which could be instructions to move tokens to another chain or send them to another local address. This compatibility layer connects the world of Ethereum tools and smart contracts to advanced Substrate-based interoperability scenarios.
The first XC-20 on Moonriver was xcKSM, an XC-20 representation of the native Kusama token. Similarly, xcDOT will be the first cross-chain asset to make its way to Moonbeam once XCM is enabled on Polkadot. These assets, as well as any other parachains’ assets, have become regular ERC-20s from the perspective of the EVM, allowing them to be used in DeFi or other applications. The connection can work in reverse, too, allowing native Moonriver-based XC-20s to be transferred to other parachains. Some technical setup is still required in order to activate this cross-chain interaction, such as opening an HRMP channel between Moonriver and the target chain, but the core functionality is already built into the parachains.
Not all tokens will be immediately available for advanced XCM interactions, but XC-20 lays a key foundation for building a seamless cross-chain environment in Dotsama. Sitting at the crossroads of Dotsama and the Ethereum ecosystem, the XC-20 standard allows tokens from other parachains to flow into Moonbeam, making them accessible to the Moonbeam EVM and all the DeFi applications that live there. Additionally, any XC-20s minted on Moonbeam gain the same benefits in reverse: they can be used as if they were ERC-20s on Moonbeam but can also move out to other parachains. In this way, Moonriver and Moonbeam are able to become the heart of cross-chain DeFi activity in Dotsama.
In the beginning, Moonbeam will only support remote transfers, the most common transfer format. Depending on the target blockchain, asset transfers can be done via teleporting or remote transfers. Learn more on this here.