Call{value:} results in an internal transaction — so why is it recommended over tranfer()?

internal transactions are not "real" transactions, it's how etherscan (and forks) represents calls between contracts. transfer() is just syntactic sugar to call{gas:2300}() (as explained in the consensys blog).

call{}() passes all available gas instead. this means that the contract receiving the ETH will have enough gas to do a reentrancy attack, this is why a reentrancy guard is needed in this case (this also future proofs the contract against gas changes).

the value field in the metamask transaction is the value sent in that transaction to trigger the transfer() , not the amount received.

Receiving a transaction sent from another EOA account is different from calling a contract that sends eth. in the former is a transaction and metamask shows it as a received tx, the latter is an internal transaction and metamask shows it as a contract call)

2 Likes