Skip to main content

Connection

Quota, limits and prices are the same as over HTTP. A call is weighed by the size of its protobuf answer with the same formula — see Quota units.

.proto files

The server has no reflection: your client needs the TRON .proto files. They are published in the tronprotocol/protocol repository; the services are in api/api.proto.
With grpcurl, point -import-path at the clone and -proto at api/api.proto:
In code, generate the stubs from the same files with your language’s gRPC tools, open a TLS channel to node.tronrental.com:443, and pass the key in the metadata of every call.

Method names and bytes

  • Method names are case-sensitive, as in the .proto: protocol.Wallet/GetAccount, not getAccount. A method the node does not have ends with UNIMPLEMENTED, x-node-api-reason: method_not_found and x-node-api-wu: 0 — it costs nothing.
  • Addresses and IDs are bytes. In grpcurl JSON, bytes are base64. A TRON address is 21 bytes: 41 followed by 20 bytes. To turn its hex form into base64:
  • A request message is at most 512 KB. A larger one is refused with RESOURCE_EXHAUSTED before it is processed.

Trailing metadata

Status codes

Refusals map to gRPC statuses by their HTTP status. The code itself is in x-node-api-reason; the full list is in Limits and errors. An error the node itself returns (for example INVALID_ARGUMENT for a malformed transaction) is passed to you as is and costs 1 WU: the node did the work. If the node does not answer, the call ends with UNAVAILABLE and x-node-api-reason: node_error and costs nothing.
A RESOURCE_EXHAUSTED without x-node-api-reason comes from the gRPC server itself: the request message is above 512 KB, or the server is holding too many calls at once. Retry the second case after a short pause.

Retries and broadcasts

A call is never repeated on another node behind your back: an UNAVAILABLE can mean that the connection broke after the node received the request. Re-sending the same signed transaction to BroadcastTransaction is safe — the network executes a transaction ID only once.