2

Why do some transactions use more gas than others, even when they are transferring the same ERC20 token, for example USDC. Even when the receiver is the same and the transferred amount is the same. This one used 42,381 gas: https://etherscan.io/tx/0x05c86098176a2d7d7d85375c7745503c36b7abc7dbdcbcdd01802859b6fec3a9 This one used 27,381 gas: https://etherscan.io/tx/0x4499361f0ab60aed804f6d4ead7aa2ec0f801dcc3cfa1d945bd82c1081ca8611

2

The difference of 15,000 gas is caused by a gas refund which occurs when storage is cleared (see Yellow Paper Appendix G):

Rsclear 15000 Refund given (added into refund counter) when the storage value is set to zero from non-zero.

3
  • To clarify: the gas consumption depends on if the receiver has already tokens and if the sender has zero tokens after the transaction is done. – Mikko Ohtamaa Mar 10 at 7:41
  • So this refund happenes automatically, if I send all my token, because there is nothing to be recorded in the blockchain anymore. Is that correct? – Thomas Mar 18 at 11:36
  • Yes, you're correct. – pwagner Mar 18 at 11:42

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.