0

我正在训练写 Solidity,当我尝试在区块链中下载 ERC20 示例时,我需要选择 gas 限制和 gas 价格。如何计算最优? https://www.ethgasstation.info说用 5 gwei gas 价格确认时间是 0.46 分钟,是真的吗?我读了论坛,我认为这太少了

ERC20 转账需要多少 gas 限制?

4

1 回答 1

0

你可以这样计算

const gasPrice = await web3.eth.getGasPrice();
const gasPriceLimit = await web3.eth.estimateGas({
     "from"      : walletbase,       
     "nonce"     : value, 
     "to"        : contractAddr,     
     "data"      : data
})
于 2019-01-15T13:41:55.483 回答