0PricingLogin
Blockchain Smart Contracts with Solidity · Lesson

Implementing an ERC-20 Token

Develop and deploy your own ERC-20 compliant token, including transfer, approve, and allowance functions.

Build Your Own ERC-20 Token

Welcome! In this lesson, you'll learn to implement your very own ERC-20 compliant token. We'll cover the essential functions and variables that make up this widely used standard.

By the end, you'll have a working understanding of how these tokens operate at a fundamental level on the Ethereum blockchain.

Token Identity: Name, Symbol, Decimals

Every ERC-20 token needs basic identifying information: a name, a symbol, and decimals. These are often public state variables.

  • name: The full name of your token (e.g., "MyCoddyToken").
  • symbol: A short ticker symbol (e.g., "MCT").
  • decimals: How many decimal places the token can be divided into (commonly 18, like Ether).

Let's start our contract with these properties:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract MyToken {
  string public name = "MyCoddyToken";
  string public symbol = "MCT";
  uint8 public decimals = 18; // Common for ERC-20
}

All lessons in this course

  1. ERC-20 Fungible Token Standard
  2. Implementing an ERC-20 Token
  3. ERC-721 Non-Fungible Tokens (NFTs)
  4. ERC-1155 Multi-Token Standard
← Back to Blockchain Smart Contracts with Solidity