estimateenergy - Tron

estimateenergy. Estimates the energy required to execute a smart contract call before sending it.

estimateenergy - tron [Value: 20CU]
Estimates the energy required to execute a smart contract call before sending it.
Use cases

Use cases

  • Size a triggersmartcontract call's fee_limit accurately before sending it
  • Warn a user up front if a call would likely run out of energy
Constraints

Constraints

  • The estimate reflects current contract state and may shift slightly by the time the real call executes
  • Also available under /walletsolidity/ for confirmed (solidified) data instead of the latest state
Get started
Unlock Access to 100+ chains
Boost your app's speed and reliability with dRPC - get your access API key

Language

Request
Examples
curl --request POST \
     --url https://lb.drpc.live/tron/{API-KEY}/wallet/estimateenergy \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '{"owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", "contract_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", "function_selector": "example", "parameter": "example", "call_value": 1, "visible": true}'
Copy
Response
200
{
  "result": { "result": true },
  "energy_required": 13859
}
Copy

Request params

idinteger
jsonrpcstring
methodstring
Parametersobject
object
owner_addressstring
The address that would initiate the call
contract_addressstring
[Required] The deployed smart contract's address
function_selectorstring
The function signature to call
parameterstring
ABI-encoded, hex-formatted arguments for function_selector
datastring
The complete ABI-encoded call payload (function selector plus arguments combined); used as an alternative to supplying function_selector and parameter separately. If both are provided, function_selector and parameter take precedence.
token_idinteger
The identifier of the TRC10 token being sent via call_token_value.
call_token_valueinteger
The amount of a TRC10 token to send along with this call into the contract.
call_valueinteger
Amount of TRX, in sun, that would be sent with the call
visibleboolean
When true, addresses are base58check strings; when false (default), hex strings

Response

200
Estimates the energy required to execute a smart contract call before sending it.

Response params

object
result.resultboolean
Whether the estimate succeeded
energy_requiredinteger
Estimated energy the real call would consume