Skip to content

halibobo1205/java-tron

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18,751 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 


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.

  • TRON Protocol: High-throughput(2000+ TPS), scalable blockchain OS (DPoS consensus) powering the TRON ecosystem.
  • TRON Virtual Machine (TVM): EVM-compatible smart-contract engine for fast smart-contract execution.

Building the Source Code

Before building java-tron, make sure you have:

  • Hardware with at least 4 CPU cores, 16 GB RAM, 10 GB free disk space for a smooth compilation process.
  • Operating system: Linux or macOS (Windows is not supported).
  • Git and correct JDK(version 8 or 17) installed based on your CPU architecture.

There are two ways to install the required dependencies:

  • Option 1: Automated script (recommended for quick setup)

    Use the provided install_dependencies.sh script:

    chmod +x install_dependencies.sh
    ./install_dependencies.sh

    Note: For production-grade stability with JDK 8 on x86_64 architecture, Oracle JDK 8 is strongly recommended (the script installs OpenJDK 8).

  • Option 2: Manual installation

    Follow the Prerequisites and Installation Guide for step-by-step instructions.

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
  • The parameter -x test indicates skipping the execution of test cases.
  • If you encounter any error please refer to the Compiling java-tron Source Code documentation for troubleshooting steps.

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:

  • Main Network (Mainnet)
    The primary public blockchain where real value (TRX, TRC-20 tokens, etc.) is transacted, secured by a massive decentralized network.

  • Nile Test Network (Testnet)
    A forward-looking testnet where new features and governance proposals are launched first for developers to experience. Consequently, its codebase is typically ahead of the Mainnet.

  • Shasta Testnet
    Closely mirrors the Mainnet’s features and governance proposals. Its network parameters and software versions are kept in sync with the Mainnet, providing developers with a highly realistic environment for final testing.

  • Private Networks
    Customized TRON networks set up by private entities for testing, development, or specific use cases.

Network selection is performed by specifying the appropriate configuration file upon full-node startup. 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:

nohup java -jar ./build/libs/FullNode.jar &
  • nohup ... &: Runs the command in the background and ignores the hangup signal.

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.

nohup 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 shastaex.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

Upon the FullNode startup 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

  • Medium java-tron's official technical articles are published there.
  • Documentation and TRON Developer Hub serve as java-tron’s primary documentation websites.
  • TronScan TRON main network blockchain browser.
  • Nile Test network A stable test network of TRON contributed by TRON community.
  • Shasta Test network A stable test network of TRON contributed by TRON community.
  • Wallet-cli TRON network wallet using command line.
  • TIP TRON Improvement Proposal (TIP) describes standards for the TRON network.
  • TP TRON Protocol (TP) describes standards already implemented in TRON network but not published as a TIP.

Integrity Check

  • After January 3, 2023, the release files will be signed using a GPG key pair, and the correctness of the signature will be verified using the following public key:
    pub: 1254 F859 D2B1 BD9F 66E7 107D F859 BCB4 4A28 290B
    uid: build@tron.network
    

License

java-tron is released under the LGPLv3 license.

About

Java implementation of the Tron whitepaper

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 99.3%
  • Other 0.7%