EstimateEnergy

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

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

Note:

  • This API is closed by default. To enable this interface, both the vm.estimateEnergy and vm.supportConstant configuration items must be activated simultaneously in the node configuration file.
  • estimateEnergy performs an estimation only; it does not generate an on-chain transaction or alter the current node's status. energy_required is measured in Energy, while fee_limit is measured in sun, so the value cannot be assigned directly. The base conversion is fee_limit (sun) = energy_required × getEnergyFee (sun/Energy). Query the current chain parameters and keep a reasonable buffer for state and Dynamic Energy changes.
  • While triggerconstantcontract is sufficient for estimating the Energy consumption of calling most on-chain smart contracts (e.g., USDD, BTT, TUSD), estimateEnergy may produce a closer estimate for a small number of special contracts. An estimate reflects the node state at request time and does not guarantee that the later on-chain transaction will succeed.
  • Parameter encoding and decoding: Parameter and return value encoding and decoding

Related resources

Body Params
string
required

Transaction initiator address. (Format: Base58 or Hex)

string

Contract address, required when estimating a call to an existing contract. Supports Base58 or Hex. Omit this field when estimating a deployment.
Example: TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs

string

Function selector.
Example: transfer(address,uint256).

string

ABI-encoded function parameters (Hex String).
Example: 000000000000000000000000a614f803b6fd780986a42c78ec9c7f77e6ded13c0000000000000000000000000000000000000000000000000000000000000032

string

Hex-encoded execution data.

  • To estimate deployment Energy, provide the contract creation bytecode and append ABI-encoded constructor arguments, if any. Omit contract_address and function_selector.
  • To estimate contract call Energy, concatenate the function selector and ABI-encoded arguments in data, or use function_selector and parameter separately.

If function_selector is non-empty, the endpoint constructs the call data from it and parameter, ignoring data.

int64

Amount of TRX transferred into the contract. (Unit: sun)

int64

Amount of TRC-10 token transferred into the contract.

int64

TRC-10 token ID

boolean

Optional. Set to true to format addresses in Base58; set to false for hex format. (Default: false)

Response

Language
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json