Java implementation of the TRON Protocol

Table of Contents

What's TRON?

TRON is building the foundational infrastructure for the decentralized internet ecosystem with a focus on high-performance, scalability, and security.

Building the Source Code

Before building java-tron, make sure you have:

There are two ways to install the required dependencies:

Once all dependencies have been installed, download and compile java-tron by executing:

git clone https://github.com/tronprotocol/java-tron.git
cd java-tron
git checkout -t origin/master
./gradlew clean build -x test

Executables

The java-tron project comes with several runnable artifacts and helper scripts found in the project root and build directories.

Artifact/Script Description
FullNode.jar Main TRON node executable (generated in build/libs/ after a successful build following the above guidance). Runs as a full node by default. java -jar FullNode.jar --help for command line options
Toolkit.jar Node management utility (generated in build/libs/): partition, prune, copy, convert DBs; shadow-fork tool. Usage
start.sh Quick start script (x86_64, JDK 8) to download/build/run FullNode.jar. See the tool guide.
start.sh.simple Quick start script template (ARM64, JDK 17). See usage notes inside the script.

Running java-tron

Hardware Requirements for Mainnet

Deployment Tier CPU Cores Memory High-performance SSD Storage Network Downstream
FullNode (Minimum) 8 16 GB 200 GB (Lite) ≥ 5 MBit/sec
FullNode (Stable) 8 32 GB 200 GB (Lite) / 3.5 TB (Full) ≥ 5 MBit/sec
FullNode (Recommend) 16+ 32 GB+ 4 TB ≥ 50 MBit/sec
Super Representative 32+ 64 GB+ 4 TB ≥ 50 MBit/sec

Note: For test networks, where transaction volume is significantly lower, you may operate with reduced hardware specifications.

Launching a full node

A full node acts as a gateway to the TRON network, exposing comprehensive interfaces via HTTP and RPC APIs. Through these endpoints, clients may execute asset transfers, deploy smart contracts, and invoke on-chain logic. It must join a TRON network to participate in the network's consensus and transaction processing.

Network Types

The TRON network is mainly divided into:

Network selection is performed by specifying the appropriate configuration file upon full-node startup. Built-in configuration template: reference.conf; Mainnet configuration: config.conf; Nile testnet configuration: config-nile.conf

1. Join the TRON main network

Launch a main-network full node with the built-in default configuration:

java -jar ./build/libs/FullNode.jar

For production deployments or long-running Mainnet nodes, please refer to the JVM Parameter Optimization for FullNode guide for the recommended Java command configuration.

Using the below command, you can monitor the blocks syncing progress:

tail -f ./logs/tron.log

Use TronScan, TRON's official block explorer, to view main network transactions, blocks, accounts, witness voting, and governance metrics, etc.

2. Join Nile test network

Utilize the -c flag to direct the node to the configuration file corresponding to the desired network. Since Nile Testnet may incorporate features not yet available on the Mainnet, it is strongly advised to compile the source code following the Building the Source Code instructions for the Nile Testnet.

java -jar ./build/libs/FullNode.jar -c config-nile.conf

Nile resources: explorer, faucet, wallet, developer docs, and network statistics at nileex.io.

3. Access Shasta test network

Shasta does not accept public node peers. Programmatic access is available via TronGrid endpoints; see TronGrid Service for details.

Shasta resources: explorer, faucet, wallet, developer docs, and network statistics at shasta.tronex.io.

4. Set up a private network

To set up a private network for testing or development, follow the Private Network guidance.

Running a super representative node

To operate the node as a Super Representative (SR), append the --witness parameter to the standard launch command. An SR node inherits every capability of a FullNode and additionally participates in block production. Refer to the Super Representative documentation for eligibility requirements.

Fill in the private key of your SR account into the localwitness list in the configuration file. Here is an example:

 localwitness = [
    <your_private_key>
 ]

Check Starting a Block Production Node for more details. You could also test the process by connecting to a testnet or setting up a private network.

Programmatically interfacing FullNode

Once the FullNode starts successfully, interaction with the TRON network is facilitated through a comprehensive suite of programmatic interfaces exposed by java-tron:

Enable or disable each interface in the configuration file:

node {
  http {
    fullNodeEnable = true
    fullNodePort   = 8090
  }

  jsonrpc {
    httpFullNodeEnable = true
    httpFullNodePort   = 8545
  }

  rpc {
    enable = true
    port   = 9090
  }
}

When exposing any of these APIs to a public interface, ensure the node is protected with appropriate authentication, rate limiting, and network access controls in line with your security requirements.

Public hosted HTTP endpoints for both mainnet and testnet are provided by TronGrid. Please refer to the TRON Network HTTP Endpoints for the latest list. For supported methods and request formats, see the HTTP API reference above.

Community

TRON Developers & SRs is TRON's official Discord channel. Feel free to join this channel if you have any questions.

The Core Devs Community and TRON Official Developer Group are Telegram channels specifically designed for java-tron community developers to engage in technical discussions.

Contribution

Thank you for considering to help out with the source code! If you'd like to contribute to java-tron, please see the Contribution Guide for more details.

Resources

Integrity Check

License

java-tron is released under the LGPLv3 license.