Token Standards — Part 1 : Why token standards?

td-bn
4 min readAug 10, 2021

--

Everybody in the cryptoverse has heard of “ERC20”. Token standards are essential for Ethereum developers and investors who want to get a deeper understanding of how things work. In this series of posts, I aim to tackle these from first principles. We start with what tokens are before diving into token standards and benefits of having token standards. In the following posts, I will discuss some of the main token standards on the Ethereum blockchain.

What are tokens?

The Merriam-Webster dictionary defines tokens as:

  • a piece resembling a coin issued for use by a particular group on specified terms
  • a unit of a cryptocurrency

When talking about tokens in the crypto ecosystems, it helps to think of them as abstract pieces resembling a coin or a unit on the internet. Just like real world tokens represent something that can be owned and used, similarly tokens in the crypto universe represent virtual coins/tokens that can be owned and used.

Deploying tokens on Ethereum

Suppose I want to create a token that my friends and I can use when playing card games. We could use this token for putting something on stake instead of real money — cause my mom once told me not to gamble.

Here is what a simple token contract could look like on Ethereum:

contract Chips {
string name = "Chips";
string symbol = "BOYS";
uint totalSupply = 10000;
}

If I deploy this contract on the Ethereum network, this is a valid token although it does nothing.

Suppose I wanted to give these BOYS tokens to my friends to be used in our card games. I could write a function to transfer some of these tokens to their addresses.

contract Chips {
string name = "Chips";
string symbol = "BOYS";
uint totalSupply = 10000;
function transfer(address _to, uint _amount) public {
// Logic to transfer the funds to another ethereum account
}
}

Cool, now I’ve transferred some tokens to my friends. Let’s say we all decide that we stake 100 token each on a game with the winner getting all the tokens. But as we play, we might notice that keeping track of balances is difficult when tokens are changing hands. Let’s add a function to check balance of the tokens. That’ll come in handy.

contract Chips {
string name = "Chips";
string symbol = "BOYS";
uint totalSupply = 10000;
function transfer(address _to, uint _amount) public {
// Logic to transfer the funds to another ethereum account
}

function balance(address _of) public {
// Logic to return the balance of an address
}
}

If my friend Arjun came from out of town to join us one fine day, we’d have to educate him about how to transfer these tokens and check the balance and so on for any other things we want to do with our tokens.

Imagine people creating tokens for all the use cases that they can think of e.g. a store might want to give some tokens to their customers on a purchase, a service provider could ask for tokens for the services they provide, some advertisement agency could pay you in tokens for watching ads. Each of these would have their own functions to interact with the token on the blockchain and we’d have to learn how to do that, just as my friend Arjun would have to learn to interact with our BOYS token.

Token Standards

As we see use cases for the use of tokens, we might notice that there are some things that we want to do with our tokens irrespective of what use case we are using them for e.g. we want the ability to transfer tokens or we could want to query the balance of an owner of tokens to see how many tokens that owner has no matter the use case of that token. Token standards address exactly this use case. As more and more tokens come into existence, we notice that some things we want to do with those tokens are common. So instead of finding how to do them for individual tokens, we define a standard for all tokens to follow. This improves usability.

Token standard are a set of guidelines to follow. Tokens following a standard behave in a similar, predictable manner as mentioned in the standard, e.g. transferring, querying balance — all work in predictable ways.

Why standardization?

What would the internet be without standards?

Imagine an internet without protocols in place that allowed users to abstract away the details and work on the actual features and use cases of the technology. The world would be a different place if the internet didn’t have standardized protocols.

Benefits of standardization:

  • Improves clarity — because we don’t have to worry about how something works under the hood. We don’t have to go searching for how to transfer this token or that token. All tokens following a token can be transferred in a the same way.
  • Guarantees quality — because things are done in a predefined, optimized way
  • Promotes productivity — because users won’t need to ask around or comb documentation to get answers. Once you know the standard you know how all tokens following that standard work. It also minimizes the chances that crucial details will be overlooked.

In this series, I’ll talk about ERC20, ERC721 and ERC1155 token standards in Ethereum.

--

--