On this etherscan doc page (https://info.etherscan.com/what-is-a-transaction-hash-txhash/), it says:
- 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.