Latest: TRC20 USDT daily transfer volume exceeds $20 Billion — TRON leads global stablecoin transfers

TRC20 Smart Contracts on TRON

TRC20 Network
  • Updated 2024
  • TRON Blockchain

TRC20 tokens are powered by smart contracts running on the TRON Virtual Machine (TVM). Smart contracts are self-executing programs stored on the TRON blockchain that automatically enforce the rules and conditions defined at creation. Understanding TRC20 smart contracts is essential for developers building on the TRON ecosystem.

What is the TRON Virtual Machine (TVM)?

The TVM is a lightweight, Turing-complete virtual machine designed for the TRON blockchain. It is based on the Ethereum Virtual Machine (EVM), meaning Solidity — the most popular smart contract language — works on TRON with minimal modifications. This makes it easy for Ethereum developers to port their contracts to TRON.

Required TRC20 Functions

  • totalSupply() — Returns the total number of tokens in existence.
  • balanceOf(address) — Returns the token balance of a specific address.
  • transfer(address, uint256) — Transfers tokens to a specified address.
  • approve(address, uint256) — Allows a third party to spend tokens on behalf of the owner.
  • allowance(address, address) — Returns the remaining spend allowance for a delegate.
  • transferFrom(address, address, uint256) — Executes a delegated transfer.

Optional Token Properties

TRC20 contracts can define optional properties including token name (e.g., Tether USD), symbol (e.g., USDT), and decimals (precision level, typically 6 or 18). These properties help wallets and exchanges display the token correctly.

TRC20 in DeFi and dApps

TRC20 smart contracts are the foundation of the TRON DeFi ecosystem. Protocols like JustSwap (a Uniswap-style DEX on TRON), JustLend (lending and borrowing), and SunSwap all use TRC20 tokens extensively. The standardized interface means developers can build interoperable products that work seamlessly with any TRC20 token.