TriportRPC

eth_chainId

POSThttps://triport.io/rpc/tron

Returns the Tron EVM mainnet chain identifier as a hexadecimal quantity.

Tron mainnettron:rpcfree+; tron_read_rpc: 15 / 20 / 100 / 250 RPS (free / basic / pro / business; default, unmeasured)

eth_chainId identifies the EVM-compatible Tron mainnet represented by this endpoint. The value is encoded as an EVM hex quantity and is suitable for network checks in EVM tooling.

Use it to reject an incorrectly configured endpoint before reading state. It is the hexadecimal form of the same numeric identifier returned as a decimal string by net_version.

Parameters

JSON-RPC params must be an empty array.

paramsarrayrequired
Empty array; this method accepts no positional parameters.

Response

Response fields

FieldTypeDescription
jsonrpcstringJSON-RPC protocol version.
idnumberCorrelates the response with the request.
resultstringChain identifier as an EVM hex quantity.

Errors

See Tron errors for the common error envelope.

CodeMeaningWhen it happens
-32602Invalid paramsA positional parameter was supplied.
-32601Method not foundThe requested method is not in the Tron catalog.
401UnauthorizedThe API key is missing or invalid.
429Rate limitedThe tron_read_rpc budget is exceeded.

Examples

const response = await fetch("https://triport.io/rpc/tron", {
  method: "POST",
  headers: { "x-token": process.env.TRIPORT_API_KEY, "Content-Type": "application/json" },
  body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "eth_chainId", params: [] }),
});
console.log(BigInt((await response.json()).result));

Notes

  • The measured mainnet value is 0x2b6653dc.
  • Do not substitute Ethereum chain IDs when configuring EVM libraries for Tron.
  • Related: net_version returns the identifier in decimal notation.