TronBox is a development environment and framework for blockchains using the TRON Virtual Machine. TronBox provides the following core functionalities:
- Smart contract compilation
- Migration (deployment on the network)
- NodeJS 5.0+
- Windows, Linux, or Mac OS X
npm install -g tronbox
Installation permissions issue
If the command in the shell fails due to a permission issue, please follow this command to install again: sudo npm install -g tronbox --unsafe-perm=true --allow-root --save-dev grunt
If you still have permission issues, you can try to use nvm to manage nmp and node and install again.
Note on Windows
For Windows, the best way to run TronBox is to install an Ubuntu subsystem: https://docs.microsoft.com/en-us/windows/wsl/install-win10. After running Ubuntu from the prompt, proceed as usual. It is not recommended to run TronBox from Powershell.
Enter the following command under an empty folder
tronbox init ls .gitignore contracts migrations test tronbox-config.js tronbox.js
The directory storing all smart contract files.
The directory storing all test scripts for testing the smart contract.
The configuration file of the project. Declare your Full Node address and Event Server in this file.
Compiles all the smart contracts. The compiled result is stored into ./build/contracts.
This command only compiles files that have been modified since the last compile.
tronbox compile --compile-all
Re-compiles all the smart contracts.
Deploys the contract. This command only migrates changes since the last successful migration.
tronbox migrate --reset
Re-migrates all the smart contracts.
tronbox test [test_script_path]
Runs all test scripts. Test file name definition is optional. It also can be run with --reset flag.
The console supports the
tronbox command. For example, you can invoke
migrate --reset in the console. The result is the same as invoking
tronbox migrate --reset in the command.
All the compiled contracts can be used, just like in development & test, front-end code, or during script migration.
After each command, the contract is re-loaded. After invoking the
migrate--resetcommand, you can immediately use the new address and binary.
Every returned command's promise is automatically logged. There is no need to use
then(), which simplifies the command.
Updated 3 months ago
|Smart Contract Deployment|