Invoke the readonly function (modified by the view or pure modifier) of a contract for contract data query; or Invoke the non-readonly function of a contract for predicting whether the transaction can be successfully executed and estimating the energy consumption; or estimate the energy consumption of contract deployment


  • TriggerConstantContract operation will not generate an on-chain transaction, nor will it change the status of the current node.
  • For estimating energy
    • To estimate the energy consumption of contract deployment just by passing the bytecode of contract through the data field
    • To estimate energy consumption of Contract Calls by calling non-read-only methods of contracts
  • When using triggerconstantcontract to estimate energy consumption, the energy_used field in the returned value is the energy consumption. Therefore, the fee_limit of the transaction can be set to energy_used x energy unit price.
  • Parameter encoding and decoding example: Parameter and return value encoding and decoding


resultReturnRun result, for detailed parameter definition, refer to EstimateEnergy
energy_usedint64Estimated energy consumption, including the basic energy consumption and penalty energy consumption
energy_penaltyint64The penalty energy consumption
constant_resultstring[]Result list
transactionTransactionTransaction information, refer to GetTransactionByID


  • The estimated energy consumption: energy_used
  • The penalty energy consumption: energy_penalty
  • The basic energy consumption: energy_used - energy_penalty
Click Try It! to start a request and see the response here!