TRON Developer Guide — TRON-CLI

Introduction

Dependencies

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

Installation

python3 -m venv venv    // Optional step. ./venv/bin/activate   // Optional steppip install troncli

Why Python Virtual Environments?

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

Successful pip install output

TRON-CLI Interactive Mode

tron-cli i

Quickly set up what you want by answering a few questions:

TRON-CLI Quickstart

tron-cli quick

By default, it will set up a private test-net full node.

  • You can also type --nettype main to set up a Full Node that syncs to the Mainnet.
  • Type --reset True to reset all.

TRON-CLI Mainnet

Initialization

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

Configuration

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

Run Node

Running the full node

You can then check the overall node status with tron-cli 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

Check Logs

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

Stop Node

tron-cli stop --node NODENUMBER

Common Use Cases

1. Private Net Nodes Setup

tron-cli quick

Add Solidity Node

tron-cli run --nodetype sol

2. Mainnet Nodes Setup

tron-cli init

Config to Mainnet

tron-cli config --nettype main

Run Full Node

Copy

tron-cli run

3. Advanced Config to Start Nodes

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

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

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

Installation FAQs

  1. How to fix “fail to build a wheel for psutil” error?

a. Please check if clang is installed correctly, or install it using Homebrew:

brew install --with-toolchain llvm

b. Please check if you are using Python 3.x

  1. How to test in a virtual environment?

a. Create Virtual Environment

python3 -m venv venv

b. Activate VENV

. ./venv/bin/activate

c. Install TRON-CLI in VENV

pip install troncli

d. Deactivate the VENV when done testing or using

deactivate

GitHub Link

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store