EIPs Explained

ERC-7507 · Draft · ERC · 2023-08-24

ERC-7507: Multi-User NFT Extension

A Draft ERC-721 extension that lets an NFT have many time-limited users at once, so IP-style assets can be licensed by subscription without transferring ownership.

What problem does it solve?

Some NFTs represent intellectual property (music, art, software, data) that the owner wants to license rather than sell. Licensing usually means subscriptions: many people get access for a period of time, at the same time, while ownership stays put.

ERC-4907 already added a "user" role with an expiry, but it allows only one user per token, which fits renting a game item but not sharing an IP asset with many subscribers. ERC-7507 adds a non-exclusive, multi-user version.

How it works

The extension is deliberately tiny and mirrors ERC-4907's naming:

Item Purpose
setUser(tokenId, user, expires) Owner (or approved operator) grants or updates user's access until the UNIX timestamp expires. Setting 0 effectively revokes it.
userExpires(tokenId, user) Returns that user's expiry; 0 if they never had access.
UpdateUser(tokenId, user, expires) Event emitted on every change.

Each (tokenId, user) pair has its own expiry, so any number of subscribers can be active at once. An app checks access with userExpires(tokenId, user) > block.timestamp (or the off-chain equivalent).

There is intentionally no usersOf(tokenId) function: enumerating all users would force implementations to keep an on-chain list, which open subscription models may not need. Indexers can rebuild the list from UpdateUser events.

Sample code

Minimal implementation on top of OpenZeppelin (v4-style hooks):

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";

interface IERC7507 {
    event UpdateUser(uint256 indexed tokenId, address indexed user, uint64 expires);
    function userExpires(uint256 tokenId, address user) external view returns (uint256);
    function setUser(uint256 tokenId, address user, uint64 expires) external;
}

contract LicensedNFT is ERC721, IERC7507 {
    mapping(uint256 => mapping(address => uint64)) private _expires;

    constructor() ERC721("Licensed", "LIC") {}

    function setUser(uint256 tokenId, address user, uint64 expires) external {
        require(_isApprovedOrOwner(msg.sender, tokenId), "not owner or approved");
        _expires[tokenId][user] = expires;
        emit UpdateUser(tokenId, user, expires);
    }

    function userExpires(uint256 tokenId, address user) external view returns (uint256) {
        return _expires[tokenId][user];
    }

    function hasAccess(uint256 tokenId, address user) external view returns (bool) {
        return _expires[tokenId][user] > block.timestamp;
    }
}

Things to know

  • Status: Draft. The interface may change.
  • Unlike ERC-4907, the spec does not say user rights are cleared on transfer. Decide explicitly whether existing subscriptions should survive a sale of the NFT.
  • Selling subscriptions (payment, renewal) is not part of the standard; it only records who may use the token and until when.
  • On-chain expiry does not enforce access to off-chain content by itself; the service delivering the IP has to check it.

#nft #erc721 #licensing #subscription #rental

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