EstimateEnergy

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

注意

  • 此 API 接口默认是关闭的。若要启用,您必须在节点配置文件中同时开启 vm.estimateEnergyvm.supportConstant这两项配置。
  • estimateEnergy 仅执行预估,不会产生链上交易,也不会修改当前节点的任何状态。其返回结果中的 energy_required 字段即为预估的能量值,因此,交易的 fee_limit 应设置为 energy_required 乘以能量单价。
  • 虽然 triggerconstantcontract 接口已能预估链上绝大多数合约(如 USDD、BTT 等)的能量消耗,但 estimateEnergy 接口在预估少数特殊合约的能量消耗时精度更高,且根据其返回的预估值设置的 fee_limit 保证足够
  • parameter编解码参看:参数编码和解码

返回值

字段类型描述
resultObject包含执行结果详情 (状态、代码、信息) 的对象。
result.resultbool预估是否成功。
result.coderesponse_code(enum)响应代码,指示错误类型。(仅在失败时返回)
result.messagestring交易失败时的详细错误信息。(格式: hex 字符串)
energy_requiredint64执行交易所需的预估能量。
Body Params
string
required
string
string
string
string
int64
int64
int64
boolean
Defaults to true
Responses

Language
Credentials
Header
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json