Skip to content
Logo

gRPC transport

tronz speaks to TRON nodes over gRPC (the protobuf wallet API), rather than the HTTP/JSON API. The transport is created for you when you call .connect_grpc() on the builder, so you usually don't touch it directly.

Endpoints

The crate ships constants for the well-known TronGrid endpoints:

use tronz::{
    TRONGRID_MAINNET, TRONGRID_MAINNET_SOLIDITY,
    TRONGRID_NILE, TRONGRID_NILE_SOLIDITY,
};
ConstantNetwork and service
TRONGRID_MAINNETMainnet FullNode
TRONGRID_MAINNET_SOLIDITYMainnet SolidityNode
TRONGRID_NILENile FullNode
TRONGRID_NILE_SOLIDITYNile SolidityNode

Use the Nile testnet for development — you can get free test TRX from the Nile faucet.

use tronz::{ProviderBuilder, TRONGRID_NILE};
 
let provider = ProviderBuilder::new().connect_grpc(TRONGRID_NILE).await?;

Custom endpoints

Any gRPC URI works — including your own node:

// TLS endpoint
let mainnet = ProviderBuilder::new()
    .connect_grpc("https://grpc.trongrid.io:443")
    .await?;
 
// Local FullNode over plain HTTP/2
let local_full = ProviderBuilder::new()
    .connect_grpc("http://127.0.0.1:50051")
    .await?;

A SolidityNode uses a separate service and endpoint:

use tronz::SolidityProvider;
 
let local_solidity = SolidityProvider::connect("http://127.0.0.1:50052").await?;

See Local TRE node for a reproducible private chain that publishes both ports.

Low-level access

The transport layer is exposed under tronz::transports if you need it, and the endpoint constants live under tronz::transports::grpc. Most applications never import from here — prefer the provider builder.

use tronz::transports::grpc::{
    TRONGRID_MAINNET, TRONGRID_MAINNET_SOLIDITY,
    TRONGRID_NILE, TRONGRID_NILE_SOLIDITY,
};