EstimateEnergy
POST
/wallet/estimateenergy
Note:
vm.estimateEnergy
and vm.supportConstant
must be enabled in the node configuration file at the same time.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. Meanwhile, compared to the existing wallet/triggerconstantcontract
API, the wallet/estimateEnergy
API will be more accurate in estimating the energy consumption of calling a small number of special contracts. But for FullNode, enabling the wallet/estimateEnergy
API is optional. If an error message (e.g., "this node does not support estimate energy") is shown when calling the new API, it is recommended to continue using the wallet/triggerconstantcontract
API to estimate energy consumption.estimateenergy
will not generate an on-chain transaction, nor will it change the status of the current node.energy_required
field in the returned value indicates 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