How to calculate the Transaction fee

While doing transferring FlowTokens from one account to another, I noticed the balance was dropping by .0001 tokens on the withdrawal. However, the gas limit on the transaction was zero. I noticed there is a FlowFees contract which emits deposit and withdrawal events. Sadly, I didn’t find any of these events attached either.

This is on the devnet. The transaction hash is:
80ebe4b1657d7277e677a8fcb57a2f9658867ac8131c8834c9091665dc1035e5

Fees are definitely being charged, but I can only tell what they are by asking for the balance before and after the transaction has been sealed. This does not seem like a good solution. Is there something I am missing?

Fee deduction happens in a meta transaction. the events from fee deduction meta transactions are discarded. This is changed by PR https://github.com/onflow/flow-go/pull/689 which we’re trying to get in to tomorrows spork.This PR has two side effects:

  • fee deduction should be faster
  • events (from fee deduction) should be properly triggered

I have some further questions.

  1. Can I presume the fee events won’t be on the same transaction as the deposit or withdrawals?

  2. Will they be generated in another transaction (meta-transaction) in the same block?

  3. Can I find the fee events by using GetEventsForHeightRange?

Currently, the events are in a different transaction, but after this update, they will be generated in the same transaction as the deposits and withdrawals, I think that currently you would be able to get the fee events from different transaction IDs, but this will change very soon, so I would just wait until the update happens in the next spork to use it the way you were originally trying to