Chapter 10: Understanding Tokens in Ethereum

·

Tokens have become a foundational concept in blockchain technology, especially within the Ethereum ecosystem. They represent a powerful abstraction that enables digital ownership, access rights, and programmable value. In this chapter, we’ll explore what tokens are, how they work, their key properties like fungibility and intrinsic value, and the technical standards that govern them—especially ERC20 and ERC721. We’ll also walk through creating and deploying your own token using Solidity and Truffle, while discussing best practices for security, interoperability, and real-world utility.

What Are Tokens?

The word token originates from the Old English “tacen,” meaning a sign or symbol. Historically, tokens referred to small physical objects used as substitutes for money within limited contexts—like subway tokens, arcade coins, or laundry vouchers. These had little value outside their designated environments.

Today, blockchain-based tokens redefine this concept as digital assets that can be owned and represent value, access rights, or ownership of tangible and intangible assets. Unlike physical tokens, blockchain tokens are not confined to one location or organization. They can be transferred globally, traded across markets, and used in multiple applications—removing the historical limitation of "trivial value."

Tokens are created on existing blockchains (like Ethereum) via smart contracts. They do not require their own blockchain but instead leverage the security and consensus of the underlying network.

👉 Discover how tokenization is transforming digital ownership and finance.

How Are Tokens Used?

Tokens are far more than just digital money—they are programmable tools with diverse use cases:

Often, a single token combines several functions. For example, a governance token might also act as a utility token for accessing platform features.

Fungibility: Interchangeable vs Unique Tokens

In economics, fungibility means individual units of an asset are interchangeable. For example, one ether (ETH) is identical to another—making it fully fungible.

Conversely, non-fungible tokens (NFTs) represent unique items. Each has distinct properties and cannot be swapped one-to-one. Examples include:

Fungible tokens follow standards like ERC20, while non-fungible ones use ERC721.

⚠️ Note: True fungibility requires privacy. If transaction history can be traced (e.g., via blockchain analysis), certain tokens may be blacklisted—reducing interchangeability.

Counterparty Risk in Token Systems

Counterparty risk refers to the danger that another party in a transaction will fail to fulfill their obligations.

When tokens represent off-chain assets (like gold or real estate), someone must hold the actual asset—introducing reliance on custodians or legal frameworks. This creates additional risk:

In contrast, intrinsic tokens—like ETH—are native to the blockchain. Ownership is secured by cryptographic keys and consensus rules, eliminating third-party dependency.

Intrinsic vs Extrinsic Tokens

One of blockchain’s transformative potentials is turning extrinsic assets into intrinsic ones—removing intermediaries and increasing transparency.

Utility Tokens vs Security Tokens

Most projects issue one of two types:

Utility Tokens

Used to access services or pay for resources within a platform. Examples:

Security (Equity) Tokens

Represent investment stakes, profit-sharing rights, or voting power—similar to traditional securities.

🚨 Regulatory Warning: Just because a token is marketed as “utility” doesn’t mean regulators see it that way. If it behaves like a security (e.g., promises returns), it may be classified as one under laws like the Howey Test.

Many startups use utility tokens to raise funds without complying with securities regulations—a risky legal gray area.

Should Every Project Have a Token?

Not necessarily. While tokens enable new economic models, they also introduce complexity:

As the saying goes: "If it walks like a duck and quacks like a duck—it’s a duck." Regulatory bodies look at function over form.

Only create a token if it's essential to your application’s operation—not just as a fundraising shortcut.

👉 Learn how leading platforms design sustainable token economies.

Popular Token Standards on Ethereum

Before Ethereum, tokens existed on Bitcoin via protocols like Omni. But Ethereum’s programmability led to an explosion in token innovation—driven by standardized interfaces.

ERC20: The Fungible Token Standard

Introduced by Fabian Vogelsteller in 2015, ERC20 became the foundation for most tokens on Ethereum. It defines a common interface so wallets, exchanges, and dApps can interact with any compliant token.

Required Functions

Events

Optional Metadata

Implementing ERC20 Safely

