EstimateEnergy
POST
/walletsolidity/estimateenergy
vm.estimateEnergy
and vm.supportConstant
configuration items must both be activated in the node configuration file.wallet/triggerconstantcontract
API can estimate the energy consumption for calling most on-chain smart contracts, such as USDD, USDT, USDC, and TUSD. However, compared to the wallet/triggerconstantcontract
API, the wallet/estimateEnergy
API provides more accurate energy estimates for a small number of special contracts.wallet/estimateEnergy
API is optional for FullNode. If developers encounter an error indicating that the node does not support the estimateEnergy
function, it is recommended to continue using the wallet/triggerconstantcontract
API to estimate energy consumption.estimateEnergy
API does not generate an on-chain transaction and does not alter the status of the current node.energy_required
field in the returned value represents the estimated energy amount. Therefore, the fee_limit
of the transaction can be set to energy_required x energy unit price
.Field | Type | Description |
---|---|---|
result | Return | Run result |
result.result | bool | Is the estimate successful |
result.code | response_code (enum) | Response code, an enum type |
result.message | string | Result message |
energy_required | int64 | Estimated energy to run the contract |
Request
Body Params application/json