tronprotocol/trident
概要
A lightweight Java SDK for interacting with the TRON blockchain.
ビジネス・金融できること
- Complete implementation of TRON's gRPC interfaces
- Smart contract deployment and interaction
- Wallet key management and address utilities
- Transaction building and signing
計測したスター増加
- 24時間
- 0
- 7日間
- +1
- 15日間
- +1
- 1か月
- 履歴を収集中
期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。
README.md
オリジナルTrident - TRON Java SDK
Overview
Trident is a lightweight Java SDK for interacting with the TRON blockchain. It provides a simple and efficient way to integrate TRON functionality into your Java applications.
Features
- Complete implementation of TRON's gRPC interfaces
- Smart contract deployment and interaction
- Wallet key management and address utilities
- Transaction building and signing
- TRC10/TRC20/TRC721 token support
Adding Trident to your build
Build Trident with JDK 8 or 17 using the Gradle 8.14.8 Wrapper.
The latest version (built with JDK 1.8) can be found on Maven Central.
Gradle
implementation("io.github.tronprotocol:trident:1.0.1")
Maven
Add repo setting:
<dependency>
<groupId>io.github.tronprotocol</groupId>
<artifactId>trident</artifactId>
<version>1.0.1</version>
</dependency>
Using local build
You can use locally built packages by the following steps:
- Copy the compiled jar file to your project's
libsdirectory - Add the following to your project's
build.gradle:
dependencies {
implementation files('libs/trident-1.0.1.jar')
implementation "com.google.guava:guava:33.8.0-jre"
implementation "io.grpc:grpc-netty-shaded:1.86.0"
implementation "io.grpc:grpc-netty:1.86.0"
implementation "io.grpc:grpc-okhttp:1.86.0"
implementation "io.grpc:grpc-protobuf:1.86.0"
implementation "io.grpc:grpc-stub:1.86.0"
implementation "com.google.protobuf:protobuf-java-util:3.25.9"
implementation "org.bouncycastle:bcprov-jdk18on:1.87"
implementation "io.vertx:vertx-core:4.5.35"
implementation platform("io.netty:netty-bom:4.2.21.Final")
implementation "io.netty:netty-buffer"
implementation "com.alibaba.fastjson2:fastjson2:2.0.55"
}
Note: If your code directly uses other netty modules (e.g.
io.netty.channel.*,io.netty.handler.*,io.netty.codec.*), add the corresponding artifact after the BOM without specifying a version — the version will be resolved bynetty-bom. For example:implementation "io.netty:netty-handler".
Quick Start
Initialize client
// Initialize with TronGrid mainnet
ApiWrapper client = ApiWrapper.ofMainnet("private_key", "api_key"); //api_key from TronGrid
//Or Shasta test net
ApiWrapper client = ApiWrapper.ofShasta("private key");
// Or nile testnet
ApiWrapper client = ApiWrapper.ofNile("private_key");
// Or initialize with a custom grpc endpoint.
ApiWrapper client = new ApiWrapperBuilder("grpc endpoint")
.withGrpcEndpointSolidity("solidity grpc endpoint")
.withPrivateKey("private_key")
.withApiKey("api_key") // Optional: API key from TronGrid
.withTLS() // Optional: or withTLS(new File("xxx.crt"))
.withTimeout(5000) // Optional: request timeout in milliseconds
.addInterceptors(interceptors) // Optional: custom gRPC interceptors
.build();
// Send TRX
TransactionExtention transactionExtention = client.transfer("fromAddress", "toAddress", 100_000_000L); //100TRX
// Sign
Transaction signedTxn = client.signTransaction(transactionExtention);
// Broadcast
String txId = client.broadcastTransaction(signedTxn);
System.out.println("txId is " + txId);
Documentation
Build instructions
Trident includes integration tests for running on the Nile testnet. If you want to run test cases involving write operations on the blockchain, such as transfer or deploy contract and so on, please follow the steps:
- Uncomment the Disabled function in the unit test cases.
//@Disabled("add private key to enable this case")
- Set the tron.private-key and tron.tokenId in the test configuration file in the core directory here.
tron.private-key=xxx
tron.tokenId=1000587
Note: The account should have at least 1000 TRX, 100 USDT, and 1000 TRC10 token on the Nile testnet. you can get testCoin from nileex.io.
Contribution
We're very glad and appreciate to have contributions from the community.
Refer to our contributing guide for more information.
Integrity Check
Starting from version 0.9.2, releases are published to Maven repository and signed with the gpg key:
pub: 3149 FCA5 6377 2D11 2624 9C36 CC3F 8CEA 7B0C 74D6
uid: [email protected]
関連プロジェクトを探す
読み込み中…