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!