简体   繁体   中英

What gasPrice to use to deploy contract on congested ethereum mainnet

I am attempting to deploy a contract onto the Ethereum mainnet, I have specified:

network_id: 1,

provider: infura,

gas: 5000000,

gasPrice: 140

And I continuously get the errors:

Error: Contract transaction couldn't be found after 50 blocks

or

transaction underpriced

Is this because the mainnet is so congested, miners are not picking up my transaction within the 50 block period?

What gas/gasPrices have other people successfully used on the mainnet?

You can check current gas price at https://ethgasstation.info/ for example. Note that gas price is usually shown in Gwei. So 21 Gwei is 21000000000 wei or 0.000021 eth.

To expand on Andrey's answer, your gas is WAY too low. Historically, you will typically need to pay around 10-20 Gwei to have your transaction mined in an average amount of time. If you can wait 10s of minutes or even hours, you can get away with ~5Gwei. If you need the transaction to execute fast, or if you just want an average transaction time when the network is really congested, you're probably looking at ~40Gwei.

You can programmatically set your gas price based on the median gas price of the most recent mined blocks using web3.eth.getGasPrice(callback) . Source .

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