前言
求其区块链团队出品
旗下网站
- Web3js 教程:web3js.cn
- Hardhat 中文网: hardhat.cn
查询平均 gas 价格
查询当前网络平均 gas 价格
web3.eth.getGasPrice()
.then(function(gasPrice) {
console.log("当前平均 gas 价格为:" + web3.utils.fromWei(gasPrice, 'ether') + " ether");
})
.catch(function(error) {
console.log("出错了:" + error);
});