runGetMethod | TON v3

Executes a get method on a smart contract in the TON blockchain

The runGetMethod endpoint allows you to execute a get method on a smart contract in the TON blockchain. This is useful for retrieving data from smart contracts without modifying their state.

👍

Get you own node endpoint today

Start for free and get your app to production levels immediately. No credit card required.

You can sign up with your GitHub, X, Google, or Microsoft account.

Request Body

  • address (string, required) — The address of the smart contract to interact with.
  • method (string, required) — The name of the get method to execute on the smart contract.
  • stack (array, optional) — An array of stack items to pass as parameters to the method. Each item is an object with:
    • type (string) — The type of the stack item (e.g., "num", "cell", "slice").
    • value (string) — The value of the stack item.

Response

  • exitCode (integer) — The exit code of the method execution. 0 typically indicates success.
  • gasUsed (integer) — The amount of gas used for the execution.
  • stack (array) — The resulting stack after method execution. Each item is an object with:
    • type (string) — The type of the stack item.
    • value (string) — The value of the stack item.

Use case

The runGetMethod endpoint is crucial for interacting with smart contracts on the TON blockchain:

  1. Developers can use this to test and debug their smart contracts by calling get methods.
  2. dApps can retrieve data from smart contracts to display information to users.
  3. Wallets can use this to fetch account balances or other relevant data from custom contracts.
  4. Analytical tools can gather data from multiple contracts to provide insights into the blockchain state.
  5. Automated systems can periodically check contract states without initiating transactions.

Example

Here's an example of how to use the runGetMethod endpoint:

Language
Click Try It! to start a request and see the response here!