HomeGuidesAPI ReferenceChangelog
GuidesAPI ReferenceCommunityDiscordBlogFAQBug BountyAnnouncementsChange Log
Guides

Deploy the FullNode or SuperNode

Run nodes on TRON MainNet

Environment:

Operating system: Linux
Libs and Tools:
1、JDK 1.8 (Oracle JDK version)
2、Git
3、ntpd service up and running, as TRX node time should be synchronized

Recommended configuration:

FullNode: CPU: 16 cores, Memory: 32G, Bandwidth: 100M, SSD: 1.5T or more
SuperNode: CPU: 32 cores, Memory: 64G, Bandwidth: 100M, SSD: 1.5T or more

Deployment guide

1. Obtain FullNode.jar through compiling source code or download the release jar.

a. Compile by downloading the source code

1). Create the code directory

mkdir -p /project/tron/

2). Download java tron ​​source code

cd /project/tron/
git clone -b master https://github.com/tronprotocol/java-tron.git

3). Compile the java-tron project

cd ./java-tron 
./gradlew build

You will find the FullNode.jar under ./java-tron/build/libs/ folder if build is successful.

b. Get the latest version of the jar package directly through the release page

https://github.com/tronprotocol/java-tron/releases.

You need to download FullNode.jar.

Binary verification

📘

Note

All released files after 3.7 will provide signatures signed by the Tron Account: TKeAcHxgErbVXrG3N3TZiSV6AT566BHTj2.

You can verify the signature by tronweb.

const Trx = require('tronweb').Trx;

console.log(Trx.verifySignature(SHA256, ADDRESS, SIGNATURE));

Suppose we got a FullNode.jar with a SHA256 hash 2fca93b09da4ac62641e03838e77fce99b4711ddb0c09aa91656c80fc9556d2e, and a Tron signature 21435e32131feb6d00ba8048df04e112e02569ec851064d8ecad2d4dd5da44b7628ddce16823dadfff6fd683fc58cee74964970621a845ee459e2c96a750de551b.

To verify the integrity of the released file:

# First calculate the sha256 hash

sha256sum FullNode.jar  # or shasum -a 256 FullNode.jar (macOS)
# 2fca93b09da4ac62641e03838e77fce99b4711ddb0c09aa91656c80fc9556d2e  FullNode.jar

# Then check the signature

npm install -g tronweb
node -e 'console.log(require("tronweb").Trx.verifySignature(
    "2fca93b09da4ac62641e03838e77fce99b4711ddb0c09aa91656c80fc9556d2e",
    "TKeAcHxgErbVXrG3N3TZiSV6AT566BHTj2",
    "21435e32131feb6d00ba8048df04e112e02569ec851064d8ecad2d4dd5da44b7628ddce16823dadfff6fd683fc58cee74964970621a845ee459e2c96a750de551b"
  ))'
# true

# Now you've verified the integrity of the binary release file.

2. Configuration file

Please download the configuraiton file from github:
main_net_config.conf

3. Deploy Node

a. Start the node

🚧

Warning

Starting the node to synchronize data is slow. After downloading the recent data directly through the backup database, decompress it to the output-directory directory under the Tron project, and then synchronize. The backup database address can be clicked
[Backup Database] (https://backup.trongrid.io/).

nohup java -Xmx24g -XX:+UseConcMarkSweepGC -jar FullNode.jar -c main_net_config.conf </dev/null &>/dev/null &

To start the super representative node, the command is as follows:

nohup java -Xmx24g -XX:+UseConcMarkSweepGC  -jar FullNode.jar  -p  private key --witness -c main_net_config.conf </dev/null &>/dev/null &

If the SR account address has updated the witness_permission permission, you must use --witness-address to specify the SR address, and the -p parameter to specify the private key corresponding to the new witness_permission address:

java -Xmx24g -XX:+UseConcMarkSweepGC -jar FullNode.jar -p private key --witness  --witness-address SR address  -c main_net_config.conf

After the node is started, logs and output-directory will be generated on the sibling directory of java-tron.jar

  • logs: node log files
  • output-directory: node data storage directory

Command-line parameter description:

--witness: enable the witness function
--witness-address:SR account address
--log-config: Specify the log configuration file path, i.e .: --log-config logback.xml
-c: Specify the configuration file path, i.e.: -c config.conf.
-p: Specify the private key of the witness. If you do not want to specify the private key in plaintext, you can use the way of "keystore + password". The method is as follows:

  1. 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.
  2. Comment the "localwitness" item in main net config.conf and uncomment the "localwitnesskeystore" item. Fill in the address 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"
    ]
    Note: for "keystore + password" generation, you can use the register wallet command of the wallet-cli project.
    wallet-cli repository:https://github.com/tronprotocol/wallet-cli.git

2.remove the -p parameter at startup command.

java -Xmx24g -XX:+UseConcMarkSweepGC -jar FullNode.jar --witness -c main_net_config.conf

3.Enter the password correctly.

The use of the log file:

You can modify the level of the module to control the output of the log. The default level of each module is INFO. For example, printing only the information above the warning level of the network module, you can modify it as follows.

<logger name = "net" level = "WARN" />

📘

Note

  • Fullnode already supports the query of solidified blocks. By default, the solidity data can be queried through the walletsolidty / interface of port 8091, so there is no need to build a solidity node.
  • You can use the latest data for synchronization. https://backups.trongrid.io/

b. Stop the node

Use kill -15 to close the fullnode.jar or soliditynode.jar process.

Optimize Memory Allocation with tcmalloc

Memory allocation of java-tron can be optimized with tcmalloc.

First install tcmalloc, then add environment variables to the startup script:

#!/bin/bash
  
export LD_PRELOAD="/usr/lib/libtcmalloc.so.4"
export TCMALLOC_RELEASE_RATE=10
  
# original start command
java -jar .....

Instructions For Linux Distributions

Ubuntu 20.04 LTS / Ubuntu 18.04 LTS / Debian stable

Install:

sudo apt install libgoogle-perftools4

Startup script:

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.

Script:

export LD_PRELOAD="/usr/lib/libtcmalloc.so.4"
export TCMALLOC_RELEASE_RATE=10

CentOS 7

sudo yum install gperftools-libs
export LD_PRELOAD="/usr/lib64/libtcmalloc.so.4"
export TCMALLOC_RELEASE_RATE=10