Skip to main content
2 of 2
added 11 characters in body
goodvibration
  • 26.2k
  • 5
  • 49
  • 89

When transferring ether from an externally-owned account to a smart-contract account, the fallback function of the smart contract is executed (if it doesn't implement one, then the transaction reverts).

Therefore, the cost of such transaction is 21000 plus the cost of the fallback function itself.

If this function doesn't do anything except for (implicitly) receiving the funds, for example:

function () external payable {}

Then the cost will be just slightly higher than 21000.

Bonus fact:

When transferring ether from a smart-contract account to a smart-contract account, the fallback function of the (destination) smart contract is executed with a stipend of only 2300 gas, keeping it limited to a very small number of operations. This feature was incorporated at around September of 2016, in order to prevent the destination contract from acting maliciously.

goodvibration
  • 26.2k
  • 5
  • 49
  • 89