runGetMethod
https://triport.io/rpc/tonExecutes a read-only smart-contract getter using TON Center v2 JSON conventions.
runGetMethod executes a read-only getter against a TON smart contract. The
facade accepts a raw or user-friendly address, a method name or numeric method
ID, and the legacy TON Center v2 stack representation.
The facade serializes the stack into the BoC form required by
liteServer.runSmcMethod, then returns the VM exit code and output stack. The
schema can also include the evaluated block, gas used, and last transaction ID.
Use this compatibility-oriented method for ordinary contract getters. Use
runSmcMethod when the caller must explicitly control the liteserver response
mode. Neither method submits a message or mutates contract state.
Parameters
JSON-RPC params is a by-name object.
Params: object (by-name).
addressstringrequiredmethodstring or integerrequiredstackarrayrequiredseqnointegeroptionalResponse
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 getter result. |
result.exit_code | integer | VM exit code returned by the liteserver. |
result.stack | array | Getter output in the legacy stack representation. |
result.block_id | object | Optional block at which execution was evaluated. |
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 example's exit_code is preserved exactly and is not rewritten into a
success claim.
Errors
See TON errors for the shared envelope and retention handling.
| Code | Meaning | When it happens |
|---|---|---|
-32602 | Invalid params | Address, method, stack, or historical sequence is missing or malformed. |
beyond_retention | State unavailable | Contract state at the requested seqno 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: [],
};
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: "getter", method: "runGetMethod", params }),
});
const { result } = await response.json();Notes
- Inspect
exit_codeand outputstack; transport success does not determine getter semantics. - Historical execution is retention-sensitive. Pruned liteservers had a floor
of 86 860 000; two nodes answered from genesis, while
ls-17had a gap. - Named params and response matching by
idapply to JSON-RPC batches. sendBocand all writes are absent. There is no REST gateway or WebSocket contract surface.- Related methods:
runSmcMethodandgetAddressInformation.