TriportRPC

runSmcMethod

POSThttps://triport.io/rpc/ton

Executes a read-only liteserver smart-contract method with an explicit mode.

TON mainnetton:rpcfree+; ton_read_rpc_heavy: 15 / 20 / 100 / 250 RPS (free / basic / pro / business; default, unmeasured)

runSmcMethod exposes liteServer.runSmcMethod with an optional response-field mode. Address, method, stack, and historical sequence retain the TON Center v2 JSON conventions and are converted into TL and BoC values by the facade.

The result requires a VM exit_code and output stack. Depending on the selected response mode and liteserver response, it can also include the block ID, gas used, and last transaction ID.

Use this method when explicit mode control is necessary. For the ordinary compatibility path without an exposed mode bitmask, use runGetMethod. Both methods are read-only; no message is sent to the chain.

Parameters

JSON-RPC params is a by-name object.

Params: object (by-name).

addressstringrequired
TON contract address in raw or user-friendly form.
methodstring or integerrequired
Getter name or signed 64-bit numeric method ID.
stackarrayrequired
Legacy stack entries represented as two-item pairs.
seqnointegeroptional
Non-negative masterchain sequence for historical state.
modeintegeroptional
Non-negative response-field mode; default 4.

Response

Response fields

FieldTypeDescription
jsonrpcstringJSON-RPC protocol version.
idnumber or stringCorrelates the response with the request.
resultobjectSmart-contract execution result.
result.exit_codeintegerVM exit code returned by the liteserver.
result.stackarrayMethod output in legacy stack representation.
result.block_idobjectOptional block used for execution.
result.gas_usedintegerOptional gas-used value.
result.last_transaction_idobjectOptional last transaction logical time and hash.

The response is copied from the accepted live fixture. The captured exit_code is shown as observed rather than interpreted.

Errors

See TON errors for the shared envelope and retention handling.

CodeMeaningWhen it happens
-32602Invalid paramsAddress, method, stack, sequence, or mode is missing or malformed.
beyond_retentionState unavailableThe requested historical contract state is outside the selected server's window.
-32601Method not foundThe JSON-RPC method is outside the published read-only catalog.
401UnauthorizedThe API key is missing or invalid.
429Rate limitedThe ton_read_rpc_heavy budget is exceeded.

Examples

const params = {
  address: "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs",
  method: "seqno",
  stack: [],
  mode: 4,
};
const response = await fetch("https://triport.io/rpc/ton", {
  method: "POST",
  headers: { "x-token": process.env.TRIPORT_API_KEY, "Content-Type": "application/json" },
  body: JSON.stringify({ jsonrpc: "2.0", id: "smc", method: "runSmcMethod", params }),
});
const { result } = await response.json();

Notes

  • mode controls liteserver response fields; it does not authorize a write.
  • Historical execution is retention-sensitive. Pruned servers had a measured floor of 86 860 000, and ls-17 had a measured gap despite genesis access.
  • Named params and batch correlation by id are required.
  • sendBoc, all other writes, REST gateways, and WebSocket subscriptions are unavailable for TON.
  • Related method: runGetMethod.