1

How can we use refunded GAS from a transaction in subsequent ETH transfers? In general, how is refunded GAS used? How can we check the status of the amount of refunded GAS?

2

You don't need to do anything. The gas refund is applied at the end of the transaction, so the total amount of gas your account is charged for already includes the gas refund. (E.g. if the transaction would have cost 50,000 gas but there was a 15,000 gas refund, the transaction costs only 35,000 gas.)

| improve this answer | |
  • Thanks @smarx. If I want to harness the gas refund using a contract like gastoken, how is it done? – Omni Aug 29 '18 at 17:28
  • Gastoken is a clever trick, where you "store" gas by writing to storage and then get a refund by later zeroing out that storage. There's nothing special to do except set the value to zero (getting a gas refund) in the same transaction as you're doing something else. – user19510 Aug 29 '18 at 17:48
  • Ok, so do you mean I have to set the GAS limit to zero in the subsequent transaction? – Omni Aug 29 '18 at 18:55
  • No, not at all. :-) The gas refund comes from storing a 0 in storage where there used to be a non-zero value. – user19510 Aug 29 '18 at 20:52

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.