I'm using web3js to issue token which has a name and description. I'm using ropsten testnet.

Here's my tx.

const tx = {
      from: walletAddress,
      to: contractAddress,
      gas: 4700000,
      gasPrice: 20000000000,
      data: encodedABI,

Here's what ethgasstation.info is telling me now.

enter image description here

I'm confused about how to translate what I read on ethgasstation.info to my "gas" and "gasPrice" values. I kept getting "ran out of gas" error if I only set gas to 2000000 WITHOUT specifying gasPrice.

1 Answer 1


The value for gas depends on the type of transaction that you want to execute.

If it's a transfer of ether into an externally-owned account, then you can simply set it to 21000.

If it's a smart contract function, then it depends on the actual function. If you have 100% confidence in the function (e.g., it is your function and you know that it's not going to drain out "tons of gas"), then you can simply use a very large value (though not larger than the current block limit, which unfortunately is not specified on ethgasstation.info).

The value for gasPrice should be what you want, and the tradeoff is "higher price ==> faster execution, lower price ==> slower execution".

ethgasstation.info tells you the average or median (not really sure) price of the last N (not really sure) blocks.

In your screenshot, it tells you that this price is 5gwei, which translates to "5" followed by 9 zeros.

It also tells you that if you use this price, then the expected time for the execution of your transaction is 0.4 minutes.

If you don't specify a value for gasPrice, then the node executing your transaction will use the current price on the network.

  • I might have been inaccurate in some parts of the answer above (more specifically, in the second part of it), so will be happy to read corrections in case there are any... May 7, 2019 at 8:32
  • So, are you saying to set a gasPrice of 5 GWei, I should enter gasPrice: 5000000000? As in, const tx = { from: walletAddress, to: contractAddress, gas: 4700000, gasPrice: 5000000000, data: encodedABI, };
    – TThom
    May 7, 2019 at 8:45
  • @TThom: I didn't say that you should use 5000000000. I said that if you use 5000000000, then the expected time for the execution of your function is 0.4 minutes. If you don't care that much about this time, then you can use a lower price. If you want it to be executed faster, then you'll need to use a higher price. May 7, 2019 at 9:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.