Skip to content

Command line options

This section will describe every command available in the TronBox application.

Usage

All commands are in the following form:

Terminal
shell
tronbox <command> [options]

Passing no arguments is equivalent to tronbox help, which will display all commands and then exit.

Commands

compile

Compile source files of smart contracts.

Terminal
shell
tronbox compile [<files...>] [--all] [--evm] [--quiet]

Only contracts that have changed since the last compilation will be compiled if there is no –all. Options:

  • <files...>: Specific contract files to compile.
  • --all: Compile all contracts instead of only the contracts that have changed since the last compilation.
  • --quiet: Suppress all compilation output.
  • --evm: Use EVM related configuration (Requires TronBox v4.0.0 or later).

console

Run a console with contract abstractions and commands available.

Terminal
shell
tronbox console [--network <name>] [--evm]

An interface that interacts with contracts via the command line. In addition, many TronBox commands can be used in the console (without the tronbox prefix). Option:

  • --network <name>: Specify the network to use. The network name must exist in the configuration.
  • --evm: Use EVM related configuration (Requires TronBox v4.0.0 or later).

deploy

An alias for migrate. Please see Deploy contracts.

flatten

The built-in flatten task lets you combine the source code of multiple Solidity files.

Terminal
shell
tronbox flatten <files...>

Options:

  • <files...>: One or more contract source file paths to flatten (required).

TIP

NOTE: This feature requires TronBox v3.3.0 or later.

help

Display a list of all commands.

Terminal
shell
tronbox help

init

Scaffold a new TronBox project in the current working directory.

Terminal
shell
tronbox init

Running tronbox init starts an interactive prompt where you pick one of the built-in starter templates, then copies that template's full skeleton (contracts, migrations, tests, and config) into place. If the template includes a package.json, its dependencies are installed automatically.

The command must be run in an empty directory; otherwise it exits with This directory is not empty.

migrate

Run migration files to deploy contracts.

Terminal
shell
tronbox migrate [--network <name>] [--reset] [--from <number>] [--to <number>] [--compile-all] [--evm] [--quiet]

This will run from the last completed migration unless otherwise specified. For more information, please see Deploy contracts.

Options:

  • --network <name>: Specify the network to use. The network name must exist in the configuration.
  • --reset: Run all migrations from the beginning, instead of running from the last completed migration.
  • --from <number> (alias -f): Run contracts from a specific migration. The number refers to the prefix of the migration file.
  • --to <number>: Run contracts to a specific migration. The number refers to the prefix of the migration file.
  • --compile-all: Compile all contracts, instead of intelligently choosing the contracts that need to be compiled.
  • --evm: Use EVM related configuration (Requires TronBox v4.0.0 or later).
  • --quiet: Suppress all output except errors.

test

Run JavaScript tests.

Terminal
shell
tronbox test [<files...>] [--file <file>] [--network <name>] [--compile-all] [--evm]

Run all or some test files in the test/ directory as specified. For more information, please see Test contracts . Options:

  • <files...>: One or more test file paths to run. Include the path information if a file does not exist in the current directory.
  • --file <file>: Specify a single test file path to run.
  • --network <name>: Specify the network to use. The network name must exist in the configuration.
  • --compile-all: Compile all contracts, instead of intelligently choosing the contracts that need to be compiled.
  • --evm: Use EVM related configuration (Requires TronBox v4.0.0 or later).

unbox

Download a TronBox Box, which is a pre-built TronBox project.

Terminal
shell
tronbox unbox [<box_name>] [--quiet]

Download a TronBox Box to the current working directory. Options:

  • <box_name>: The Box to download. Accepts a Box name, a GitHub user/repo, or a full GitHub URL, optionally followed by #<ref> to pin a branch, tag, or commit (user/my-box#v1.0). Omit it to download the default Box, tronsuper/bare-box.
  • --quiet: Suppress all output except errors.

version

Display the version number and then exit.

Terminal
shell
tronbox version