Create a TRC-20 token
Your own token on TRON — not USDT, not a stablecoin.
1. Name and supply
_nameMy Token
_symbolMYT
_supplyWhole1000000
2. Deploy directly (TronLink)
Open this page in a browser with TronLink (or Trust Wallet if it injects TronWeb). Tap Deploy — it uses TRON mainnet.
3. Or deploy with TronIDE
- Open
https://tronide.io(orhttps://www.tronide.io). - Create
MyTokenTRC20.soland paste the source below. - Compiler:
0.8.20or newer. - Environment: TronLink → Mainnet.
- Deploy with the three constructor values above and confirm in TronLink.
Cost: TRX for energy/bandwidth. A simple TRC-20 deploy is usually a few hundred TRX (varies). You can freeze TRX for energy to reduce it.
4. Source
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
/**
* MyTokenTRC20 — a simple TRC-20 token for your own use.
* - Fixed supply minted to the deployer at construction.
* - Owner can rename the token (setName / setSymbol) and transfer ownership.
* - No mint after deploy, no tax, no blacklist.
*/
contract MyTokenTRC20 {
string public name;
string public symbol;
uint8 public constant decimals = 18;
uint256 public totalSupply;
address public owner;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor(string memory _name, string memory _symbol, uint256 _supplyWhole) {
require(bytes(_name).length > 0 && bytes(_symbol).length > 0, "empty name");
require(_supplyWhole > 0, "zero supply");
owner = msg.sender;
name = _name;
symbol = _symbol;
_mint(msg.sender, _supplyWhole * 10 ** decimals);
}
modifier onlyOwner() {
require(msg.sender == owner, "not owner");
_;
}
function setName(string calldata _name) external onlyOwner {
require(bytes(_name).length > 0, "empty name");
name = _name;
}
function setSymbol(string calldata _symbol) external onlyOwner {
require(bytes(_symbol).length > 0, "empty symbol");
symbol = _symbol;
}
function transferOwnership(address _newOwner) external onlyOwner {
require(_newOwner != address(0), "zero address");
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
function transfer(address to, uint256 value) external returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function approve(address spender, uint256 value) external returns (bool) {
allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
uint256 allowed = allowance[from][msg.sender];
require(allowed >= value, "allowance too low");
if (allowed != type(uint256).max) {
allowance[from][msg.sender] = allowed - value;
}
_transfer(from, to, value);
return true;
}
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0), "zero address");
require(balanceOf[from] >= value, "balance too low");
unchecked {
balanceOf[from] -= value;
balanceOf[to] += value;
}
emit Transfer(from, to, value);
}
function _mint(address to, uint256 value) internal {
totalSupply += value;
balanceOf[to] += value;
emit Transfer(address(0), to, value);
}
}
Good to know
- Rename later: owner can call
setName/setSymbol. - Send anywhere: any TRON
T…address can receive it; the recipient may need to add the contract in TronLink/Trust to see it, and can forward it. - Gas: every transfer costs TRX (energy/bandwidth), paid by the sender.
- Market: add liquidity on SunSwap (pair with USDT TRC-20) to get a price; otherwise wallets show $0.00.
- Listing: submit to Trust Wallet assets (TRON) and CoinGecko/CMC for automatic display and price.