πŸͺ™ Tronsell Wiki

TRC20 Standard β€” TRON Token Development Guide

Complete guide to the TRC20 token standard on TRON. Learn the technical specification, required functions, and how to develop and deploy TRC20 tokens.

πŸͺ™ TRC20 at a Glance
TypeFungible token standard
Based OnERC20 (Ethereum)
ImplementationSmart contract (Solidity)
Key TokensUSDT, USDC, BTT
DecimalsConfigurable (6 for USDT)
EventsTransfer, Approval

πŸͺ™What is the TRC20 Standard?

TRC20 is a technical standard for fungible tokens on the TRON blockchain. It defines a set of rules and functions that all TRC20 tokens must implement to ensure compatibility with wallets, exchanges, and decentralized applications (dApps).

TRC20 is similar to Ethereum's ERC20 standard β€” both define interfaces for token contracts. However, TRC20 is optimized for TRON's architecture and uses the TRON Virtual Machine (TVM) for execution.

πŸ’‘ TRC20 vs ERC20

TRC20 is not a direct copy of ERC20. While the function signatures are similar, TRC20 uses TRON's specific features like Energy (instead of gas) and has different event structures. Most Solidity ERC20 contracts can be deployed on TRON with minimal modifications.

βš–οΈTRC20 vs TRC10

TRON has two token standards: TRC10 and TRC20. Here's how they compare:

Feature TRC20 TRC10
Implementation Smart contract (Solidity) Native (built into protocol)
Flexibility High β€” custom logic Limited
Approvals βœ… Supported ❌ Not supported
Events βœ… Transfer, Approval ❌ Limited
Interoperability High (wallets, dApps) Medium
Examples USDT TRC20, USDC TRC20 BTT (old), WIN
πŸ’‘ Which One to Use?

For most modern token projects, TRC20 is the recommended standard. It offers more features, better compatibility, and is the standard used by major tokens like USDT TRC20.

πŸ“‹TRC20 Technical Specification

A TRC20 token contract must implement the following functions and events:

Function/Event Description Return Type
totalSupply() Returns the total token supply uint256
balanceOf(address) Returns token balance of an address uint256
transfer(address to, uint256 amount) Sends tokens to another address bool
approve(address spender, uint256 amount) Allows spender to withdraw tokens bool
transferFrom(address from, address to, uint256 amount) Transfers tokens on behalf of another bool
allowance(address owner, address spender) Returns remaining allowance uint256
Transfer event Emitted when tokens are transferred β€”
Approval event Emitted when allowance is set β€”
πŸ”§ Optional Extensions

TRC20 tokens can also implement optional extensions like name(), symbol(), and decimals() for better user experience. These are not required but highly recommended.

πŸ“TRC20 Contract Example

Here's a minimal TRC20 token contract in Solidity:

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

contract MyTRC20 {
  // State variables
  string public name = "MyToken";
  string public symbol = "MTK";
  uint8 public decimals = 18;
  uint256 public totalSupply;
  mapping(address => uint256) public balanceOf;
  mapping(address => mapping(address => uint256)) public allowance;

  // Transfer event
  event Transfer(address indexed from, address indexed to, uint256 value);
  event Approval(address indexed owner, address indexed spender, uint256 value);

  // Constructor
  constructor(uint256 initialSupply) {
    totalSupply = initialSupply;
    balanceOf[msg.sender] = initialSupply;
  }

  // Transfer function
  function transfer(address to, uint256 amount) public returns (bool) {
    require(to != address(0), "Invalid address");
    require(balanceOf[msg.sender] >= amount, "Insufficient balance");
    balanceOf[msg.sender] -= amount;
    balanceOf[to] += amount;
    emit Transfer(msg.sender, to, amount);
    return true;
  }
}
πŸ’‘ Key Points

This example includes the minimum required functions. A production contract should include approve(), transferFrom(), and allowance() for full TRC20 compliance, plus security checks and modifier patterns.

πŸ“ŠTRC20 Events

