Overviewing pros and cons, this blog post explores existing standards in Tezos and compares them to Ethereum’s ERC-20 in terms of supported token types and implementations, security, etc.
What are token standards?
Blockchains make use of digital tokens, which can be bought, sold, or exchanged, representing all kinds of digital assets. The functionality and wallet compatibility of a digital token is defined by a standard. Understanding the difference between the token standards can help you to decide which option is a better fit for your blockchain project.
Token standards facilitate tokenization of applications in a blockchain. Tokenizing assets is one of the main value propositions of the Ethereum blockchain. Smart contracts need crypto tokens to function. Gas, paid in the form of ETH tokens, fuels transactions on the Ethereum network.
ERC-20 has become one the most prominent standards used for almost all smart contracts on Ethereum for token implementation. The ERC-20 standard enables developers to create tokens in a simpler and quicker way, as well as provides better integration with wallets and exchanges. What about standards and tokens in Tezos?
This blog post explores existing token standards in Tezos, their evolution, pros, and cons. The article also compares Tezos standards with ERC-20 across such parameters as supported token types and implementations, resistance to common attack scenarios, etc.
Token standards in Tezos
In Tezos, token standards are written in the Tezos Interoperability Proposal (TZIP) format. To better understand the current state of token standards in Tezos, we are going to look at the evolution of the following three proposals:
- TZIP #5: Financial Application 1—Abstract Ledger
- TZIP #7: Financial Application 1.2—Approvable Ledger
- TZIP #12: Financial Application 2—Multi-Asset Interface
Henceforward, we will call each proposal by its Financial Application (FA) number.
FA 1 (Abstract Ledger)
On March 12, 2019, FA 1 (Abstract Ledger) was created from the need for a minimal abstract ledger that can be used as a component in applications, which required some notion of a fungible asset. Initially, this proposal did not have a defined interface.
FA 1 provides a couple of improvements for Tezos:
- satisfies the need for minimal abstraction
- associates identities with balances
However, FA 1 also has some limitations:
- intentionally lacks certain characteristics (e.g., decimals, symbols, names, fallback addresses, and monetary supply management) often desired when implementing a contract
- doesn’t specify how other contracts with user funds should operate
- doesn’t provide any specific mechanism for contracts to record incoming transactions
Smart contracts in FA 1 should have the entry points shown below.
(address :from, (address :to, nat :value)) %transfer view (address :owner) nat %getBalance view unit nat %getTotalSupply
FA 1.2 (Approvable Ledger)
On June 20, 2019, FA 1.2 (Approvable Ledger), a new standard, was created to enable interactions with the smart contract. FA 1.2 implements token transfer operations and approvals for spending tokens from other accounts. It was a closer version of the ERC-20 as a usable specification in the Tezos ecosystem.
FA 1.2 provides the following advantages:
- associates identities with balances
- implements token transfer operations
- implements approvals to spend tokens from other accounts
FA 1.2 is resistant to the ERC-20 attack vector vulnerability.
Smart contracts in FA 1.2 should have the entry points shown below.
(address :from, (address :to, nat :value)) %transfer (address :spender, nat :value) %approve (view (address :owner, address :spender) nat) %getAllowance (view (address :owner) nat) %getBalance (view unit nat) %getTotalSupply
FA 2 (Multi-Asset Interface)
On January 24, 2020, FA 2 (Multi-Asset Interface) was created to prevent Tezos developers from being dependent on standards specific to token types. Specifically, FA 2 proposes a unified token contract interface, which supports a higher range of token types and implementations.
FA 2 is independent of the token type and supports both single- and multi-token contracts via a single standard. All entry points work with batch operations, allowing multiple transfers of different tokens and/or token types to be executed in a single atomic transaction. This standard requires developers to handle common considerations, such as defining the contract’s token type (e.g., non-fungible vs. fungible vs. semi-fungible), administration and whitelisting, contract upgradability, and supply operations (e.g., mint/burn).
FA 2 provides the following benefits:
- offers a standard for a unified token contract interface
- supports a wide range of token types and implementations
- provides token transfer semantics
- supports various transfer permission policies
- resistant to the ERC-20 attack vector vulnerability
Smart contracts in FA 2 should have the entry points shown below.
| Transfer of transfer list | Balance_of of balance_of_param | Total_supply of total_supply_param | Token_metadata of token_metadata_param | Permissions_descriptor of permissions_descriptor contract | Update_operators of update_operator list | Is_operator of is_operator_param
Comparing ERC-20 and Tezos standards
To better understand the similarities and differences of ERC-20 and the standards available in Tezos, the following table provides a summary of details discussed previously.
Additional details about the FA 2 standard can be found in the TQ Tezos blog.
This article is also available on medium. That’s where you can find some relevant articles on the topic and others related to deFI.