Introducing XC-20s, the New Standard for Cross-Chain Tokens on Dotsama
Dec 13, 2022
8 min read
share
This is an updated version of the article that was originally published on April 13, 2022.
XC-20s are fungible tokens that are natively cross-chainGo to page https://moonbeam.network/builders/connected-contracts/ ready and also act as regular ERC-20s. This is a unique asset class that was first introduced on Moonbeam and Moonriver, which are Ethereum-compatible parachainsGo to page https://moonbeam.network/education/what-is-a-parachain/ building cross-chain connected applications on top of Polkadot and Kusama, respectively.
EVM compatibility enables ERC-20 tokens to be easily deployed on the networks, which is a key ingredient of making a successful EVM DApp. However, unlike in other EVM-compatible environments, ERC-20 tokens on Moonriver and Moonbeam can also be used in cross-chain scenarios, including on other parachains, which is why they are referred to using a new term (XC-20s).
XC-20s can denote tokens with two different origins: tokens created on Moonriver and Moonbeam, or tokens created on other chains including Substrate-style tokens from other parachains that have been deposited on Moonriver/Moonbeam. As XC-20s, ERC-20s created on Moonriver and Moonbeam’s EVMs are able to move into the wider Kusama and Polkadot ecosystem of parachains. A number of parachains have successfully opened and are actively using HRMP channels, which enable the movement of XC-20s around the ecosystems.
What is the XC-20 standard? How does it impact Moonbeam and Moonriver?
Substrate tokens are natively interoperable, but to streamline the developer and user experience for those familiar with Ethereum, Moonbeam introduced the concept of XC-20s, a key piece of cross-chain interoperability.
XC-20s act as regular ERC-20s on Moonriver and Moonbeam networks, which means that tokens from connected chains can be used in applications that are ERC-20 compatible. For example, Polkadot’s token DOT can be used on Moonbeam as xcDOT.
As a user, native Substrate tokens are simple to use and move around the Dotsama (Polkadot + Kusama) ecosystem. Moonbeam’s XC-20 technology makes it possible for those same Substrate tokens to be brought onto Moonbeam and used with Ethereum-style applications as ERC-20s. Similarly, Moonbeam-native tokens can be sent to other networks and used in new ways across parachains and in a Substrate format.
Developers can integrate XC-20sGo to page https://docs.moonbeam.network/builders/interoperability/xcm/xc20/overview/ using tools and dApps from the Ethereum development environment, setting the stage for the next phase of interoperability on Moonbeam with the larger blockchain world.
The Basics of ERC-20s and Wrapped Tokens
The term ERC-20 refers to a token standardGo to page https://ethereum.org/en/developers/docs/standards/tokens/erc-20/, 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.
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 expected. This is a huge benefit, as it saves developers time by not having dozens of different versions of the same code which makes them more 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 of Ethereum. The proliferation of EVM support across many ecosystems has had a strong role in this: ERC-20s are often the de facto 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, which is not the case with XC-20s on Moonriver and Moonbeam.
In general, the process of wrapping tokens is usually facilitated by a bridge, which provides the infrastructure required to move assets between different chains. Developers 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. The system is frequently operated by middlemen and requires custom integrations for each destination chain and for each token. This design can introduce problems: 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 designed the same, and each handles security in different ways. Despite these challenges, token bridges remain a common way to bring value to new networks and move Ethereum-based ERC-20s to new ecosystems.
XC-20s are Cross-Chain ERC-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)Go to page https://moonbeam.network/blog/xcm-on-polkadot/ 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, developers on Moonbeam 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 invoke 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 xcKSMGo to page https://moonbeam.network/announcements/moonriver-adds-cross-chain-capabilities-and-xcksm/, an XC-20 representation of the native Kusama token. Similarly, xcDOT was the first cross-chain asset to make its way to Moonbeam.Go to page https://moonbeam.network/announcements/moonbeam-adds-xcdot/
These tokens, as well as any other parachains’ tokens, have become regular ERC-20s from the perspective of the EVM, allowing them to be used in decentralized applications. The connection can work in reverse, too, allowing native Moonbeam- and Moonriver-based XC-20s to be transferred to other parachains.
Two Types of XC-20s
External XC-20s are native cross-chain tokens transferred to Moonbeam from one parachain or the Relay Chain. These tokens appear with “xc” before the token name, like xcDOT, and reside in Moonbeam’s sovereign account on each chain.
Mintable XC-20s are minted and burned directly on Moonbeam and can still be transferred to other parachains. These tokens are not native to other parachains or the Relay Chain, so the name and symbol of the token name do not necessarily have the xc prepended to its name.
Depositing Tokens as ERC-20 Compatible XC-20s
Some technical setup is still required to activate this cross-chain interaction, such as opening an HRMP channel between Moonriver or Moonbeam 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.
XC-20s Available on Moonriver and Moonbeam
The list of tokens activated for cross-chain interaction as XC-20s continues to grow on both Moonriver and Moonbeam. The full list of XC-20 are available on the Moonbeam Staking App.Go to page https://apps.moonbeam.network/moonbeam
XC-20s Registered on Moonbeam