Skip to main content
Estimate the energy required for the successful execution of smart contract transactions (Confirmed state). This method will use 30 Compute Units.
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

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