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    

Quickstart

🚧

Announcement

Due to the sunset of Bintray & jcenter(refer to Into the Sunset on May 1st: Bintray, JCenter, GoCenter, and ChartCenter), packages of trident-java are migrated to Nexus, and the reference of jcenter should be replaced by mavenCentral. The new maven URL is below.

The old maven URL will be available for only version 0.1.0 until Bintray completely stops their service.

Overview

trident-java is a lightweight SDK that includes libraries for working with TRON system contracts and smart contracts.

trident-java makes it easy to build TRON applications with java.

Quickstart

Install trident-Java

To start using trident-java, firstly you will add the packages as your dependencies.

Use Bintray Maven Repository

trident-java is uploaded to Bintray.

Repository settings

Add Bintray to Gradle repositories:

repositories {
    mavenCentral()
    maven {
        url  "http://3.130.234.198:8081/nexus/content/repositories/trident/"
    }
}

Choose required packages

trident-java includes three packages:

abi

This contains datatypes and ABI encoders/decoders.

core

This contains the wrapping functions for easily interacting with TRON system and smart contracts.

utils

This contains tools including encryption, conversion, Etc.

Gradle dependencies

trident-java interacts with the TRON network through GRPC, Protobuf & GRPC related packages are required.

dependencies {
    // protobuf & grpc
    implementation 'com.google.protobuf:protobuf-java:3.11.0'

    implementation 'org.tron.trident:abi:0.1.1'
    implementation 'org.tron.trident:core:0.1.1'
    implementation 'org.tron.trident:utils:0.1.1'

    implementation 'com.google.guava:guava:28.0-jre'
}

Maven dependencies

<dependency>
  <groupId>org.tron.trident</groupId>
  <artifactId>abi</artifactId>
  <version>0.1.1</version>
  <type>pom</type>
</dependency>
<dependency>
  <groupId>org.tron.trident</groupId>
  <artifactId>utils</artifactId>
  <version>0.1.1</version>
  <type>pom</type>
</dependency>
<dependency>
  <groupId>org.tron.trident</groupId>
  <artifactId>core</artifactId>
  <version>0.1.1</version>
  <type>pom</type>
</dependency>

Use trident-java

ApiWrapper in package client is the entrance of the wrapped APIs and smart contract functions.

Initialize a ApiWrapper Instance

Before using functions in ApiWrapper, you should bind your private key to an ApiWrapper instance:

ApiWrapper wrapper = new ApiWrapper("grpc endpoint", "solidity grpc endpoint", "hex private key");

Any node can be used here. Alternatively, there are hardcoded initializers for the main net, Shasta and Nile test nets:

From version 0.1.1, as TronGrid requires API keys for the main net, an API key should be added to the initialization with ofMainnet.

//main net, using TronGrid
ApiWrapper wrapper = ApiWrapper.ofMainnet("hex private key", "API key");
//Shasta test net, using TronGrid
ApiWrapper wrapper = ApiWrapper.ofShasta("hex private key");
//Nile test net, using a node from Nile official website
ApiWrapper wrapper = ApiWrapper.ofNile("hex private key");

📘

Private key binding

Private keys are used for signing transactions. That is, you can use any hexadecimal string that meets the length rule as the private key for data inquiries.

Javadoc

Functions in core are fully equipped with Javadoc. Generate if needed.

Updated 6 days ago

Quickstart


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.