While simple in theory, writing secure ERC20 contracts is challenging. Common pitfalls include reentrancy attacks and integer overflows.

That’s why developers use battle-tested libraries like OpenZeppelin’s StandardToken, which includes safety checks and extensibility features.

Building Your Own ERC20 Token

Let’s create a basic token called Mastering Ethereum Token (MET) using Truffle and OpenZeppelin.

  1. Initialize a Truffle project:

    mkdir METoken && cd METoken
    truffle init
    npm init -y
  2. Install OpenZeppelin:

    npm install zeppelin-solidity
  3. Create METoken.sol:

    pragma solidity ^0.4.19;
    import 'zeppelin-solidity/contracts/token/ERC20/StandardToken.sol';
    
    contract METoken is StandardToken {
        string public name = "Mastering Ethereum Token";
        string public symbol = "MET";
        uint8 public decimals = 2;
        uint256 public initialSupply = 21000000 * (10 ** uint256(decimals));
    
        function METoken() public {
            totalSupply_ = initialSupply;
            balances[msg.sender] = initialSupply;
            Transfer(address(0), msg.sender, initialSupply);
        }
    }
  4. Deploy using migration scripts and test via Truffle console.

You can now transfer MET between accounts and verify balances—all running locally via Ganache.

Common Pitfalls: Sending Tokens to Contracts

One major issue with ERC20 is that sending tokens to contract addresses can result in permanent loss—if the contract doesn’t support receiving them.

For example:

This has led to over $2.5 million in lost tokens.

Solution: Use approve + transferFrom

Instead of sending tokens directly, allow the receiving contract to pull them after approval:

// User approves spending
token.approve(faucetAddress, amount);

// Faucet pulls tokens when needed
token.transferFrom(userAddress, recipient, amount);

We demonstrate this with a custom METFaucet contract that dispenses MET only after approval from the owner.

Limitations of ERC20

Despite its popularity, ERC20 has flaws:

These issues break the illusion that tokens behave like native coins.

Proposed Improvements

ERC223: Safer Transfers

Prevents accidental transfers to non-receiving contracts by checking if the recipient implements a tokenFallback function before transferring.

ERC777: Next-Gen Interface

Aims to improve usability with:

ERC777 relies on ERC820 for interface detection—a registry system for contracts.

ERC721: Non-Fungible Tokens (NFTs)

Unlike ERC20, ERC721 tracks unique assets via individual IDs:

mapping(uint256 => address) private deedOwner;

Each NFT has a unique ID mapped to its owner—perfect for digital art, collectibles, deeds, or licenses.

Supports optional extensions:

Should You Use Token Standards?

Yes—standards ensure interoperability with wallets, exchanges, and tools.

But consider:

Security Best Practices

Final Thoughts: Tokens Beyond Hype

While many early tokens were speculative or fraudulent, the underlying technology holds transformative potential. From redefining asset ownership to enabling decentralized governance, tokens are reshaping finance and digital interaction.

Focus on solving real problems—not just raising funds. Build for utility, security, and long-term sustainability.

👉 Explore how top developers are building the next generation of tokenized applications.


Frequently Asked Questions (FAQ)

Q: Can I lose my tokens by sending them to the wrong address?
A: Yes—especially if sent to a contract that doesn’t support ERC20. Always double-check receiving addresses and test with small amounts first.

Q: What’s the difference between ERC20 and ERC721?
A: ERC20 is for interchangeable tokens (like currency), while ERC721 represents unique items (like deeds or collectibles).

Q: Do I need ETH to send ERC20 tokens?
A: Yes—gas fees are paid in ETH regardless of the token being transferred.

Q: Are all tokens securities?
A: Not all—but if a token offers expected profits from others' efforts, it may be classified as a security by regulators.

Q: Can I make my token deflationary?
A: Yes—by implementing a burn mechanism where tokens are permanently removed from circulation.

Q: How do I prevent unauthorized minting?
A: Restrict minting functions to trusted roles or multi-sig wallets using access controls in your smart contract.