> For the complete documentation index, see [llms.txt](https://docs.validationcloud.io/v1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.validationcloud.io/v1/tron/tron-solidity-api/smart-contracts/estimateenergy.md).

# EstimateEnergy

Estimate the energy required for the successful execution of smart contract transactions (Confirmed state).

This method will use `30` [Compute Units](/v1/about/billing.md).

***

**Note:**

* The `wallet/triggerconstantcontract` API can be used to estimate the energy consumption value of calling most smart contracts on the chain, such as USDD, USDT, USDC, TUSD, etc.
* `estimateenergy` will not generate an on-chain transaction, nor will it change the status of the current node.
* The `energy_required` field in the returned value is the energy estimated amount. Therefore, the `fee_limit` of the transaction can be set to `energy_required x energy unit price`.
* Parameter encoding and decoding example: [Parameter and return value encoding and decoding](https://developers.tron.network/docs/parameter-and-return-value-encoding-and-decoding)

## **Parameters**

* `owner_address` - String - Owner address that triggers the contract. If visible=true, use base58check format, otherwise use hex format. For constant call you can use the all-zero address
* `contract_address` - String - Smart contract address. If visible=true, use base58check format, otherwise use hex format
* `function_selector` - String - Function call, must not be left blank
* `parameter` - String - Parameter encoding needs to be in accordance with the ABI rules, the rules are more complicated, users can use the ethers library to encode. For details, please refer to the document-Guide-Smart Contract-Best Practice-Parameter Encoding and Decoding.
* `visible` - Boolean - Optional - Specifies whether the address is in Base58 format (default: false)

## **Returns**

| Field            | Type                 | Description                          |
| ---------------- | -------------------- | ------------------------------------ |
| result           | Return               | Run result                           |
| result.result    | bool                 | Is the estimate successful           |
| result.code      | response\_code(enum) | response code, an enum type          |
| result.message   | string               | Result message                       |
| energy\_required | int64                | Estimated energy to run the contract |

```json
// Result
{
  "result": {
    "result": true
  },
  "energy_required": 1082
}
```

{% tabs %}
{% tab title="mainnet" %}

```bash
curl https://mainnet.tron.validationcloud.io/v1/<YOUR_API_KEY_HERE>/walletsolidity/estimateenergy \
    -X POST \
    -H "Content-Type: application/json" \
    -d '
{
  "owner_address": "TSNEe5Tf4rnc9zPMNXfaTF5fZfHDDH8oyW",
  "contract_address": "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs",
  "function_selector": "balanceOf(address)",
  "parameter": "000000000000000000000000a614f803b6fd780986a42c78ec9c7f77e6ded13c",
  "visible": true
}
'
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.validationcloud.io/v1/tron/tron-solidity-api/smart-contracts/estimateenergy.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
