1

On this etherscan doc page (https://info.etherscan.com/what-is-a-transaction-hash-txhash/), it says:

Transaction Fee

  • The actual cost of the transaction (Gas Used by Txn multiplied by Gas Price). Measured in ETH. This fee is paid to the miner for computing the transaction, regardless of whether the transaction is successful or not.

Gas Used by Txn:

  • The exact units of gas that was used for this transaction.

I wonder what's the difference between the too? The writing seems to suggest that "Transaction fee" is the non-refundable part of "Gas used by Txn". It hints that "transaction fee" will be charged even if the transaction failed. I'm confused here. If, for example, the miner is not able to get the block into the main chain and the transaction failed, how can it charge the sender the fee? Even if it becomes an uncle block, it still can't charge? Seems like it can only charge the fee if the blocks is accepted in which case, why would the transaction fail?

Or does it refer to "failure" in the sense that a smart contract considers the txn failed even though it is successfully executed by the EVM? Is there an article that uses examples to show the nuance between the two and the definition of "successful transaction" here? Thanks.

1 Answer 1

5

There are 3 numbers to be concerned about here

Gas units consumed per transaction is how much gas used for the transaction which is really a measure of the complexity of the transaction. This depends on how many operations or storage the smart contract is using.

Price per Gas unit is how much you're willing to pay for 1 Gas unit. This affects how fast your transaction will be executed. This is called Priority Gas Auctions (PGA), meaning all transactions are bidding in an auction for the miners to put up their transactions in the upcoming blocks.

Transaction Fee is how much ETH you pay for the transaction which is calculated by

Transaction Fee = Gas Units Used * Price per Gas Unit
1
  • Yes, but on etherscan the formula does not reconcile Commented Jun 1 at 22:18

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.