Base on this answer related to How Ethereum estimate the gas for running a contract?:

Which brings the second point. geth gets its estimate by simulating the transaction itself, based on the latest block. There is essentially no other way to do so.

Based on that: miners are able to simulate the transactions before they accept them. Since all miners are using GPU this should be pretty fast for them and all miner's have the latest block.

The image is take from Ethereum white-paper:

enter image description here

6.Let TX be the block's transaction list, with n transactions. For all i in 0...n-1, set S[i+1] = APPLY(S[i],TX[i]). If any application returns an error, or if the total gas consumed in the block up until this point exceeds the GASLIMIT, return an error.

In the simulation if a miner detects an exceeds the GASLIMIT for a transaction(Tx), for example for the Tx[1] on the image Tx[1] could be discarded.


     set S[i+1] = APPLY(S[i],TX[i])

This would save sender to pay additional GAS-fee for his Tx that will return an error due to GASLIMIT, with the help of the simulation on the miner-side.

[Q] Why miners do not simulate their list of transactions to detect a gas exceed and discard those Txs that exceed gas?

Thank you for your valuable time and help.

2 Answers 2


"Simulating" the transaction takes just as much work as actually doing it. Essentially, to estimate gas, a node just runs the transaction and then discards the side effects.

In other words, what you describe is basically what already happens. If the sender were not charged for the consumed gas, a denial of service attack would be trivial. (Simply send transactions out to the network that are going to run out of gas, forcing the nodes to waste resources processing them for free.)

  • Miner can detect those nodes that keep exceed gas limit and maybe on next time ignore their transactions? It seems like a better way to detect the attacking nodes on the run time. There is a penalty for honest-clients to pay, which seems not fair. @smarx
    – alper
    Dec 22, 2017 at 17:35
  • 1
    The nodes here are the victims, not the perpetrators. Anyone can broadcast a transaction to the network via any node. (For example, anyone can anonymously paste a transaction here: etherscan.io/pushTx.)
    – user19510
    Dec 22, 2017 at 17:46

Also, besides what smarx said, if a transaction exeeds gas, the miner gets paid, so there is no incentive for miners not to include them

  • But if there is no transaction, miners also get paid right?
    – alper
    Dec 22, 2017 at 18:36
  • Miners get paid, as of today (byzantium), 3 ether per block, plus the gas used by transactions included in each block Dec 25, 2017 at 23:03

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.