• Stars
    star
    3,720
  • Rank 11,864 (Top 0.3 %)
  • Language
    Java
  • License
    GNU Lesser Genera...
  • Created almost 7 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Java implementation of the Tron whitepaper



java-tron

Java implementation of the Tron Protocol

Table of Contents

What's TRON?

TRON is a project dedicated to building the infrastructure for a truly decentralized Internet.

  • Tron Protocol, one of the largest blockchain-based operating systems in the world, offers scalable, high-availability and high-throughput support that underlies all the decentralized applications in the TRON ecosystem.

  • Tron Virtual Machine (TVM) allows anyone to develop decentralized applications (DAPPs) for themselves or their communities with smart contracts thereby making decentralized crowdfunding and token issuance easier than ever.

TRON enables large-scale development and engagement. With over 2000 transactions per second (TPS), high concurrency, low latency, and massive data transmission. It is ideal for building decentralized entertainment applications. Free features and incentive systems allow developers to create premium app experiences for users.

Building the source

Building java-tron requires git and Oracle JDK 1.8 to be installed, other JDK versions are not supported yet. Make sure you operate on Linux and MacOS operating systems.

Clone the repo and switch to the master branch

$ git clone https://github.com/tronprotocol/java-tron.git
$ cd java-tron
$ git checkout -t origin/master

then run the following command to build java-tron, the FullNode.jar file can be found in java-tron/build/libs/ after build successful.

$ ./gradlew clean build -x test

Running java-tron

Running java-tron requires Oracle JDK 1.8 to be installed, other JDK versions are not supported yet. Make sure you operate on Linux and MacOS operating systems.

Get the mainnet configuration file: main_net_config.conf, other network configuration files can be find here.

Hardware Requirements

Minimum:

  • CPU with 8 cores
  • 16GB RAM
  • 2TB free storage space to sync the Mainnet

Recommended:

  • CPU with 16+ cores(32+ cores for a super representative)
  • 32GB+ RAM(64GB+ for a super representative)
  • High Performance SSD with at least 2.5TB free space
  • 100+ MB/s download Internet service

Running a full node for mainnet

Full node has full historical data, it is the entry point into the TRON network , it can be used by other processes as a gateway into the TRON network via HTTP and GRPC endpoints. You can interact with the TRON network through full node๏ผštransfer assets, deploy contracts, interact with contracts and so on. -c parameter specifies a configuration file to run a full node:

$ nohup java -Xms9G -Xmx9G -XX:ReservedCodeCacheSize=256m \
             -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m \
             -XX:MaxDirectMemorySize=1G -XX:+PrintGCDetails \
             -XX:+PrintGCDateStamps  -Xloggc:gc.log \
             -XX:+UseConcMarkSweepGC -XX:NewRatio=2 \
             -XX:+CMSScavengeBeforeRemark -XX:+ParallelRefProcEnabled \
             -XX:+HeapDumpOnOutOfMemoryError \
             -XX:+UseCMSInitiatingOccupancyOnly  -XX:CMSInitiatingOccupancyFraction=70 \
             -jar FullNode.jar -c main_net_config.conf >> start.log 2>&1 &

Running a super representative node for mainnet

Adding the --witness parameter to the startup command, full node will run as a super representative node. The super representative node supports all the functions of the full node and also supports block production. Before running, make sure you have a super representative account and get votes from others๏ผŒonce the number of obtained votes ranks in the top 27, your super representative node will participate in block production.

Fill in the private key of super representative address into the localwitness list in the main_net_config.conf, here is an example:

 localwitness = [
     650950B193DDDDB35B6E48912DD28F7AB0E7140C1BFDEFD493348F02295BD812
 ]

then run the following command to start the node:

$ nohup java -Xms9G -Xmx9G -XX:ReservedCodeCacheSize=256m \
             -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m \
             -XX:MaxDirectMemorySize=1G -XX:+PrintGCDetails \
             -XX:+PrintGCDateStamps  -Xloggc:gc.log \
             -XX:+UseConcMarkSweepGC -XX:NewRatio=2 \
             -XX:+CMSScavengeBeforeRemark -XX:+ParallelRefProcEnabled \
             -XX:+HeapDumpOnOutOfMemoryError \
             -XX:+UseCMSInitiatingOccupancyOnly  -XX:CMSInitiatingOccupancyFraction=70 \
             -jar FullNode.jar --witness -c main_net_config.conf >> start.log 2>&1 &

Quick Start Tool

An easier way to build and run java-tron is to use start.sh, start.sh is a quick start script written in shell language, you can use it to build and run java-tron quickly and easily.

