1

I did a check, in ethgasstation the current safeLow = 15GWei, which is equal = 15,000,000,000 wei

However, when I issue eth.getBlock("latest") what I get was:

> eth.getBlock("latest")
{
  difficulty: 3462313604051830,
  extraData: "0x73656f3130",
  gasLimit: 8000029,
  gasUsed: 7991485,

The gasLimit and gasUsed here are way lower than the safeLow value. So I can only guess that they are using different units in measurement.

Otherwise I really do not know what might had gone wrong. Because I had never enter so many zeros when I wanted to send an ETH transaction.

s k
  • 886
  • 1
  • 10
  • 22

1 Answers1

1

"gas" is an abstract unit of work. Operations inside the EVM require a certain amount of gas.

What is the unit of measurement used in GasPrice and GasLimit?

gasPrice is the cost per unit of work that you pay to the miner who mines your transaction. The units are therefore wei / gas. Gas prices form a market: the higher price you use, the more chance a miner will decide to include your transaction in a block.

The 15 GWei is the amount you're currently willing to spend for each unit of work done by the EVM. (The current safeLow, standard and fast values on ethgasstation.info reflect the current state of the gas price market.)

If we're talking about a given block, the gasLimit is the total amount of "EVM work" that the transactions inside the block can equate to. The limit is currently around 8 million gas.

gasUsed is the amount of gas that was used for a particular. The closer this value is to the gasLimit, the fuller the block can be considered.

See What is meant by the term "gas"? for more details.

Richard Horrocks
  • 37,835
  • 13
  • 87
  • 144
  • This doesn't answer the different in the GasPrice that I saw when I query eth.getBlock("latest") – s k Jul 26 '18 at 23:49
  • The gasPrice isn't output when you run eth.getBlock(). Do you mean gasUsed/gasLimit? If so, these are different things. The gasPrice is how much you're willing to pay for a unit of gas. The gasUsed and gasLimit are quantities of gas, not prices. – Richard Horrocks Jul 27 '18 at 06:20
  • @RichardHorrocks, this is an overkill answer to the question. Simply put, what unit of gas measurement is used in software like geth and hardhat. Is it Gwei or just wei? – Udo E. Jan 06 '23 at 20:19
  • gas itself is unit-less. (Hence the 'abstract measure of work' mentioned above.) The gas price in Geth and Hardhat will likely be in wei (i.e. the base unit used by the EVM), though most UIs/block explorers will use Gwei for convenience. – Richard Horrocks Jan 06 '23 at 20:36
  • Unless of course you are asking about EVM instruction costs. In which case these values don't have units. (Not wei, not Gwei - simply no units.) So for example, an ADD instruction costs 3 ("3 gas"). – Richard Horrocks Jan 06 '23 at 20:53
  • @RichardHorrocks Here (https://etherscan.io/chart/gasprice) gasPrice is shown as gwei. Then should gasPricedefine as gwei / gas? – alper Dec 24 '23 at 14:53
  • 1
    Hi @alper I think technically yes. I think people just ignore the / gas part because it has no units, and probably because the name gasPrice already contains the word gas... – Richard Horrocks Dec 24 '23 at 15:13
  • @RichardHorrocks Thanks for the fast reply. In most cases gas unit is neglected due to the naming gas like you said. As I understand Gas Used has gas unit(gas), where when we multiple Gas Used * Gas Price the result would have gwei unit. – alper Dec 24 '23 at 15:58