TON — Methods
API reference for TON. All methods ->
getConfigParam
Retrieves config by ID.
Parameters
config_id(integer; query; required): the ID of the configuration parameter to retrieve.seqno(integer; query): the masterchain sequence number. If not specified, the latest blockchain state will be used.
Returns
A specific configuration parameter from the TON blockchain.
Request example
- REST
- JSON-RPC
curl -X GET https://rpc.ankr.com/premium-http/ton_api_v2/YOUR_ANKR_API_KEY/getConfigParam?config_id=5
curl --location 'https://rpc.ankr.com/ton_api_v2/YOUR_ANKR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "getConfigParam",
"params": {
"config_id": 5
},
"id": "1"
}'
Response example
{
"ok": true,
"result": {
"@type": "configInfo",
"config": {
"@type": "tvm.cell",
"bytes": "te6cckEBAQEALAAAUwH//////////////////////////////////////////4AAAACAAAABQNJ1A1s="
},
"@extra": "1731077332.7515757:0:0.8627180770404548"
}
}
getConfigAll
Retrieves full config.
Parameters
seqno(integer; query): the masterchain sequence number. If not specified, the latest blockchain state will be used.
Returns
Full config from the TON blockchain.
Request example
- REST
- JSON-RPC
curl -X GET https://rpc.ankr.com/premium-http/ton_api_v2/YOUR_ANKR_API_KEY/getConfigAll
curl --location 'https://rpc.ankr.com/ton_api_v2/YOUR_ANKR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "getConfigAll",
"params": {},
"id": "1"
}'
Response example
{
"ok": true,
"result": {
"@type": "configInfo",
"config": {
"@type": "tvm.cell",
"bytes": "te6cckIDCFwAAQAAATrxAAACASAAAQACAgLYAAMABAIC9QAxADICASAABQAGAgFiCDIIMwIBIAAHAAgCAUgACQAKAgEgADUANgIBIAB9AH4CAUgACwAMAgFqBsYGxwEBSAANAQFIAB8BKxJnLE8IZy1PCAGQAGQP////////RMAADgICxwAPABACASAAEQASAgEgApoCmwIBIAATABQCASAAGQAaAgEgABUAFgIBIAAXABgCASAAqgCrAgEgAOgA6QIBIAEmAScCASABZAFlAgEgABsAHAIBIAAdAB4CASABogGjAgEgAeAB4QIBIAIeAh8CASACXAJdASsSZy1PCGcuTwgBkABkD////////zrAACACAscAIQAiAgEgACMAJAIBIAWoBakCASAAJQAmAgEgACsALAIBIAAnACgCASAAKQAqAgEgA7gDuQIBIAP2A..."
},
"@extra": "1731077952.979539:7:0.4668203125193432"
}
}
runGetMethod
Runs get method.
Executes a get method on a smart contract on the TON blockchain.
Request body parameters
address(string; required): the address of the smart contract to interact with. Example:EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs.method(string; required): the name of the get method to execute. Example:get_wallet_address.stack(array; optional): an array of arguments to pass with the method. Default is an empty array.
Returns
Retrieves data from smart contracts without modifying their state.
Request example
- REST
- JSON-RPC
curl --request POST https://rpc.ankr.com/premium-http/ton_api_v2/YOUR_ANKR_API_KEY/runGetMethod \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"address": "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs",
"method": "get_wallet_address",
"stack": [
[
"tvm.Slice",
"te6cckEBAQEAJAAAQ4AbUzrTQYTUv8s/I9ds2TSZgRjyrgl2S2LKcZMEFcxj6PARy3rF"
]
]
}'
curl --location 'https://rpc.ankr.com/ton_api_v2/YOUR_ANKR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "runGetMethod",
"params": {
"address": "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs",
"method": "get_wallet_address",
"stack": [
[
"tvm.Slice",
"te6cckEBAQEAJAAAQ4AbUzrTQYTUv8s/I9ds2TSZgRjyrgl2S2LKcZMEFcxj6PARy3rF"
]
]
},
"id": "1"
}'
Response example
{
"ok": true,
"result": {
"@type": "smc.runResult",
"gas_used": 3143,
"stack": [
[
"cell",
{
"bytes": "te6cckEBAQEAJAAAQ4ANjovsYdlAob6Pq3ofaIojUCMKGuvEP9qPZMUW1kpwFzD5vQ3S",
"object": {
"data": {
"b64": "gA2Oi+xh2UChvo+reh9oiiNQIwoa68Q/2o9kxRbWSnAXIA==",
"len": 267
},
"refs": [],
"special": false
}
}
]
],
"exit_code": 0,
"@extra": "1731078699.3790262:0:0.023048354399674897"
}
}
estimateFee
Estimates fee.
Estimates the fees required for query processing. body, init-code, and init-data accepted in serialized format (b64-encoded).
Request body parameters
address(string; required): the address of the smart contract.body(string; required): the body of the transaction in base64 format.ignore_chksig(boolean; optional): whether to ignore the signature check. Default: false.
Returns
Fees required for query processing.
Request example
- REST
- JSON-RPC
curl --request POST https://rpc.ankr.com/premium-http/ton_api_v2/YOUR_ANKR_API_KEY/estimateFee \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"address": "EQBVbC7Hu-g3htYXzst8L5ucV76NMzeBK3URJKebN2Y1k55Q",
"body": "te6ccgEBBAEAwwABRYgAqthdj3fQbw2sL52W+F83OK99GmZvAlbqIklPNm7MayYMAQGcJRnEjp8cFJEdHYEy0LKHHYzifhXgDjogvM4i1RhNr6JL5bGaLxFWgLvL/9Q5K9CsRfVakAbG1JfXmJjD+54vAimpoxdm1XNnAAAAEwADAgFkQgA0XvoMzOTI+7LhqhMUCzQfZ6f1jWBzDLBT90cgmTz0fBE4gAAAAAAAAAAAAAAAAAEDACoAAAAAdGhpcyBpcyBhIHRlc3QgdHg=",
"ignore_chksig": false
}'
curl --location 'https://rpc.ankr.com/ton_api_v2/YOUR_ANKR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "estimateFee",
"params": {
"address": "EQBVbC7Hu-g3htYXzst8L5ucV76NMzeBK3URJKebN2Y1k55Q",
"body": "te6ccgEBBAEAwwABRYgAqthdj3fQbw2sL52W+F83OK99GmZvAlbqIklPNm7MayYMAQGcJRnEjp8cFJEdHYEy0LKHHYzifhXgDjogvM4i1RhNr6JL5bGaLxFWgLvL/9Q5K9CsRfVakAbG1JfXmJjD+54vAimpoxdm1XNnAAAAEwADAgFkQgA0XvoMzOTI+7LhqhMUCzQfZ6f1jWBzDLBT90cgmTz0fBE4gAAAAAAAAAAAAAAAAAEDACoAAAAAdGhpcyBpcyBhIHRlc3QgdHg=",
"ignore_chksig": false
},
"id": "1"
}'
Response example
{
"ok": true,
"result": {
"@type": "query.fees",
"source_fees": {
"@type": "fees",
"in_fwd_fee": 996800,
"storage_fee": 0,
"gas_fee": 40000,
"fwd_fee": 0
},
"destination_fees": [],
"@extra": "1731079591.0619361:0:0.37221728035875046"
}
}