go-tron is a Golang SDK for interacting with the TRON blockchain.
- Comprehensive RPC Coverage: Supports TRON’s gRPC API for account management, transactions, and market data.
- Optimized for Go: Provides idiomatic Go interfaces.
- Secure and Efficient: Designed for high-performance blockchain applications.
To install go-tron, run:
go get github.com/dszi/go-tron
Here’s a simple example to fetch account details:
package main
import (
"fmt"
"github.com/dszi/go-tron/pkg"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)
func main() {
client := pkg.NewGrpcClient("grpc.nile.trongrid.io:50051",
pkg.WithDialOptions(grpc.WithTransportCredentials(insecure.NewCredentials())),
)
if err := client.Start(); err != nil {
fmt.Println("Failed to start client:", err)
return
}
defer client.Stop()
addr := "TDS7NjQwQn7iNBN1UxxpsFD5UB3pxB7msL"
account, err := client.GetAccount(addr)
if err != nil {
fmt.Println("Error fetching account:", err)
return
}
fmt.Printf("Account: %+v\n", account)
}
GetAccount
GetAccountBalance
CreateTransaction
BroadcastTransaction
ListWitnesses
GetNowBlock
GetTransactionByID
FreezeBalance
UnfreezeBalance
WithdrawBalance
GetMarketPairList
GetTransactionListFromPending
GetBurnTrx
GetBandwidthPrices
For a complete list, see the API documentation.
The following APIs are planned for future implementation:
GetMerkleTreeVoucherInfo
ScanNoteByIvk
ScanNoteByOvk
GetZenPaymentAddress
CreateShieldedTransactionWithoutSpendAuthSig
GetShieldTransactionHash
CreateSpendAuthSig
CreateShieldNullifier
For the full roadmap, visit the development plan.
We welcome contributions! To contribute:
- Fork this repository.
- Create a feature branch.
- Submit a pull request.
This project is licensed under the MIT License. See the LICENSE file.
Build your TRON applications with go-tron today🚀!