Why can a transaction use more gas than what's attached?

Viewed 68
1 Answers

Reading through these two chapters may be useful to understand the concepts:

I'm by no means an expert, so this answer is a guess more than anything.

When a user calls a method on your contract, they are automatically deducted a fixed amount (gas) set by the contract configurations. For example

  • action_function_call_send_sir: 2_319_861_500_000
  • action_function_call_execution: 2_319_861_500_000
  • action_receipt_creation_send_sir: 108_059_500_000

With these assumptions, the attached gas doesn't need to be higher than the gas used. If the total sum of "automatically deducted gas" + "attached gas" is more than what's actually burned, you'll get a refund.

From your transaction, you are refunded 0.00005Ⓝ. If you try to attach even less gas, e.g. 579279990000, you'll still be able to call the method, and you'll be refunded a little less 0.00001Ⓝ (See this transaction)

Related