5

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.

3
  • 1
    “The system” is a big concept. Please specifically identify the use case and whose interests you are caring to protect. Commented Oct 1, 2018 at 3:05
  • I don't have a specific use case in mind, except maybe ERC721 tokens that represent physical property that is unique (e.g. a plot of land or a house, if this is possible)? Definitely understand and agree it is use case dependent, so I removed that wording. Commented Oct 1, 2018 at 3:56
  • 2
    Please use 0xcert's implementation, this is the "reference" implementation and it is correct. You are quoting "Returns an URI for a given token ID" which came from OpenZeppelin and is incorrect. The OZ implementation is NOT standards compliant. Commented Oct 5, 2018 at 14:38

1 Answer 1

6

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.

3
  • The standard defines tokenURI as "A distinct Uniform Resource Identifier (URI) for a given asset." But of course implementations will break the standard sometimes. Commented Oct 5, 2018 at 14:29
  • The schema for tokenURI defined in the standard does not suggest that it would be inappropriate to have 2 tokens which have effectively the same metadata. And the standard gives no direction on how exactly you would uniformly differentiate in such cases. It is up to the implementation to make these determinations in regard to its use of Title, Name, Description, Image -- if these are all the same for 2 tokens I don't necessarily see that as a breaking of the standard.
    – cousinit
    Commented Oct 6, 2018 at 2:34
  • If that is the case, the how do NFT’s indicate ownership of the meta data? Commented Jul 15, 2021 at 4:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.