TronBox is a development framework and testing environment for smart contracts on blockchains using the TRON Virtual Machine (TVM). Based on Truffle, it provides familiar workflows for building, testing, and deploying contracts on TRON.
With TronBox, you get:
- Smart contract compilation, linking, deployment, and artifact management.
- A local development node with funded accounts.
- An interactive console for working with contracts.
- Automated JavaScript contract tests.
- Scriptable migrations and network configuration.
Install TronBox globally with npm:
npm install -g tronboxFor details, see Install TronBox.
In an empty directory, initialize a project and select a built-in template:
tronbox initGenerated projects include:
| Path | Purpose |
|---|---|
contracts/ |
Solidity contracts |
migrations/ |
Deployment scripts |
test/ |
JavaScript contract tests |
tronbox-config.js |
TRON network and compiler configuration |
For a walkthrough using the MetaCoin template, see Quickstart.
Compile the contracts in your project:
tronbox compileUse --all to recompile every contract. Artifacts are written to build/contracts/. For details, see Compile a Project.
Start an in-memory TRON development network with funded accounts:
tronbox nodeThe node listens at http://127.0.0.1:9090 by default. Keep it running and use another terminal for the following commands. Alternatively, you can use the TronBox Runtime Environment (TRE).
Deploy contracts using your project's migration scripts:
tronbox migrateUse --network <name> to select a network defined in tronbox-config.js. For details, see Contract Deployment (Migrations).
Run your project's contract tests:
tronbox testTo run a single test file, pass its path to tronbox test. For details, see Test Your Contracts.
Open an interactive console with your project's contracts available:
tronbox consoleThe prompt shows the selected network:
tronbox(development)>
For details, see Interact with a Contract.
Use the following GPG public key to verify package signatures:
pub: 82C1 BB84 1BFA FD01 9CA6 1ACB E98F C329 87F3 BF76
uid: dev@tronbox.io
For more guides and examples, see the Official TronBox Documentation.
To contribute, see CONTRIBUTING.md.