Deploy a TRC-20 Token with TronWeb and TronBox
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
npm install -g tronbox tronbox init
Structure:
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
// 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
const MyToken = artifacts.require('MyToken');
module.exports = async function (deployer) {
await deployer.deploy(MyToken, 1000000); // 1M tokens
};
Deploy to Shasta
- Fund deployer address with Shasta TRX (faucet).
- Set private key in
tronbox.jsor env (never commit). - Run:
tronbox compile tronbox migrate --network shasta
- Note deployed contract address from output.
- Test
transfervia 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
tronbox migrate --network mainnet
Deploy with TronWeb only
Alternative without TronBox — compile locally, deploy bytecode:
const contract = await tronWeb.contract().new({
abi,
bytecode,
feeLimit: 1_000_000_000,
callValue: 0,
parameters: [1000000],
});
console.log(contract.address);
Verify on TronScan
- Open contract address on TronScan.
- Verify Contract — upload source, compiler version, optimization.
- Users can read
name/symboland 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.
Related guides
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.
Thanks — your feedback helps us improve the docs.