runSmcMethod
https://triport.io/rpc/tonExecutes a read-only liteserver smart-contract method with an explicit mode.
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).
addressstringrequiredmethodstring or integerrequiredstackarrayrequiredseqnointegeroptionalmodeintegeroptional4.Response
Response fields
| Field | Type | Description |
|---|---|---|
jsonrpc | string | JSON-RPC protocol version. |
id | number or string | Correlates the response with the request. |
result | object | Smart-contract execution result. |
result.exit_code | integer | VM exit code returned by the liteserver. |
result.stack | array | Method output in legacy stack representation. |
result.block_id | object | Optional block used for execution. |
result.gas_used | integer | Optional gas-used value. |
result.last_transaction_id | object | Optional 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.
| Code | Meaning | When it happens |
|---|---|---|
-32602 | Invalid params | Address, method, stack, sequence, or mode is missing or malformed. |
beyond_retention | State unavailable | The requested historical contract state is outside the selected server's window. |
-32601 | Method not found | The JSON-RPC method is outside the published read-only catalog. |
401 | Unauthorized | The API key is missing or invalid. |
429 | Rate limited | The 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
modecontrols 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-17had a measured gap despite genesis access. - Named params and batch correlation by
idare required. sendBoc, all other writes, REST gateways, and WebSocket subscriptions are unavailable for TON.- Related method:
runGetMethod.