ERC-5521: Referable NFT

An ERC-721 extension to construct reference relationships among NFTs


Metadata
Status: FinalStandards Track: ERCCreated: 2022-08-10
Authors
Requires

Abstract


This standard is an extension of ERC-721. It proposes two referable indicators, referring and referred, and a time-based indicator createdTimestamp. The relationship between each NFT forms a directed acyclic graph (DAG). The standard allows users to query, track and analyze their relationships.

System Architecture

Motivation


Many scenarios require the inheritance, reference, and extension of NFTs. For instance, an artist may develop his NFT work based on a previous NFT, or a DJ may remix his record by referring to two pop songs, etc. A gap in existing NFT standards is the absence of established relationships between an NFT and its original creator. This void isolates NFTs, rendering the sale of each one a one-off transaction, thereby obstructing creators from accruing the full value of their intellectual property over time.

In this sense, proposing a referable solution for existing NFTs that enables efficient queries on cross-references is necessary. By introducing a reference relationship between NFTs, a sustainable economic model can be established to incentivize continued engagement in creating, using, and promoting NFTs.

This standard accordingly introduces a new concept, referable NFT (rNFT), which can transform static NFTs into a dynamically extensible network. We embed reference information, including referring and referred relationships, aiding in the formation of a Direct Acyclic Graph (DAG)-based NFT network. This structure provides a transparent graphical historical record and allows users to query, trace, and analyze relationships. It can enable NFT creators to build upon existing works without the need to start anew.

An intuitive example: users can create new NFTs (C, D, E) by referencing existing ones (A, B), while the referred function informs the original NFTs (A, B) about their citations (e.g., A ← D; C ← E; B ← E, and A ← E). Here, the createdTimestamp (block-level) serves as an indicator for the creation time of NFTs (A, B, C, D, E).

Key Takeaways

This standard provides several advantages:

Clear ownership inheritance: This standard extends the static NFT into a virtually extensible NFT network. Artists do not have to create work isolated from others. The ownership inheritance avoids reinventing the same wheel.

Incentive Compatibility: This standard clarifies the referable relationship across different NFTs, helping to integrate multiple up-layer incentive models for both original NFT owners and new creators.

Easy Integration: This standard makes it easier for the existing token standards or third-party protocols. For instance, the rNFT can be applied to rentable scenarios (cf. ERC-5006 to build a hierarchical rental market, where multiple users can rent the same NFT during the same time or one user can rent multiple NFTs during the same duration).

Scalable Interoperability: This standard enables cross-contract references, giving a scalable adoption for the broader public with stronger interoperability.

Specification


The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.

  • UpdateNode: event emitted when setNode is invoked;
  • safeMint: mint a new rNFT;
  • setNode: set the referring list of an rNFT and update the referred list of each one in the referring list;
    • setNodeReferring: set the referring list of an rNFT;
    • setNodeReferred: set the referred list of the given rNFTs sourced from different contracts;
      • setNodeReferredExternal: set the referred list of the given rNFTs sourced from external contracts;
  • referringOf: get the referring list of an rNFT;
  • referredOf: get the referred list of an rNFT;
  • createdTimestampOf: get the timestamp of an rNFT when it is being created.

Implementers of this standard MUST have all of the following functions:


Rationale


Is this event informative enough?

UpdateNode: This event disseminates crucial information, including the rNFT ID, its owner, and lists of contract addresses/IDs with rNFTs referring to or referred by the subject rNFT. This data set enables stakeholders to efficiently manage and navigate the complex web of relationships inherent in the rNFT ecosystem.

Implementers are free to choose to use a struct (a recommended struct is given in the Reference Implementation), or several separate mappings, or whatever other storage mechanism. Whichever mechanism chosen has no observable effect on the behaviour of the contract, as long as its output can fulfill the UpdateNode event.

Why createdTimestampOf?