Here are some common use cases of the scripting tool

  • Use start.sh to start a full node with the downloaded FullNode.jar
  • Use start.sh to download the latest FullNode.jar and start a full node.
  • Use start.sh to download the latest source code and compile a FullNode.jar and then start a full node.

For more details, please refer to the tool guide.

Run inside Docker container

One of the quickest ways to get java-tron up and running on your machine is by using Docker:

$ docker run -d --name="java-tron" \
             -v /your_path/output-directory:/java-tron/output-directory \
             -v /your_path/logs:/java-tron/logs \
             -p 8090:8090 -p 18888:18888 -p 50051:50051 \
             tronprotocol/java-tron \
             -c /java-tron/config/main_net_config.conf

This will mount the output-directory and logs directories on the host, the docker.sh tool can also be used to simplify the use of docker, see more here.

Community

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

Core Devs Community is the Telegram channel for java-tron community developers. If you want to contribute to java-tron, please join this channel.

tronprotocol/allcoredev is the official Gitter channel for developers.

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 java-tron's official technical documentation website.
  • Test network A stable test network of TRON contributed by TRON community.
  • Tronscan TRON network blockchain browser.
  • 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๏ผŒ releases are signed the gpg key:
    pub: 1254ย F859ย D2B1ย BD9Fย 66E7ย 107Dย F859ย BCB4ย 4A28ย 290B
    uid: [email protected]
    

License

java-tron is released under the LGPLv3 license.

More Repositories

1

wallet-cli

Wallet CLI
Java
614
star
2

documentation

Documentations of project TRON
PHP
578
star
3

tronweb

Javascript API Library for interacting with the TRON Network
JavaScript
423
star
4

sun-network

Java
346
star
5

documentation-en

237
star
6

tips

TRON Improvement Proposals
221
star
7

tron-deployment

tron main net conf
Shell
175
star
8

protocol

Shell
152
star
9

trident

Java
145
star
10

tronbox

TronBox - Simple development framework for tronweb
JavaScript
144
star
11

wiki

111
star
12

tron-contracts

Solidity smart contracts for the TRON blockchain https://tron.network
JavaScript
100
star
13

documentation-zh

93
star
14

tronwallet-adapter

TypeScript
59
star
15

tronj

Java sdk of tron
Java
49
star
16

event-plugin

Tron eventsubscribe plugin
Java
36
star
17

tron-eventquery

Tron-EventQuery is implemented with tron's event subscribe model, it's used to query event triggers from fullnode.
Java
36
star
18

libp2p

The p2p system implemented in java language
Java
35
star
19

docker-tron-quickstart

A full private network for Tron development
33
star
20

tron-box

TronBox - Simple development framework for tronweb
31
star
21

tron-demo

Tron tools
JavaScript
28
star
22

tron-studio

DEPRECATED. Use TronBox for smart contract deployment.
Java
26
star
23

chainbase

a decentralized database for blockchain
25
star
24

tron-sdk-py

Python
16
star
25

btfsfile

Proof of concept DApp on BTFS
JavaScript
16
star
26

pm

Project Management: Meeting notes and agenda items
16
star
27

go-client-api

13
star
28

tron-cli

TRON-CLI is a command line tool which allows developers quickly set up and manage TRON nodes and service.
13
star
29

zksnark-java-sdk

a zksnark jni library
Java
13
star
30

tron-station-sdk

Javascript API Library for estimating Tron energy and bandwidth consumption based on Tron network.
JavaScript
13
star
31

system-test

Java
11
star
32

tron-grid

10
star
33

tron-rosetta-api

A java-tron api for rosetta.
Roff
9
star
34

ai-protocol

Solidity
9
star
35

java-http-client

Java
7
star
36

custom-oracle

Custom oracle for the Tron blockchain.
JavaScript
7
star
37

tron-blog

JavaScript
7
star
38

lever

stress testing for java-tron
Java
6
star
39

sun-photon

JavaScript
5
star
40

tron-mpc-testnet

Rust
3
star
41

cpp-tron

the cpp implementation of TRON protocol
3
star
42

OSSRH-87363

3
star
43

tron-events

An application server to save to and retrieve events from a cached db
3
star
44

sun.js

JavaScript
3
star
45

account-audit

Jupyter Notebook
2
star
46

tron-station

JavaScript
2
star
47

tools

Java
2
star
48

tron-zksnark

a tron zksnark server
C++
2
star
49

mp-ecdsa-java-sdk

a multi-party-ecdsa jni library
Java
2
star
50

tron-station-lib

Energy/BP cost API for tron-station and developers
2
star
51

tron-blog-zh

JavaScript
2
star
52

block-parser

implement GRPC to read event infos from block
2
star
53

solc-bin

This repository contains current and historical builds of the TRON Solidity Compiler.
Standard ML
1
star