TRON Developer Hub

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    

Full Node

Introduction

There are two ways to build and deploy a Full Node. One way is by downloading and running a packaged script (Linux/MacOS only). The second way is through the IntelliJ IDEA IDE.


Guide Overview
This guide first walks through the following steps in building the node:

Dependencies

Hardware Requirements
Full & Solidity Node Minimum Requirements

  • CPU: 16 Core
  • RAM: 32 G
  • Bandwidth: 100 M
  • Disk Space: 1 T

Full & Solidity Node Recommended

  • CPU: 64+ Cores
  • RAM: 64+ G

Java Environment

  • JDK 1.8 (JDK 1.9+ not yet supported)
  • On Linux Ubuntu system (e.g. Ubuntu 16.04.4 LTS), ensure the machine has Oracle JDK 8, instead of Open JDK 8 in the system. Building the source code using Open JDK 8 results in Build Failed.

IDEs & Editors

Useful Tools

Configuration Files

Throughout the guides for Full Node, Solidity Node, and SR Full Node, there is frequent mention of "configuration files" or "config.conf" files. These three files can be found in this GitHub repository. Please clone this repository for easy access as you go through the Node build process.

Initial Setup

Setting up Folders
In your desired directory, create the directory deploy and the sub-directory fullnode. You will be cloning the java-tron git into the deploy level directory:

/deploy/fullnode

Getting the Code
Refer to the Download the Code page to clone the code from the Terminal. Note: Recommended to use the release branches. Advanced developers may choose at their discretion.

  1. In the terminal, navigate to the deploy directory. Then type the following command to clone java-tron:
cd deploy
git clone https://github.com/tronprotocol/java-tron.git
  1. Navigate to the newly created java-tron directory. Then switch to the release branch by typing:
cd java-tron
git checkout -t origin/release

For Mac, you can also install GitHub for Mac then fork and clone our repository. If you'd rather not use Git, download the latest source code file on our release page.

The next sections diverge into either building from the packaged script or from IntelliJ IDEA.

From the Packaged Script

The GitHub repository for this method can be accessed here.

From IntelliJ IDEA

Build the Node

  1. Start IntelliJ. Select Open, then navigate to the java-tron directory git cloned to your local drive. Click OK:

10/10/18 Important Update: To prevent a MAVEN repo error, first edit the build.gradle file located in the java-tron directory on your local machine. Update the URL in lines 3 and 49 to point to http://central.maven.org/maven2/:

Save the build.gradle file, then continue the IntelliJ steps:

  1. Check on Use auto-import on the Import Project from Gradle dialog. Select JDK 1.8 in the Gradle JVM option. Then click OK.

Note: If JDK 1.8 is not an available selection within the Gradle JVM menu, select the file manager. Navigate to Library/Java/JavaVirtualMachines (Mac) or C:\Program Files\Java (Windows) and select the JDK 1.8 file.

  1. IntelliJ will open the project and start gradle syncing, which will take several minutes, depending on your network connection and your IntelliJ configuration.
  1. After gradle syncing completes, click on the elephant icon (circled in below figure). Type in build -x test in the command line, then click the OK button. IntelliJ will now go through the build process.

Successful Output

When the build successfully completes, you should see it reflected in the output log on the bottom window:

Run the Node

  1. After the build completes, locate FullNode in the project structure view panel. This is located in the path java-tron/src/main/java/org.tron/program/FullNode.
  1. Right click on FullNode, and select Run 'FullNode.main()'. The FullNode will then start running.

Mainnet Integration

The Full Node supports both a gRPC Service and a HTTP Gateway on the ports specified in the configuration files. You can use either method to communicate with the nodes. Please refer to the HTTP APIs.

gRPC

gRPC uses Protobuf and the TRON protocol.

HTTP Gateway

The Full Node also offers an alternate RESTful HTTP Gateway. Below is a demo conversion between base58check and hexString:

Java: Transaction Sign Demo

PHP: TRX_CN PHP

Custom Integration

Take a look at the Common Patterns guide for some basic assistance.

Network Connection Verification

Logs for the Full Node are located in /deploy/\*/logs/tron.log. Use tail -f /logs/tron.log/ to follow along with the block syncing.

12:00:57.658 INFO  [pool-7-thread-1] [o.t.c.n.n.NodeImpl](NodeImpl.java:830) Success handle block Num:236610,ID:0000000000039c427569efa27cc2493c1fff243cc1515aa6665c617c45d2e1bf

Stop Node

To stop the node gracefully, create a stop.sh file. Use kill -15 to close java-tron.jar, FullNode.jar, or SolidityNode.jar. You need to modify pid=ps -ef |grep java-tron.jar |grep -v grep |awk '{print $2}' to find the correct pid.

#!/bin/bash
count=1
while [ $count -le 60 ]; do
  pid=`ps -ef |grep java-tron.jar |grep -v grep |awk '{print $2}'`
  if [ -n "$pid" ]; then
    kill -15 $pid
    echo "kill -15 java-tron, counter $count"
    sleep 1
  else
    echo "java-tron killed"
    break
  fi
  count=$[$count+1]
  if [ $count -ge 60 ]; then
    kill -9 $pid
  fi
done

Next Steps

Setup the Solidity Node by following these instructions.


What's Next

Solidity Node