Skip to main content

Note to self: ERC-20 Tokens

The idea of tokens play a special role in blockchain networks like Ethereum. It represents an asset or a right to a resource on the blockchain. For example, tokens can represent a unit of a cryptocurrency created on a blockchain network such as Ethereum, a stake in a company, access rights to a dataset or ownership of a piece of artwork.

As stated in a blog post by Gemini:

Cryptocurrency and tokens are unique subclasses of digital assets that utilize cryptography, an advanced encryption technique that assures the authenticity of crypto assets by eradicating the possibility of counterfeiting or double-spending.

The key differentiation between the two classes of digital asset is that cryptocurrencies are the native asset of a blockchain — like BTC or ETH — whereas tokens are created as part of a platform that is built on an existing blockchain, like the many ERC-20 tokens that make up the Ethereum ecosystem.

In particular, on Ethereum, tokens written according to the ERC-20 are fungible and defines a standard API to interact with them. For example, all ERC-20 tokens will have a totalSupply method that enables the querying of total supply. In a way ERC-20 tokens on Ethereum is itself a smart contract.

ERC-20 tokens are fungible in the sense that one token is not distinguishable from the other. Like a dollars in a bank account or company shares of the same class. It does not matter which one you own (if you can even distinguish them in the first place), any of them will allow you to lay claim to the same amount of rights over some asset or resource.

A well-written resource by Jim McDonald on understanding how ERC-20 tokens work is here. From his explanation, what I understand is that ERC-20 tokens are smart contracts