Events are crucial for TRC20 tokens as they allow off-chain applications (like wallets and explorers) to track token activity:

  • Transfer event: event Transfer(address indexed from, address indexed to, uint256 value) β€” emitted when tokens are transferred.
  • Approval event: event Approval(address indexed owner, address indexed spender, uint256 value) β€” emitted when an approval is set or changed.
  • Why events matter: Wallets use Transfer events to update balances. Explorers like TronScan use them to display token history.
  • Indexed parameters: Use indexed for parameters you want to filter by (like sender, receiver, owner).
πŸ’‘ Event Logging

Events are not accessible from smart contracts. They are only for off-chain applications. This keeps gas costs low while still providing visibility.

πŸ’΅USDT TRC20 β€” The Most Popular TRC20 Token

USDT TRC20 is the most widely used TRC20 token. Here are its key details:

  • Contract address: TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t
  • Decimals: 6 (1 USDT = 1,000,000 units)
  • Symbol: USDT
  • Name: Tether USD
  • Why it's popular: Low fees (on TRON), fast transfers, and wide exchange support.
πŸ’‘ Verifying USDT TRC20

Always verify the USDT TRC20 contract address on TronScan or the official Tether website before interacting with it. Scammers create fake tokens with similar names.

πŸš€Developing a TRC20 Token

Steps to create and deploy your own TRC20 token:

  • 1
    Write the contract

    Use Solidity to write your TRC20 contract. Include all required functions and events. You can use OpenZeppelin's TRC20 implementation as a starting point.

  • 2
    Compile and test

    Compile your contract using Hardhat, Truffle, or Remix. Test on TRON's Shasta testnet to ensure everything works correctly.

  • 3
    Deploy to mainnet

    Deploy your contract to the TRON mainnet using TronWeb, TronLink, or Remix with TRON plugin. You'll need TRX to pay deployment fees.

  • 4
    Verify on TronScan

    Verify your contract source code on TronScan so users can see and interact with your token.

  • 5
    Add to wallets

    Users can add your token to wallets like TronLink and Trust Wallet using your contract address.

⚠️ Security First

TRC20 tokens can hold significant value. Audit your contract before deployment. Use established patterns like OpenZeppelin's SafeERC20. Consider a professional security audit for production tokens.

πŸ“‹Common TRC20 Tokens

Token Contract Address Decimals Purpose
USDT TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t 6 Stablecoin
USDC TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8 6 Stablecoin
BTT TAFjULxiVgT4qWk6UZwjqwZXTSaGaqnVp4 18 BitTorrent
JST TCFLL5dx5ZJdKnWuesXxi1VPwjLVmWZZy9 18 JustStable
SUN TSSMHYeV2uE9qYH95DqyoCuNCzEL1NvU3S 18 Sun Token
πŸ’‘ Verify Contracts

Always verify contract addresses on TronScan before interacting. Scammers create fake tokens with similar names and addresses.

❓Frequently Asked Questions

What is the TRC20 standard?

TRC20 is a technical standard for fungible tokens on the TRON blockchain. It defines a set of functions that all TRC20 tokens must implement to ensure compatibility with wallets, exchanges, and dApps. It's similar to Ethereum's ERC20 standard.

What is the difference between TRC10 and TRC20?

TRC10 is TRON's native token standard that does not require smart contracts. It's simpler but less flexible. TRC20 is a smart contract-based standard with more features, including approvals, allowances, and event logs. TRC20 is the standard used by USDT TRC20 and most modern tokens.

What is the USDT TRC20 contract address?

The official USDT TRC20 contract address is TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t. Always verify this on TronScan or the official Tether website before interacting with it.

Can I create my own TRC20 token?

Yes. You can create a TRC20 token by writing a Solidity smart contract that implements the TRC20 interface, testing it on Shasta testnet, and deploying it to the TRON mainnet. Many token creation tools and templates are available.

What are TRC20 events used for?

TRC20 events (Transfer and Approval) are used by off-chain applications like wallets and block explorers to track token activity. They allow wallets to update balances and TronScan to display token transaction history without reading the entire contract state.

⚑ Save on USDT TRC20 Transfers

Integrate Tronsell Energy into your TRC20 applications for zero-fee USDT transfers. Simple API, instant delivery.