1

Are the Miners calculating the actual GAS USED for each Transaction (specifically for contract execution) before they stuff it into the Candidate Block to get so close to the Block GAS Limit?

The above would take some time which is why block 10832612 is empty for example. The Miner is mining an empty Block. When the maximum GAS USED Block is built, they start mining this new more profitable block?

Is my understanding correct?

Thank you

1

Executing the transactions is a trivial task compared to solving the mining puzzle.

So I'd imagine it happens like this typically: miner checks the available transactions, orders them by their gas price (highest first) and starst executing them. When the miner has executed enough transactions that the block is full he/she includes those transactions to the block and starts trying to solve the mining puzzle.

Of course even if the task is trivial it does take some time so sometimes the miner may choose to mine an empty block to get a small edge in the mining puzzle.

2
  • I was thinking about this further. Wouldn't the miner already calculate the GAS USED for each transaction before putting them in their MemPool? If the Transaction is a contract they just need to check that the newly mined Block doesn't reference a Transaction in their memPool (otherwise it needs to be re-run) and then they can quickly start building their candidate block.
    – Picard78
    Sep 11 '20 at 8:57
  • Possible. A few issues with that approach: 1) Transaction price may depend on other transactions 2) Executing the transaction "in advance" is probably a waste of precious mining time as most likely you will not get to include the tx in your block before someone else has included it in a successful block already. Also client implementations probably vary. Anyway, if you have further questions please post a new question Sep 11 '20 at 9:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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