ERC-721 – Why Does ERC721 Have transferFrom and safeTransferFrom?

erc-721soliditytransferfrom

ERC721 has both safeTransferFrom and transferFrom, where safeTransferFrom throws if the receiving contract's onERC721Received method doesn't return a specific magic number. This is to ensure a receiving contract is capable of receiving the token, so it isn't permanently lost.

But why would transferFrom exist too when it doesn't have this check? My only guess it to make ERC721 compatible with ERC20, which has a transferFrom method with the same signature. However the semantics of the method in each standard are different (the uint256 in ERC20 refers to the value, whereas in ERC721 it refers to the tokenID) so compatibility there seems misleading.

What am I missing?

Best Answer

There is an explanation in the original Github ERC721 thread about keeping the "unsafe" transfer function (comment from Dieter Shirley, alias "dete", one of the authors of EIP-721) :

Upon further reflection and discussion with @flockonus, we are proposing to keep a straightforward (and therefore "unsafe") transfer() method. (i.e. It would work like ERC-20, and not EIP-223.)

Our reasoning is as follows:

  • Simpler is always better for standards. The fewer requirements, the harder it is to screw it up. (And NFTs are already complicated enough!)
  • It is not the job of a smart contract to protect against every possible user error (it must protect against invalid actions, not unintended actions). In particular, the case we are trying to avoid (sending NFTs to contracts that don't know how to handle them) is better served by checks and warnings in the wallet software. A wallet (or other smart contract interface) will always be able to have more robust and dynamic checks than a smart contract, and is also able to engage in some "back-and-forth" dialog with the user. Smart contracts don't have the equivalent of a "This seems unsafe, are you sure?" dialog box!

This functionality has therefore been retained for greater flexibility and to keep the standard as simple as possible.