Supported Operating Systems:
Tools and Dependencies：
Oracle JDK 1.8 ,
- CPU：16 cores
If you are a super representative to build a fullnode for block production, the recommended configuration is: CPU：32 cores, RAM：64G
Regardless of the type of node, the deployment process is the same, please refer to the following steps:
You can obtain FullNode.jar through compiling source code or downloading the released jar directly.
- Obtain java-tron source code
$ git clone https://github.com/tronprotocol/java-tron.git $ git checkout -t origin/master
You will find the FullNode.jar under ./java-tron/build/libs/ folder if build is successful.
$ cd java-tron $ ./gradlew clean build -x test
Startup a fullnode for mainnet：
Full node has full historical data, it is the entry point into the TRON network , it provides HTTP API and Grpc API for external query. You can interact with the TRON network through fullnode：transfer assets, deploy contracts, interact with contracts and so on. The mainnet fullnode startup command is as follows, and the configuration file of the fullnode is specified by the
$ java -jar FullNode.jar -c main_net_config.conf
Startup a fullnode that produces blocks for mainnet
--witnessparameter to the startup command, fullnode will run as a node which produces blocks. In addition to supporting all the functions of fullnode, the block-producing fullnode also supports block production and transaction packaging. Please make sure you have a super representative account and get the votes of others. If the votes ranks in the top 27, you need to start a full node that produces blocks to participate in block production.
Fill in the private key of the super representative address into the
localwitnesslist in the main_net_config.conf, below is an example. But if you don't want to use this way of specifying the private key in plain text, you can use the keystore + password method, please refer to Others chapter.
localwitness = [ 650950B193DDDDB35B6E48912DD28F7AB0E7140C1BFDEFD493348F02295BD812 ]
then run the following command to start the node:
$ java -jar FullNode.jar --witness -c main_net_config.conf
Note: For the mainnet and nile testnet, since the amount of data to be synchronized is large after the new node is started, it will take a long time to synchronize the data. You can use Data Snapshots to speed up node synchronization. First download the latest data snapshot and extract it to the
output-directory directory of the tron project, and then start the node, so that the node will synchronize on the basis of the data snapshot.
For a running fullnode, you can use the command
kill -15 process id to shut down it.
How to use
keystore + password to specify the privatekey of witness account
- You should not use the nohup command because the interaction is required when running the node. It is recommended to use session keeping tools such as screen, tmux, etc.
- Comment the
localwitnessitem in main_net_config.conf and uncomment the
localwitnesskeystoreitem. Fill in the path of the Keystore file. Note that the Keystore file needs to be placed in the current directory where the startup command is executed or its subdirectory. If the current directory is "A", the directory of the Keystore file is "A/B/localwitnesskeystore.json", it needs to be configured as:
localwitnesskeystore = [ "B/localwitnesskeystore.json" ]
keystore + passwordgeneration, you can use the register wallet command of the wallet-cli.
- Startup the fullnode which produces blocks
$ java -Xmx24g -XX:+UseConcMarkSweepGC -jar FullNode.jar --witness -c main_net_config.conf
- Enter the password correctly to finish the node startup.
Optimize Memory Allocation with tcmalloc
Memory allocation of java-tron can be optimized with tcmalloc. The method is as follows:
First install tcmalloc, then add the following two lines to the startup script, the path of tcmalloc is slightly different for different linux distributions.
#!/bin/bash export LD_PRELOAD="/usr/lib/libtcmalloc.so.4" export TCMALLOC_RELEASE_RATE=10 # original start command java -jar .....
Instructions for each linux distributions are as belows:
Ubuntu 20.04 LTS / Ubuntu 18.04 LTS / Debian stable
$ sudo apt install libgoogle-perftools4
In the startup script add the followings:
export LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libtcmalloc.so.4" export TCMALLOC_RELEASE_RATE=10
Ubuntu 16.04 LTS
Same install command as above. In the startup script add the followings:
export LD_PRELOAD="/usr/lib/libtcmalloc.so.4" export TCMALLOC_RELEASE_RATE=10
$ sudo yum install gperftools-libs
In the startup script add the followings:
export LD_PRELOAD="/usr/lib64/libtcmalloc.so.4" export TCMALLOC_RELEASE_RATE=10
Updated about 1 month ago