POST
/
95e61622bf6a8af293978377718e3b77
/
wallet
/
estimateenergy
wallet/estimateenergy
curl --request POST \
  --url https://tron-mainnet.core.chainstack.com/95e61622bf6a8af293978377718e3b77/wallet/estimateenergy \
  --header 'Content-Type: application/json' \
  --data '{
  "owner_address": "TSNEe5Tf4rnc9zPMNXfaTF5fZfHDDH8oyW",
  "contract_address": "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs",
  "function_selector": "balanceOf(address)",
  "parameter": "000000000000000000000000a614f803b6fd780986a42c78ec9c7f77e6ded13c",
  "visible": true
}'
{
  "result": {
    "result": true,
    "energy_required": 123
  },
  "energy_used": 123,
  "constant_result": [
    "<any>"
  ],
  "transaction": {}
}
TRON API method that estimates the energy consumption for executing a smart contract function call. This method helps predict the energy costs before actually executing a transaction, enabling better cost planning and user experience optimization.
Get you own node endpoint todayStart 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.

Parameters

  • owner_address — address of the account that would execute the contract call
  • contract_address — address of the smart contract to estimate energy for
  • function_selector — function signature of the contract method to call (e.g., “balanceOf(address)”)
  • parameter — hex-encoded parameters to pass to the function
  • visible — boolean indicating whether to use visible (Base58) address format instead of hex

Response

  • result — estimation result object containing:
    • result — boolean indicating if estimation was successful
    • energy_required — estimated energy consumption for the function call
  • energy_used — total energy that would be consumed
  • constant_result — array of return values if the function is a view/pure function
  • transaction — transaction object with estimated costs if applicable

Use case

The wallet/estimateenergy method is used for:
  • Predicting transaction costs before executing smart contract calls.
  • Building user interfaces that show estimated fees upfront.
  • Optimizing contract interactions by choosing energy-efficient functions.
  • Implementing cost-aware transaction batching and prioritization.
  • Creating accurate fee estimation tools for wallets and dApps.
  • Analyzing contract performance and identifying gas-intensive operations.
Use this method before calling expensive contract functions to give users accurate cost estimates. This is especially useful for functions that might fail due to insufficient energy, allowing you to prevent failed transactions.

Body

application/json

Response

200 - application/json

Energy consumption estimation

The response is of type object.