简体   繁体   中英

How to calculate optimal gas limit and gas price?

Im training to write on Solidity and when I try download ERC20 example in blockchain I need choose gas limit and gas price. How to calculate optimal? https://www.ethgasstation.info says that with 5 gwei gas price confirmation time will be 0.46 mins, is it true? I read forums and I think this is too few

How much gas limit I need for ERC20 transfer?

you can calculate like this

const gasPrice = await web3.eth.getGasPrice();
const gasPriceLimit = await web3.eth.estimateGas({
     "from"      : walletbase,       
     "nonce"     : value, 
     "to"        : contractAddr,     
     "data"      : data
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM