When Bitcoin was presented in 2008 it showed that it was possible to have a decentralized and trustless currency. In the following decade we witnessed the rise of many different cryptocurrencies, each one with a different goal and philosophy.
While cryptocurrencies can differ greatly from each other, they can be divided into four groups:
Originally new tokens were created by forking an existing project and changing the protocol to meet the requirements. Ethereum revolutionized this process by letting users program smart contracts that behaved like currencies, later it was formalized in the ERC20 standard.
The Stellar Network supports non-native assets directly, letting users issue and exchange their different assets. In this blog post we begin by giving an high-level overview of Stellar Assets, compare them with ERC20 tokens, and finally delve into the technical details.
There are two types of assets on the Stellar network: the native asset and credit assets. The native asset, known as Stellar Lumens (or XLM), is the asset that’s used to pay transaction fees and as base reserve for the account. The supply of Lumens increases by 1% per year from inflation.
Credit assets have no inherent value, they can’t be used to pay for transaction fees, instead their value is given by the trust users have on the asset issuer. Assets are used mainly to issue stablecoins by anchors, but there are projects that use them for security and utility tokens. The supply of credit assets is up to the issuer account. A fixed supply can be created by distributing the initial supply amount and then locking the issuer account.
Since credit assets are based on the user trust of an issuer, users have to explicitly add a trustline to an issuer before they can use an asset. Usually this is done in a few clicks from the wallet software.
Credit assets have additional features compared to Lumens, making them suitable for more complex use-cases. As we discussed previously, securities are heavily regulated and for this reason security tokens should only be held by authorized users. Stellar includes a mechanism for issuers of security tokens to authorize who can hold their assets, making it possible to comply with Securities and KYC/AML regulations. Issuers can also freeze the assets held by another account.
Ethereum is the most popular platform for ICOs. ICO on Ethereum involve creating an Ethereum smart contract (not to be confused with a Stellar Smart contract) that follows the ERC20 standard for tokens. This standard defines a common API for smart contract that enable users and issuers to:
The ERC20 standard allowed the Ethereum ecosystem to grow by enabling wallets and exchanges to support a wide range of tokens.
Stellar assets are different because they are backed directly in the Stellar protocol. This is important because it means that assets are supported by all wallets, right from the beginning. Users can enable support for the most common assets on the network with only a few clicks. Non-native assets transactions are equal to Lumens transactions in everything and are handled in the same way by the network validators, thus they are as secure as native transactions. Finally, because they are part of the protocol, all assets are improved by updates that add new functionality or that improve security (without the headache caused by upgrading smart contracts).
At the core of Stellar assets there are trustlines. Trustlines are stored on the ledger, you can find them on Stellar Expert or, if you have access to stellar-core, you can explore the trustlines table.
A trustline contains the following information:
Anyone can issue assets on Stellar, all you have to do is pick an asset code and get users to trust you! After users have added the asset code and issuer account to their trustline, they can start receiving payments from the issuer.
As we mentioned earlier, sometimes an issuer may want to restrict who can hold its asset. To do this, it must:
As we have seen in the previous section, ERC20 tokens let users to set an allowance and let another account withdraw a predefined amount. In Stellar, this behaviour is let to the users and not the asset issuer. It is easy to create an allowance thanks to Stellar support for multi-signature accounts. If Alice wants to let Bob withdraw up to 100 XLM, all they have to do is to create a new account with 100 XLM in it and add Bob to the account signers. When Alice wants to increase the allowance, they will simply transfer more funds into the shared account. Likewise, Bob will transfer funds from the shared account to their account.