Skip to content
Logo

Local TRE node

The TronBox Runtime Environment (TRE) runs a deterministic private TRON chain for development and end-to-end tests. The container exposes separate gRPC services:

ServiceLocal endpoint
FullNode (TronProvider)http://127.0.0.1:50051
SolidityNode (SolidityProvider)http://127.0.0.1:50052

1. Start TRE

Start the same pinned image used by tronz CI:

docker run --detach --rm --name tronz-tre \
  --publish 50051:50051 --publish 50052:50052 \
  tronbox/tre@sha256:f4332e11df12a9f360639a4546fd046593909630fda48af00b30410c144342f0

2. Connect both providers

Connect both providers:

use tronz::{ProviderBuilder, SolidityProvider};
 
let full = ProviderBuilder::new()
    .connect_grpc("http://127.0.0.1:50051")
    .await?;
let solidity = SolidityProvider::connect("http://127.0.0.1:50052").await?;

The FullNode exposes the live chain head and transaction submission. The SolidityNode exposes only irreversible state. See SolidityNode provider for the distinction.

3. Configure custom endpoints

The tests default to the endpoints above. Override them when the services are published elsewhere:

export TRONZ_FULL_NODE_GRPC_ENDPOINT=http://127.0.0.1:50051
export TRONZ_SOLIDITY_NODE_GRPC_ENDPOINT=http://127.0.0.1:50052

4. Run the SDK end-to-end suite

Wait for both services, then run the suite serially because its domain scenarios share one private chain:

cargo test -p tronz --no-default-features \
  --features provider-grpc,contract,signer-local \
  --test local_node full_node_is_ready -- --ignored --exact
 
cargo test -p tronz --no-default-features \
  --features provider-grpc,contract,signer-local \
  --test local_node solidity_node_is_ready -- --ignored --exact
 
cargo test -p tronz --no-default-features \
  --features provider-grpc,contract,signer-local \
  --test local_node -- --ignored --nocapture --test-threads=1

You can verify the connection independently with the runnable local TRE example.

5. Stop TRE

Stop the container when finished:

docker stop tronz-tre