- Environment description
- Requirements
- Install a tron-box
- Initialize a tron-box project
- Install openzeppelin-solidity
- Add TRC20 contract code
- Compile smart contracts
- Prepare network parameters for deployment
- Deploy smart contracts
- Quick start in Docker
- References
- Deployed java-tron v4.0.1
- NodeJS 15.6.0
npm install -g tronbox
tronbox init
npm install [email protected]
pragma solidity 0.5.4;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
contract TestCoin is ERC20 {
string public name = "Test";
string public symbol = "TST";
uint8 public decimals = 6;
uint public INITIAL_SUPPLY = 10000000000000000;
constructor() public {
_mint(msg.sender, INITIAL_SUPPLY);
}
}
var Migrations = artifacts.require("./Migrations.sol");
module.exports = function(deployer) {
deployer.deploy(Migrations);
};
var TestCoin = artifacts.require("./TestCoin.sol");
module.exports = function(deployer) {
deployer.deploy(TestCoin);
};
tronbox compile
Write the network parameters in the .env file.
export PRIVATE_KEY="..."
export NETWORK_ID="1"
export HOST_PORT=8090
We use the --reset
parameter to completely update the contract.
source .env && tronbox migrate --reset
docker build -t tron-deploy-trc20 .
docker run tron-deploy-trc20 -it bash