Issuing TRC-20 tokens tutorial
Deploying a smart contract on the TRON blockchain can be done in several ways, depending on the tools and platforms you choose. In this guide, we will walk you through the process using the TRONSCAN Contract Deployment Tool as an example. For other tools, please refer to their respective documentation for detailed instructions.
Prerequisites
1. Ensure your TronLink is ready
Make sure you have installed the TronLink extension and are connected to the correct network (Mainnet or Testnet). If you haven’t installed TronLink yet, please visit TronLink to download the latest version.
2. Prepare the TRC20 contract code
Before deploying a custom TRC20 token on the TRON blockchain, make sure you have your contract code finalized. To illustrate the deployment process, this guide will use the TRC20 Contract Template as a working example. The template provides a solid foundation and includes these essential files: ITRC20.sol, SafeMath.sol, TRC20.sol, TRC20Detailed.sol, and Token.sol.
Before deployment, we made the following modifications to the Token.sol
file from the template.
- Token Name: Change the name to your desired token name. Example: "TestTokenName";
- Token Symbol: Modify the token symbol to represent your token's symbol (e.g., TTN);
- Decimals: Set the number of decimal places for your token. The most common value is 18, but this can be adjusted depending on your requirements;
- Total Supply: Define the total supply of your token. In the constructor, it multiplies the initial supply by 10 raised to the power of decimals to account for precision(e.g., 10000000000). Adjust this number according to your needs.
// 0.5.1-c8a2
// Enable optimization
pragma solidity ^0.5.0;
import "./TRC20.sol";
import "./TRC20Detailed.sol";
/**
* @title SimpleToken
* @dev Very simple TRC20 Token example, where all tokens are pre-assigned to the creator.
* Note they can later distribute these tokens as they wish using `transfer` and other
* `TRC20` functions.
*/
contract Token is TRC20, TRC20Detailed {
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor () public TRC20Detailed("TestTokenName", "TTN", 18) {
_mint(msg.sender, 10000000000 * (10 ** uint256(decimals())));
}
}
3. Deploy TRC20 contract
Deploying a TRC20 contract on the TRON blockchain is a straightforward process when using the TRONSCAN Contract Deployment Tool. Below is a step-by-step guide to help you deploy your TRC20 contract with ease.
- Connect Wallet and make sure the account holds enough TRX before proceeding.

- Upload the contract files, which include ITRC20.sol, SafeMath.sol, TRC20.sol, TRC20Detailed.sol, and Token.sol.

- Compile the contracts, and choose the parameters based on your specific needs. Below is an example we used for compiling.
- Solidity Compiler Version: select 0.5.10;
- Optimization: set to Activated;
- Runs: leave 0 by default.


- Deployment contract, and make sure to choose the Token contract as the main contract.


4. Verify TRC20 contracts (Optional)
- To verify your smart contract on TRONSCAN, navigate to the Validation Tool and enter the required contract details. For more details about verifying contracts, please refer to Verifying.
- Contract Address: the address used during deployment;
- Main Contract: usually the main contract name, e.g., "Token";
- Solidity Compiler Version: select 0.5.10;
- License: choose "None" if not applicable.
- Optimization and Runs: set optimization to "Activated" and leave Runs as 0 by default.

- Click Upload contract file(s) for validation. Once the contract is verified successfully, you can view the contract details.


- On the Tronscan page, you can see that the contract source code was verified successfully.

5. Record TRC20 Token
The Record Tool allows token creators to record their TRC20 tokens information on the TRONSCAN. By using this tool, you can officially record your token’s basic details, contract information, and social media profiles.
- Select Token Type, choose the TRC20 token option and click Confirm to proceed.

- Fill in TRC20 Token Details, enter the basic information, contract details, and social media information of your token.
Important: Ensure that the details you enter match exactly with the information in your deployed TRC20 contract.

- Double-check the information you’ve entered and signature. Once the process is complete, you will see a confirmation that your token has been successfully recorded on the TRON network.

- To further update the Token information, please go to the wallet and choose the Record a Token section. Then update the token information here.

6. Add tokens to TronLink
- To add your token to TronLink, click the ‘+’ button on the Tronlink wallet. Search the contract address that was generated after your TRC20 contract was successfully deployed. The corresponding token details will automatically appear. Simply toggle the switch button to enable it. Once added, your token will be visible in the wallet, and you can proceed with transfers and other operations.

- To get more information about the token, you can also search the contract homepage on TRONSCAN.

Note: Tronlink plug-in currently supports the mainnet and Nile testnet to add tokens. At the same time, the token must be successfully recorded in Tronscan and requires 2 hours of data synchronization.
Updated 21 days ago