ERC-721 Tokens – Why ERC721 Contracts Need to Conform to Both ERC721 and ERC165 Standards

erc-721tokens

Reading through the EIP for ERC 721 I notice that it is required to implement 2 different interfaces. Why is this?

I noticed this portion in the documentation, but I think some clarification is necessary.

ERC-165 Interface

We chose Standard Interface Detection (ERC-165) to expose the
interfaces that a ERC-721 smart contract supports.

A future EIP may create a global registry of interfaces for contracts.
We strongly support such an EIP and it would allow your ERC-721
implementation to implement ERC721Enumerable, ERC721Metadata, or other
interfaces by delegating to a separate contract.

Best Answer

The ERC-165 standard provides a standard for generating an identifier for an interface.

This way, if the identifier of a given version of a given interface matches with your contract, it's a way of ensuring that your contract is compliant with that interface.

As per line 4 of the specification,

///  Note: the ERC-165 identifier for this interface is 0x80ac58cd

Edit:

In plain English, basically it's a way of taking a finger print of the interface, and checking that against a finger print of the functions you've implemented, and makes sure they're the same.

Related Topic