EIPs Explained

ERC-7510 · Draft · ERC · 2023-08-24

ERC-7510: Cross-Contract Hierarchical NFT

A draft ERC-721 extension that records which NFTs, possibly in other contracts, a token was derived from, so derivative works can point to one or more parent NFTs on-chain.

What problem does it solve?

NFTs are increasingly used as source material: a 3D model built from a 2D avatar, a film featuring characters from several collections, licensed merchandise. There was no standard way for a derivative NFT to say "I come from these tokens".

ERC-6150 already defines parent/child trees, but only inside a single contract and with one parent per token. Derivative works usually live in a new collection and often have several parents. ERC-7510 fills that gap.

How it works

A token reference is a struct of (collection, id), so a parent can be in any contract:

  • parentTokensOf(tokenId) returns the list of parent tokens.
  • isParentToken(tokenId, otherToken) checks one relationship.
  • setParentTokens(tokenId, parentTokens) replaces the whole parent list and emits UpdateParentTokens(tokenId).

Only parent links are stored, never children. The original NFT exists before its derivatives, and it usually belongs to a different contract with different write permissions, so asking it to record children would need cross-contract permissions that do not exist in practice. Children can be discovered off-chain by indexing UpdateParentTokens events.

The reference implementation lets only the token's owner or an approved address call setParentTokens, and clears the parent list when a token is burned.

Sample code

Interface from the spec plus a lookup from ethers v6:

// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.20;

struct Token {
    address collection;
    uint256 id;
}

interface IERC7510 {
    event UpdateParentTokens(uint256 indexed tokenId);

    function parentTokensOf(uint256 tokenId) external view returns (Token[] memory);
    function isParentToken(uint256 tokenId, Token memory otherToken) external view returns (bool);
    function setParentTokens(uint256 tokenId, Token[] memory parentTokens) external;
}
import { Contract, JsonRpcProvider } from "ethers";

const provider = new JsonRpcProvider(process.env.RPC_URL);
const derived = new Contract(derivedAddress, [
  "function parentTokensOf(uint256) view returns (tuple(address collection, uint256 id)[])",
], provider);

for (const p of await derived.parentTokensOf(1234n)) {
  console.log(`parent: ${p.collection} #${p.id}`);
}

Things to know

  • Status: Draft. The interface may still change.
  • A parent link is a claim made by the derivative's owner, not proof of a licence. Nothing stops someone listing any NFT as a parent. Apps should verify parents exist (they may have been burned) and treat links as informational.
  • setParentTokens overwrites the full list; there is no add/remove-one function.
  • Implementations should advertise support via ERC-165 (the reference implementation does).

#nft #erc-721 #derivatives #hierarchy #ip

Details

Authors
Ming Jiang (@minkyn), Zheng Han (@hanbsd), Fan Yang (@fayang)
Status
Draft
Type
Standards Track / ERC
Created
2023-08-24
Requires

Machine-readable: Markdown · JSON