It could be hard sometimes as a beginner to understand what’s going on in the Tezos ecosystem if you don’t master some critical terminology. You have probably heard or read about “fungible tokens” or “ERC20-like tokens” but you are left wondering what they are, what they do, how they work and most importantly, how you can create your own. As it is often the case in the blockchain universe, behind seemingly complex words are hidden very simple concepts!
This article will guide through fungible tokens on the Tezos blockchain by building a smart contract to create them, store them and transfer them using Ligo programming language (and its ReasonLigo flavor) so you can have a better understanding of what they are and how they are set to revolutionize the Tezos blockchain. We will build a simple smart contract to demonstrate the necessary functions of any fungible token. I will assume you have at least a general knowledge of some programming language, although basic knowledge of Ligo would be better to follow the code examples.
You can find the complete smart contract at this address in the Ligo web IDE. You may also check my own implementation of the TZIP-7 proposal available on Github, it contains all the code introduced in this tutorial + improvements I am working on + tests made with Truffle.
What are fungible tokens?
If you look for the definition of fungible online, you will find this: “able to replace or be replaced by another identical item; mutually interchangeable.” Fungible tokens are tokens that are mutually interchangeable with other tokens of the same type. If you have one of these tokens, you can find someone with the same kind of token, exchange each other tokens without losing any value. That is basically how bills and coins work: if I give you 1 euro coin and you give me another 1 euro coin, I still have 1 euro. They are the opposite of non-fungible tokens, i.e tokens that are unique, of different value and non-interchangeable.
One of the first public appearances of fungible tokens was on the Ethereum blockchain under the ERC20 standard (this is why this type of token is often called “ERC20-like”). The Ethereum blockchain allowed…