Estimate the energy required for the successful execution of smart contract transactions
- This API is closed by default. To open this interface, the two configuration items
vm.supportConstantmust be enabled in the node configuration file at the same time.
wallet/triggerconstantcontractAPI can be used to estimate the energy consumption value of calling most smart contracts on the chain, such as USDD, USDT, USDC, TUSD, etc. Meanwhile, Compared to the existing
wallet/estimateEnergyAPI will be more accurate in estimating the energy consumption of calling a small number of special contract. But for FullNode, enabling the
wallet/estimateEnergyAPI is optional. So please pay attention that when developers call
wallet/estimateEnergy, if the error message shows that the node does not support this function when calling the new API (this node does not support estimate energy), it is recommended to continue using the
wallet/triggerconstantcontractAPI to estimate energy consumption.
estimateenergywill not generate an on-chain transaction, nor will it change the status of the current node.
energy_requiredfield in the returned value is the energy estimated amount. Therefore, the
fee_limitof the transaction can be set to
energy_required x energy unit price.
- Parameter encoding and decoding example: Parameter and return value encoding and decoding