TriportRPC

eth_getCode

POSThttps://triport.io/rpc/tron

Returns the bytecode stored at an EVM address in the current Tron state.

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

eth_getCode returns the byte sequence stored as contract code at a 20-byte EVM address. The result uses EVM data encoding: 0x followed by an even number of hexadecimal characters. 0x represents an empty byte sequence.

The state read is available only at latest; historical block quantities are not accepted. Use this method to distinguish deployed bytecode from an empty address. Native contract metadata is available from getcontractinfo.

Parameters

JSON-RPC params is [address, block].

addressstringrequired
0x-prefixed 20-byte EVM address.
blockstringrequired
Must be latest; historical quantities are unsupported.

Response

Response fields

FieldTypeDescription
jsonrpcstringJSON-RPC protocol version.
idnumberCorrelates the response with the request.
resultstringContract code as 0x-prefixed EVM data.

Errors

See Tron errors for the common envelope.

CodeMeaningWhen it happens
-32602Invalid paramsThe address is malformed or the block tag is not latest.
-32601Method not foundThe method is outside the published catalog.
401UnauthorizedThe API key is missing or invalid.
429Rate limitedThe tron_read_rpc budget is exceeded.

Examples

const params = ["0xa614f803b6fd780986a42c78ec9c7f77e6ded13c", "latest"];
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_getCode", params }),
});
const { result: code } = await response.json();

Notes

  • 0x is an empty data value; the schema does not assign a separate null case.
  • Historical EVM code is unavailable because only the latest state tag is supported.
  • Related: eth_getStorageAt and getcontractinfo.