createdTimestamp: A key principle of this standard is that an rNFT should reference content already accepted by the community (a time-based sequence known by participants). Global timestamps for rNFTs are thus essential, serving to prevent conflicting states (akin to concurrency issues in transaction processing and block organization). We define a block-level timestamp where createdTimestamp = block.timestamp Note that, given that the granularity of references is tied to the block timestamp, it is impractical to discern the order of two rNFTs within the same block.

How is cross-contract reference performed?

setNodeReferredExternal: This function operates conditionally, dependent on successful interface verification in external contracts. Such selective invocation ensures backward compatibility and integration with existing contracts, provided they adhere to specified interfaces.

Backwards Compatibility


This standard can be fully ERC-721 compatible by adding an extension function set.

Test Cases


Test cases are included in ERC_5521.test.js

Reference Implementation


The recommended implementation is demonstrated as follows:

  • Relationship: a structure that contains referring, referred, referringKeys, referredKeys, createdTimestamp, and other customized and optional attributes (i.e., not necessarily included in the standard) such as privityOfAgreement recording the ownerships of referred NFTs at the time the Referable NFTs (rNFTs) were being created or profitSharing recording the profit sharing of referring.
  • referring: an out-degree indicator, used to show the users this NFT refers to;
  • referred: an in-degree indicator, used to show the users who have refereed this NFT;
  • referringKeys: a helper for mapping conversion of out-degree indicators, used for events;
  • referredKeys: a helper for mapping conversion of in-degree indicators, used for events;
  • createdTimestamp: a time-based indicator, used to compare the timestamp of mint, which should not be editable anyhow by callers.
  • referringOf and referredOf: First, the current referringOf and referredOf allow cross-contract looking up, while this cannot be done by directly accessing _relationship. Secondly, only if privacy is not a concern, making _relationship public simplifies the contract by relying on Solidity’s automatically generated getters. However, if you need to control the visibility of the data, keeping the state variable private and providing specific getter functions would be the best approach. For example, if _relationship includes details about specific users’ interactions or transactions or some private extensible parameters (in the updated version, we specifically highlight the Relationship can be extended to meet different requirements), always making this data public could reveal users’ behavior patterns or preferences, leading to potential privacy breaches.
  • convertMap: This function is essential for retrieving the full mapping contents within a struct. Even if _relationship is public, The getters only allow retrieval of individual values for specific keys. Since we need comprehensive access to all stored addresses, convertMap is necessary to fulfill our event emission requirements.

Security Considerations


Timestamp

The createdTimestamp only covers the block-level timestamp (based on block headers), which does not support fine-grained comparisons such as transaction-level.

Ownership and Reference

The change of ownership has nothing to do with the reference relationship. Normally, the distribution of profits complies with the agreement when the NFT was being created regardless of the change of ownership unless specified in the agreement.

Referring a token will not refer to its descendants by default. In the case that only a specific child token gets referred, it means the privity of the contract will involve nobody other than the owner of this specific child token. Alternatively, a chain-of-reference all the way from the root token to a specific very bottom child token (from root to leaf) can be constructed and recorded in the referring to explicitly define the distribution of profits.

Open Minting and Relationship Risks

The safeMint function has been deliberately designed to allow unrestricted minting and relationship setting, akin to the open referencing system seen in platforms such as Google Scholar. This decision facilitates strong flexibility, enabling any user to create and define relationships between NFTs without centralized control. While this design aligns with the intended openness of the system, it inherently carries certain risks. Unauthorized or incorrect references can be created, mirroring the challenges faced in traditional scholarly referencing, where erroneous citations may occur. Additionally, the open nature may expose the system to potential abuse by malicious actors, who might manipulate relationships or inflate the token supply. It is important to recognize that these risks are not considered design flaws but intentional trade-offs, which balance the system's flexibility against potential reliability concerns.

Stakeholders should be aware that the on-chain data integrity guarantees extend only to what has been recorded on the blockchain and do not preclude the possibility of off-chain errors or manipulations. Thus, users and integrators should exercise caution and judgment in interpreting and using the relationships and other data provided by this system.

Copyright


Copyright and related rights waived via CC0.