TriggerConstantContract

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 or estimating the energy consumption. (Confirmed state)

Note:

  • TriggerConstantContract operation will not generate an on-chain transaction, nor will it change the status of the current node.
  • For estimating energy: use triggerconstantcontract to call the non-readonly method of the contract, and 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

Returns

FieldTypeDescription
resultReturnRun result, for detailed parameter definition, refer to EstimateEnergy
energy_usedint64Estimated energy consumption
constant_resultstring arrayResult list of tiggered functions
transactionTransactionTransaction information, refer to GetTransactionByID
Language
Click Try It! to start a request and see the response here!