Skip to content
以太坊兼容接口

eth_estimateGas在线调用

POST eth_estimateGas (eth_estimateGas)
参数

from: DATA, 20字节 - 发送交易的源地址

to: DATA, 20字节 - 交易的目标地址,当创建新合约时可选

gas: QUANTITY - 交易执行可用gas量,可选整数,默认值90000,未用gas将返还。

GasPrice: VoidChain已没有竞价机制,已作为交易类型和元空间定义属性设置

value: QUANTITY - 交易发送的金额,可选整数

data: DATA - 合约的编译带啊或被调用方法的签名及编码参数

nonce: QUANTITY - nonce,可选。可以使用同一个nonce来实现挂起的交易的重写

params: [{

"from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",

"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",

"gas": "0x76c0", //

"gasPrice": "0x0", //

"value": "0x9184e72a", //

"data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"}]

返回值

Result: gas值

示例代码
请求
{
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"params": [
  "see above"
],
"id": "1"
}
响应
{
 "jsonrpc":  "2.0",
 "id":  1,
 "result":  "0x1406f40"
}

本页目录