Deploy a TRC-20 Token with TronWeb and TronBox — TRON Wiki

Deploy a TRC-20 Token with TronWeb and TronBox

12 min read · ⌘K search

Deploying a TRC-20 token on TRON lets you create a fungible asset compatible with TronLink, SunSwap, and exchanges that support custom TRC-20 listings. The standard mirrors ERC-20 — Solidity on TVM with TronBox or TronWeb deployment scripts.

This guide walks from contract code to mainnet deployment and TronScan verification.

TRC-20 requirements

Minimum interface (see Solidity on TRON):

  • name(), symbol(), decimals()
  • totalSupply(), balanceOf(address)
  • transfer(address,uint256), approve(address,uint256), transferFrom(...)
  • Events: Transfer, Approval

Use OpenZeppelin ERC20 adapted for TRON toolchain for production tokens.

Project setup with TronBox

Code
npm install -g tronbox
tronbox init

Structure:

Code
contracts/
  MyToken.sol
migrations/
  2_deploy_token.js
tronbox.js

Config networks in tronbox.js — Shasta and mainnet fullHost pointing to TronGrid.

Full TronBox reference: TronBox smart contracts.

Example contract

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

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract MyToken is ERC20 {
    constructor(uint256 initialSupply) ERC20("My Token", "MTK") {
        _mint(msg.sender, initialSupply * 10 ** decimals());
    }
}

Adjust decimals() default (18) vs USDT (6) based on use case.

Migration script

Code
const MyToken = artifacts.require('MyToken');

module.exports = async function (deployer) {
  await deployer.deploy(MyToken, 1000000); // 1M tokens
};

Deploy to Shasta

  1. Fund deployer address with Shasta TRX (faucet).
  2. Set private key in tronbox.js or env (never commit).
  3. Run:
Code
tronbox compile
tronbox migrate --network shasta
  1. Note deployed contract address from output.
  2. Test transfer via TronWeb or TronIDE.

Deploy to mainnet

Pre-flight:

  • [ ] Security review — smart contract security
  • [ ] Sufficient TRX/Energy on deployer
  • [ ] Constructor parameters final (name, supply, admin)
  • [ ] No test private keys in repo
Code
tronbox migrate --network mainnet

Deploy with TronWeb only

Alternative without TronBox — compile locally, deploy bytecode:

Code
const contract = await tronWeb.contract().new({
  abi,
  bytecode,
  feeLimit: 1_000_000_000,
  callValue: 0,
  parameters: [1000000],
});
console.log(contract.address);

Verify on TronScan

  1. Open contract address on TronScan.
  2. Verify Contract — upload source, compiler version, optimization.
  3. Users can read name/symbol and trust bytecode match.

Unverified tokens trigger fake USDT-style suspicion from users.

Post-deploy

  • Mint additional supply only if tokenomics require — document publicly
  • Create SunSwap liquidity if public trading desired
  • Submit token info to explorers (process varies)
  • Integrate balance queries in your app

Cost and Energy

Large contracts consume more Energy. Freeze TRX on deployer account before migration to reduce TRX burn.

Post-deploy checklist

After deployment: verify source on TronScan, transfer ownership to multisig, document decimals and supply cap publicly, test transfer/approve on Shasta clone first, and add token logo via TronScan submission if applicable for wallet visibility.

Tokenomics parameters

Decide before deploy: decimals (usually 6 or 18), totalSupply, mintability, pausability, and blacklist features. Each permission is an attack surface if keys compromise. Many community tokens use fixed supply with renounced ownership — document your choice publicly so holders know trust assumptions.

FAQ

How much TRX does it cost to deploy a TRC-20?

Deployment consumes Energy and TRX depending on contract size — typically tens to hundreds of TRX if Energy is not frozen. Test on Shasta first.

Is a deployed TRC-20 token automatically listed on SunSwap?

No. Anyone can create a pool, but listing on major UIs and exchanges requires separate liquidity and review processes.

TRC-20 vs TRC-10?

TRC-20 is Solidity smart contract tokens. TRC-10 is native asset issuance without full contract logic. USDT is TRC-20.

Can I make a USDT clone?

Technically yes; legally and ethically problematic. Scammers do this — do not deploy deceptive symbols.

What compiler version?

Match TronBox supported Solidity — check tronbox compile --help and TVM explained.