[Ethereum] Two ERC721 tokens that refer to the same metadata

erc-721nfttokens

This is a question about the ERC721 interface. I understand that the tokens are non-fungible and guaranteed to be unique to a specific account (owner).

One possible way to use ERC721 tokens would be to uniquely represent real-world assets.

I understand that there is also an ERC721Metadata contract that implements a token URI function which could point you to an image for example or some metadata that uniquely identifies the underlying asset, or it could be an IPFS address where some information is stored.

/**
  * @dev Returns an URI for a given token ID
  * Throws if the token ID does not exist. May return an empty string.
  * @param tokenId uint256 ID of the token to query
 */
 function tokenURI(uint256 tokenId) public view returns (string) {
    require(_exists(tokenId));
    return _tokenURIs[tokenId];
 }

What would happen if two ERC721 tokens were minted and referenced the same token URI or metadata about the same asset? Couldn't this be a problem and is there a solution?

I suppose there could be some mechanism that relies on consensus (maybe an oracle?) to resolve any disputes that arise from duplication like this, at least for certain use cases, just wondering if this is formalized at all.

EDIT –

A better way to phrase this question might be: if it was necessary to prevent a many-to-one relationship between different ERC721 tokens and the same physical thing, how could this be achieved, or are there existing real world examples where this is a problem that has been solved?

I'm taking for granted that the requirement is necessary for someone as part of the thought experiment or question. If you needed to be able to reason about the cardinality of physical things or metadata about things, relative to ERC721 tokens when using the ERC721 standard, you might need to solve this problem.

Best Answer

The ERC721 Metadata standard does not enforce uniqueness of the returned tokenURI. It is allowable for two 721 tokens to return the same metadata. Whether this is appropriate is up to you to decide as you implement the 721 contract. Most likely in the code you run during the minting process you will assign the metadata and decide whether or not you want to enforce it to be unique.

Related Topic