{"id":15861,"library":"tronbox","title":"TronBox","description":"TronBox is an open-source development framework and testing environment designed for smart contracts built on the TRON Virtual Machine (TVM). Currently stable at version 4.6.0, it follows a periodic release cadence, incorporating updates for Solidity compiler support, underlying dependency upgrades like `tronweb` and `ethers`, and framework enhancements. As a direct fork of the popular Ethereum development suite Truffle, TronBox provides a familiar and robust toolkit for TRON developers, offering features such as built-in contract compilation, linking, deployment, binary management, an external script runner, an interactive console, automated contract testing, and a scriptable migration framework. Its key differentiator is its specialized focus on the TRON ecosystem, adapting Truffle's established workflows and tools to the specifics of TRON blockchain development, including seamless integration with `tronweb` and support for TRON-specific network configurations.","status":"active","version":"4.6.0","language":"javascript","source_language":"en","source_url":"https://github.com/tronprotocol/tronbox","tags":["javascript","TronBox","TRON","Solidity","Truffle","Contract"],"install":[{"cmd":"npm install tronbox","lang":"bash","label":"npm"},{"cmd":"yarn add tronbox","lang":"bash","label":"yarn"},{"cmd":"pnpm add tronbox","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Minimum Node.js runtime environment required for execution.","package":"node","optional":false},{"reason":"Core library for interacting with the TRON blockchain; a fundamental dependency for all TRON-related operations.","package":"tronweb","optional":false},{"reason":"Used for EVM-mode contract interactions and testing since v4.5.0, replacing the previous `web3` integration.","package":"ethers","optional":false}],"imports":[{"note":"TronBox is primarily a command-line interface (CLI) tool installed globally. It is not designed for programmatic `import` or `require` into other JavaScript/TypeScript applications. Interaction occurs via shell commands.","wrong":"import { tronbox } from 'tronbox'","symbol":"tronbox CLI","correct":"npm install -g tronbox\ntronbox <command>"},{"note":"This command initializes a new TronBox project, creating boilerplate directories (contracts/, migrations/, test/) and the `tronbox-config.js` file. It's a CLI-driven setup.","wrong":"const project = new TronBoxProject()","symbol":"tronbox init","correct":"tronbox init"},{"note":"Provides an interactive JavaScript runtime environment where compiled contracts are automatically made available for direct interaction. This is an environment provided by the CLI, not a library module.","wrong":"import { console } from 'tronbox'","symbol":"tronbox console","correct":"tronbox console"}],"quickstart":{"code":"npm install -g tronbox\n\nmkdir my-tron-project\ncd my-tron-project\n\ntronbox init\n\n# Example contract in contracts/MyContract.sol (create this file)\n// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\ncontract MyContract {\n    string public greeting;\n\n    constructor() {\n        greeting = \"Hello, TronBox!\";\n    }\n\n    function setGreeting(string memory _greeting) public {\n        greeting = _greeting;\n    }\n}\n\n# Example migration in migrations/1_deploy_my_contract.js (create this file)\nconst MyContract = artifacts.require(\"MyContract\");\n\nmodule.exports = function (deployer) {\n  deployer.deploy(MyContract);\n};\n\ntronbox compile\ntronbox migrate --network development # Assuming 'development' network is configured in tronbox-config.js\ntronbox test # Ensure test files exist in test/ directory\n\ntronbox console","lang":"javascript","description":"This quickstart demonstrates the full lifecycle of a TronBox project: global installation, project initialization, creating a simple Solidity contract and its deployment migration, compilation, deployment to a development network, and interaction via the console."},"warnings":[{"fix":"Migrate any EPM-managed dependencies to npm or direct contract imports. Review your `tronbox-config.js` and migration scripts for EPM references.","message":"EPM (Ethereum Package Manager) support has been entirely removed from TronBox. Projects relying on EPM for package management will need to migrate to alternative dependency management solutions.","severity":"breaking","affected_versions":">=4.6.0"},{"fix":"Review the latest TronBox documentation for the correct default and configurable directory paths. Update your `tronbox-config.js` to reflect any necessary changes to avoid file lookup errors during compilation or deployment.","message":"Configuration directory paths, including `build_directory`, `contracts_directory`, `contracts_build_directory`, `migrations_directory`, and `test_directory`, have been reconfigured. Existing projects may require updates to their `tronbox-config.js`.","severity":"breaking","affected_versions":">=4.6.0"},{"fix":"Refactor any code interacting with contract instances or blockchain APIs to use the `ethers.js` v6 API. Consult the `ethers.js` documentation for updated methods and patterns.","message":"TronBox has migrated from `web3` v4 to `ethers` v6 for all EVM-mode operations. This affects migration scripts, test scripts, and the TronBox console, requiring code adjustments for existing projects.","severity":"breaking","affected_versions":">=4.5.0"},{"fix":"For building, use `tronbox compile`. For serving or watching files, integrate external tools (e.g., `webpack`, `nodemon`) into your development workflow. The `tronbox help` command provides updated command usage.","message":"The `build`, `serve`, and `watch` CLI commands have been removed. These functionalities are no longer available directly via the TronBox CLI.","severity":"breaking","affected_versions":">=4.4.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Ensure TronBox is installed globally using `npm install -g tronbox`. If already installed, verify your system's PATH environment variable.","cause":"TronBox CLI is not globally installed or not in the system's PATH.","error":"'tronbox' is not recognized as an internal or external command, operable program or batch file."},{"fix":"Upgrade your Node.js installation to version 20.0.0 or higher. Using a version manager like `nvm` (Node Version Manager) is recommended: `nvm install 20 && nvm use 20`.","cause":"The installed Node.js version is older than the minimum required by TronBox.","error":"Error: Node.js vXX.YY.Z is not supported. TronBox requires Node.js >=20.0.0."},{"fix":"Open `tronbox-config.js` and add or correct the network configuration, ensuring the network name matches the one provided in the CLI command (e.g., `tronbox migrate --network myNetwork`).","cause":"The specified network for compilation or migration is not defined in the `tronbox-config.js` file.","error":"Error: Network 'development' not found in tronbox-config.js."}],"ecosystem":"npm"}