The TRON Developer Hub

Welcome to the TRON developer hub. You'll find comprehensive guides and documentation to help you start working with TRON as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Introduction

TRON-CLI is a command line tool for quickly and easily starting a Full Node, Event Node, and Solidity Node.

Dependencies

  • Python 3.7+
  • JDK 1.8
  • MongoDB (for event server)
  • MacOS or Linux

Installation

In the destination directory, optionally set up the python virtual environment and activate the environment. Then perform the pip install for troncli.

python3 -m venv venv    // Optional step

. ./venv/bin/activate   // Optional step

pip install troncli 

Why Python Virtual Environments?

TRON-CLI, like many Python programs, contains essential dependency files. In the absence of a Python Virtual Environment, a pip install command by default downloads the required package into your local machine's lib/python/site-packages directory. If another Python program checks for a different version of the same package dependency, that program may end up using the wrong package since there exists no indication of version number. With a Python Virtual Environment, all the required dependencies are neatly packaged into a venv directory that conveniently resides on the same level as your working directory. This eliminates any potential confusion stemming from package name overlap, as well as making the package easier to locate.

A successful pip install within the virtual environment produces the following output:

Successful pip install output

Successful pip install output

TRON-CLI Quickstart

For those wanting to start up a local private network, you can run the command tron-cli quick. This command sets up the tron_nodes directory and sub-folders, moves the .jar files into the folders, sets up the configuration files on default ports, runs the node, and outputs the status details.

tron-cli quick
TRON-CLI quickstart

TRON-CLI quickstart

TRON-CLI Mainnet

The following procedures allow for advanced users to customize their setup and connect to the Mainnet. The process consists of initialization, settings configuration, and running the node.

Initialization

Run the 'tron-cli init' command to set up the directories, download the .jar files, and move the .jar files into the directories:

tron-cli init

This command creates a directory called tron_nodes in the working directory and then creates the four folders fullnode, soliditynode, eventnode, and gridapi. The command then downloads full.jar and solidity.jar, and places these executable files within their respective folders.

Successful TRON-CLI init output

Successful TRON-CLI init output

Configuration

TRON-CLI allows users to easily configure HTTP and gRPC IP ports for Full and Solidity nodes. The default settings are:

Full Node HTTP: 8500
Solidity Node HTTP: 8600
Event-Node HTTP: 8400
Full Node RPC: 58500
Solidity Node RPC: 58600
Event-Node RPC: 58400

To customize a setting, simply execute the tron-cli config --nettype command. For example, to set Full Node HTTP port to 8090, run tron-cli config --fullhttpport 8090:

Full Node HTTP port set to 8090

Full Node HTTP port set to 8090

Run Node

To launch a full node only, execute tron-cli run:

Running the full node

Running the full node

You can then check the overall node status with tron-cli status:

Checking TRON-CLI overall node status

Checking TRON-CLI overall node status

To run a solidity node, run the command tron-cli run --nodetype sol. For event node, run the command tron-cli run --nodetype event:

Running TRON-CLI Solidity Node

Running TRON-CLI Solidity Node

Check Logs

Once both a Full Node and Solidity Node are running, you can view the synchronization logs. The Full Node log is located under tron_nodes/fullnode/logs/tron.log, while Solidity Node log is located under tron_nodes/soliditynode/logs/tron.log. The logs are updated dynamically, with the Solidity Node 1 block behind the Full Node due to syncing.

Full Node (left) and Solidity Node (right) logs.

Full Node (left) and Solidity Node (right) logs.

Stop Node

Stop a node easily by running the following command:

tron-cli stop --node NODENUMBER

Common Use Cases

1. Private Net Nodes Setup

Setup Full Node

tron-cli quick

Add Solidity Node

tron-cli run --nodetype sol

2. Mainnet Nodes Setup

Init

tron-cli init

Config to Mainnet

tron-cli config --nettype main

Run Full Node

tron-cli run

3. Advanced Config to Start Nodes

Initialize

tron-cli init --version latest --reset True

Detail Configuration (Specify parameter to overwrite default)

tron-cli config --nettype private --fullhttpport 8500 --solhttpport 8600 --eventhttpport 8400 --fullrpcport 58500 --solrpcport 58600 --eventrpcport 58400 --enablememdb True --dbsyncmode async --saveintertx False --savehistorytx False --gridport 18891 --dbname Null --dbusername Null --dbpassword Null

Run Full/Sol

tron-cli run --nodetype full

4. Private Full Node + Event Node + Tron-Grid

Install MongoDB and create User and Database. Then initialize.

tron-cli init

Config (Specify parameter to overwrite default) dbname, dbusername, and dbpassword are required to set

tron-cli config --nettype private --fullhttpport 8500 --solhttpport 8600 --eventhttpport 8400 --fullrpcport 58500 --solrpcport 58600 --eventrpcport 58400 --enablememdb True --dbsyncmode async --saveintertx False --savehistorytx False --gridport 18891 --dbname events --dbusername tron --dbpassword 12345678

Run Full Node, Event Node, and Tron-Grid

tron-cli run
tron-cli run --nodetype event
tron-cli run --nodetype grid

5. Mainnet Event Node + Tron-Grid

Install MongoDB and create User and Database. Then initialize

tron-cli init

Config (Specify parameter to overwrite default) dbname, dbusername, and dbpassword are required to set

tron-cli config --nettype main --fullhttpport 8500 --solhttpport 8600 --eventhttpport 8400 --fullrpcport 58500 --solrpcport 58600 --eventrpcport 58400 --enablememdb True --dbsyncmode async --saveintertx False --savehistorytx False --gridport 18891 --dbname events --dbusername tron --dbpassword 12345678

Run Event Node

tron-cli run --nodetype event

Run Tron-Grid

tron-cli run --nodetype grid

Commands Overview

Command
Functions
Usage Example 1
Usage Example 2

tron-cli init --version --reset

Initiate directories and fetch the code.

tron-cli init

tron-cli init --version 3.2.2 --reset True

tron-cli config --nettype ---nettype --fullhttpport --solhttpport --eventhttpport --fullrpcport --solrpcport --eventrpcport --enablememdb --dbsyncmode --saveintertx --savehistorytx --gridport --dbname --dbusername --dbpassword

Create and customize configuration files.

tron-cli config

tron-cli config --nettype private --fullhttpport 8500 --solhttpport 8600 --eventhttpport 8400 --fullrpcport 58500 --solrpcport 58600 --eventrpcport 58400 --enablememdb True --dbsyncmode async --saveintertx False --savehistorytx False --gridport 18891 --dbname events --dbusername tron --dbpassword 12345678

tron-cli run --nodetype

Run nodes.

tron-cli run

tron-cli run --nodetype full

tron-cli stop --node

Stop nodes.

tron-cli stop

tron-cli stop --node 7777

tron-cli status --node

Monitor nodes status.

tron-cli status

tron-cli status --node 777

tron-cli quick --reset

Quick Start.

tron-cli quick

tron-cli quick -- reset True

tron-cli version

Check installed troncli version.

tron-cli version

tron-cli version

tron-cli -h, --help

Check out the help manual.

tron-cli -h

tron-cli --help