TronBox

4.6.0 · active · verified Tue Apr 21

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.

Common errors

Warnings

Install

Imports

Quickstart

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.

npm install -g tronbox

mkdir my-tron-project
cd my-tron-project

tronbox init

# Example contract in contracts/MyContract.sol (create this file)
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;

contract MyContract {
    string public greeting;

    constructor() {
        greeting = "Hello, TronBox!";
    }

    function setGreeting(string memory _greeting) public {
        greeting = _greeting;
    }
}

# Example migration in migrations/1_deploy_my_contract.js (create this file)
const MyContract = artifacts.require("MyContract");

module.exports = function (deployer) {
  deployer.deploy(MyContract);
};

tronbox compile
tronbox migrate --network development # Assuming 'development' network is configured in tronbox-config.js
tronbox test # Ensure test files exist in test/ directory

tronbox console

view raw JSON →