A command line tool to monitor and manage tron nodes.
Project description
TRON-CLI
TRON-CLI is a command line tool that allows developers to quickly set up and manage their TRON nodes and grid api service.
_________ ____ _ __ _______ ____
/_ __/ _ \/ __ \/ |/ /___/ ___/ / / _/
/ / / , _/ /_/ / /___/ /__/ /___/ /
/_/ /_/|_|\____/_/|_/ \___/____/___/
Python | JDK |
---|---|
3.6+ | Oracle 1.8 |
-
Learn more about tron on TRON Developer Hub
-
Join the community on TRON Discord
-
Source code on Github
-
Project on Pypi
Install
pip
pip install --upgrade pip
pip install troncli
Usage
Interactive Mode
tron-cli i
Quickly set up what you want by answerinig a few questions.
Quick Command
tron-cli quick
By default, it will set up a private test-net full node for you.
-
You can also
--nettype main
to set up a full node which syncs to main net. -
--reset True
to reset all
Advanced Set up
You can set up a full node, solidity node, event node, and grid api service (local tron-grid) with more detailed configurations via the provided subcommands. See usage by tron-cli -h
, and -h
on each subcommands.
Manual
Command | Functions | Example1 | Example2 |
---|---|---|---|
tron-cli init --version --reset | Init dirs and fetch 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 config 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 --reset True |
tron-cli run --nodetype | Run node. | tron-cli run | tron-cli run --nodetype full |
tron-cli stop --node | Stop node. | 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 --nettype main --reset True |
tron-cli log --nodetype --filter | Show filtered log. | tron-cli log | tron-cli --nodetype sol --filter height |
tron-cli i | Switch to Interactive Mode. | tron-cli i | tron-cli i |
tron-cli version | Check installed troncli version. | tron-cli version | tron-cli version |
tron-cli -h, --help | Check help manual. | tron-cli -h | tron-cli --help |
overall
tron-cli -h
usage: tron-cli [-h] {init,config,run,stop,status,quick,log,version,i} ...
which subcommand do you want?
optional arguments:
-h, --help show this help message and exit
subcommands:
{init,config,run,stop,status,quick,log,version,i}
init Init dirs and fetch code.
config Create customize config files.
run Run node.
stop Stop node.
status Monitor nodes status.
quick Quick start. (run a full private/main node by one
command)
log Show filtered log.
version Check installed troncli version.
i Interactive Mode.
subcommand: init
tron-cli init -h
usage: tron-cli init [-h] [--version VERSION] [--reset RESET]
optional arguments:
-h, --help show this help message and exit
--version VERSION specify java-tron version
--reset RESET reset all
subcommand: config
tron-cli config -h
usage: tron-cli config [-h] [--nettype NETTYPE] [--fullhttpport FULLHTTPPORT]
[--solhttpport SOLHTTPPORT]
[--eventhttpport EVENTHTTPPORT]
[--fullrpcport FULLRPCPORT] [--solrpcport SOLRPCPORT]
[--eventrpcport EVENTRPCPORT]
[--enablememdb ENABLEMEMDB] [--dbsyncmode DBSYNCMODE]
[--saveintertx SAVEINTERTX]
[--savehistorytx SAVEHISTORYTX] [--gridport GRIDPORT]
[--dbname DBNAME] [--dbusername DBUSERNAME]
[--dbpassword DBPASSWORD] [--reset RESET]
optional arguments:
-h, --help show this help message and exit
--nettype NETTYPE specify net type [main, private]
--fullhttpport FULLHTTPPORT
specify full node http port
--solhttpport SOLHTTPPORT
specify solidity node http port
--eventhttpport EVENTHTTPPORT
specify event node http port
--fullrpcport FULLRPCPORT
specify full node rpc port
--solrpcport SOLRPCPORT
specify solidity node rpc port
--eventrpcport EVENTRPCPORT
specify event node rpc port
--enablememdb ENABLEMEMDB
enable/disable in memory db
--dbsyncmode DBSYNCMODE
specify either db async or sync mode
--saveintertx SAVEINTERTX
enable/disable save internal transcation
--savehistorytx SAVEHISTORYTX
enable/disable save history transcation
--gridport GRIDPORT specify grid api port
--dbname DBNAME specify db name
--dbusername DBUSERNAME
specify db user name
--dbpassword DBPASSWORD
specify db password name
--reset RESET reset config to default settings
subcommand: run
tron-cli run -h
usage: tron-cli run [-h] [--nodetype NODETYPE]
optional arguments:
-h, --help show this help message and exit
--nodetype NODETYPE specify node type [full, sol, event, grid]
subcommand: stop
tron-cli stop -h
usage: tron-cli stop [-h] [--node NODE]
optional arguments:
-h, --help show this help message and exit
--node NODE stop node by given node id or all
subcommand: status
tron-cli status -h
usage: tron-cli status [-h] [--node NODE]
optional arguments:
-h, --help show this help message and exit
--node NODE check specific node detail by node id
subcommand: log
tron-cli log -h
usage: tron-cli log [-h] [--nodetype NODETYPE] [--filter FILTER]
optional arguments:
-h, --help show this help message and exit
--nodetype NODETYPE specify node type [full, sol, event, grid]
--filter FILTER specify filter [number/height]
subcommand: version
tron-cli version -h
usage: tron-cli version [-h]
optional arguments:
-h, --help show this help message and exit
subcommand: i
tron-cli i -h
usage: tron-cli i [-h]
optional arguments:
-h, --help show this help message and exit
Common Use Cases
Notice: Take a look at tron-cli i
first, interactive mode should cover most use cases.
I. set up private-net nodes
a. set up full node only
tron-cli quick
b. add a solidity node
tron-cli run --nodetype sol
II. set up main-net nodes
a. init
tron-cli init
b. config to main-net
tron-cli config --nettype main
c. run full node
tron-cli run
III. advanced config to start nodes
a. initilize
tron-cli init --version latest --reset True
b. detail config (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
c. run full/sol
tron-cli run --nodetype full
IV. start private full node + event node + tron-grid
a. install mongodb and create user & db
b. initilize
tron-cli init
c. config (specify parameter to overwrite default) dbname dbusername 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
d. run full node
tron-cli run
e. run event node
tron-cli run --nodetype event
f. run tron-grid
tron-cli run --nodetype grid
V. start mainnet event node + tron-grid
a. install mongodb and create user & db
b. initilize
tron-cli init
c. config (specify parameter to overwrite default) dbname dbusername 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
d. run event node
tron-cli run --nodetype event
e. run tron-grid
tron-cli run --nodetype grid
FAQs on installation
-
How to fix "fail to build a wheel for psutil" error?
a. please check if you installed clang correctly, or install it using homebrew:
brew install --with-toolchain llvm
b. please check if you are using python 3.x
-
How to test in virtual environment?
a. create virtual environment
python3 -m venv venv
b. activate venv
. ./venv/bin/activate
c. install troncli in venv
pip install troncli
d. when done testing, or using the venv - to deactivate venv
deactivate
Changelog
Version 1.0.6
[X] Support java-tron version 3.5.0.1.
[X] Add support for log config.
[X] fix set up main-net syncing issue on event server;
Version 1.0.5
[X] I'm blushing to say, this is just for fixing a stupid typo.
Version 1.0.4
[X] fix set up main-net syncing issue.
Version 1.0.2
[X] fix enable_save_inter_tx and enable_save_history_tx config issue.
[X] simplify interact mode default selection.
Version 1.0.1
[X] Fix private net broadcast failure and syncing issue.
[X] Fix several typos.
[X] Support java-tron version 3.2.5.
Version 1.0.0
highlight:
-
Add interactive mode.
-
Check and throw error messages with insturction when tron-cli has not initialized or configed.
-
Support python version 3.6.
details:
[X] Add check init and config in config and run, throw error and instruction if catched.
[X] Add interactive mode for whole walk through with key selections, which should cover most use cases.
[X] Fix private event node config error on local host port.
[X] quick - support pass in nettype
[X] support python version 3.6
Version 0.3.1
[X] config - set a default committee proposal list - enable CreationOfContracts, DelegateResource, SameTokenName, TvmTransferTrc10 for private testnet
[X] check/test/update troncli with java-tron version 3.2.4
[X] reset running node and config -- on init and quick reset
Version 0.3.0
highlight:
-
Redesign config logic and provide more features.
-
Add log subcommand to show log with filter.
details:
[X] Redesign config logic check and restore previous config settings. Only overwrite by given options.tron
[X] add config -- reset: reset to default config
[X] log - filter node logs
[X] version - show current version and instruction to upgrade
Version 0.2.4
[X] Fix get current node status async error.
Version 0.2.3
[X] Catch more errors.
Version 0.2.2
[X] Fix issue#17
[X] check java install and JDK version
[X] check python version
[X] check git install
[X] status - display recommended cpu / mem for running full nodes
[X] status & run - display log locations
[X] init & status - store and display java-tron node versions
[X] status - show test account/witness's private key and address for private net
Version 0.2.1
[X] store config, and show active config cmd in status
[X] provide connection info in status
[X] add --reset for quick
[X] add more instruction in command
[X] show ports info and cmd tips with run command
Version 0.2.0
highlight:
Support event-node and tron-grid set up/config/run/stop/monitor.
details:
[X] support java-tron 3.2.2 with more config
[X] add stop all feature
[X] update logo and change node list structure
[X] fix private net init account pk and address does not match
Version 0.1.6
[X] fix error on download progress bar when network not available
Version 0.1.5
highlight:
Pre-release of support event-node and tron-grid set up/config/run/stop/monitor.
details:
[X] init - change file structure for event-node and tron-grid
[X] init - add reset option and handler
[X] init - fetch event-node code
[X] init - fetch tron-grid code
[X] utils - make git_clone a util function
[X] utils - build util method to store more info and provide for status
[X] config - add options and handlers for event-node
[X] config - add options and handlers for tron-grid
[X] config - add event-node build and raise errors
[X] run - add event-node run
[X] run - fire up tron-grid
Version 0.1.4
[X] update to support version 3.2 fetch release, check version
[X] compatible check with version 3.2 release, and update config handler
[X] add more info message;
[X] provide a more neat yet detail help info and command
Version 0.1.3
[X] run - check single ps status
[X] keep track of all running nodes
[X] run - monitor overall system status
[X] set default value for all subcommand options
Version 0.1.2
[X] catch download errors
[X] add progress bar for download
[X] colorful logo and msg
[X] add more progress msg on ports config
[X] add more progress msg on net_type config
[X] add info msg type for instructions
[X] move changelog to file
[X] optimize progress bar
Version 0.1.0
[X] init - set up file folders, and get builds based on given version number
[X] config - init basic config file in json format, and convert to java properties format and export
[X] run - run a single main net full node
[X] quick start
[X] run - move 'run' to its handler, and async the call
[X] stop - add sub cmd and its handler to stop all nodes (kill -15)
[X] run - change log and data store location
[X] config - add custom method to fire up private/shasta testnet
[X] config - add custom method to change port number
[X] config - add custom method to fire up solidity node
[X] run - add option to run solidity node
[X] pack to pip
[X] Doc - add more instruction in readme file
Future Features
[ ] quick - add options to start common user cases
[ ] restart - restart all running nodes
[ ] clean up all std messages
[ ] config - set default/customize committee proposal list
[ ] log - show and filter nodes log
[ ] dump - fetch a dump
[ ] db - manage db, check and trim db
[ ] manual - add more instruction for config
[ ] interact - add interactive mode
[ ] quiet - add quiet mode
[ ] run - multiple (full) nodes
[blocked] config -- add option to config to sync with newly deployed shasta testnet
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.