本篇内容主要讲解“web3.eth.estimateGas如何使用”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“web3.eth.estimateGas如何使用”吧!
估计调用需要耗费的gas量。这个方法在节点的VM中执行一个消息调用或交易,但是不会修改区块链。
调用:
web3.eth.estimateGas(callObject [, callback])
参数:
返回值:
示例:
var result = web3.eth.estimateGas({
to: "0xc4abd0339eb8d57087278718986382264244252f",
data: "0xc6888fa10000000000000000000000000000000000000000000000000000000000000003"
});
console.log(result);
//输出 "0x0000000000000000000000000000000000000000000000000000000000000015"
到此,相信大家对“web3.eth.estimateGas如何使用”有了更深的了解,不妨来实际操作一番吧!这里是天达云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!