Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

ERC-7507 proposes an ERC-721 extension that allows multiple users to receive limited, time-bound access rights to the same token.

This article translates, summarizes, and expands on the following proposal.

ERC-7507 was at the Draft stage as of October 11, 2023, the reference date used in the original article.

Overview

An ordinary ERC-721 token has a single owner. The owner can exercise the ownership rights defined by the contract and authorize other accounts to perform certain operations.

ERC-7507 adds usage rights for multiple users, with an independently configured expiration timestamp for each user.

For ERC-721, see the following article.

https://chaldene.net/erc721

Different users can therefore use the same NFT simultaneously or during overlapping periods. This is useful for subscription models and applications where several people need access to the same asset.

The extension does not establish fractional or shared ERC-721 ownership. The NFT retains a single owner while additional accounts receive usage rights recognized by the application.

Separating ownership from usage allows NFT-based applications to support nonexclusive access and time-limited subscriptions without transferring ownership of the token.

Motivation

Some NFTs represent intellectual property (IP) assets. The owner of such an asset may want to allow other parties to use it without transferring ownership.

A subscription model can serve this purpose by assigning access rights to multiple users. Each subscription may have its own expiration date.

ERC-4907 provides related functionality through a time-limited user role. However, its standard interface identifies a single user at a time, making it better suited to exclusive rental arrangements, such as renting an in-game item.

For ERC-4907, see the following article.

ERC-4907: Understanding time-limited NFT usage roles

Nonexclusive access to shared IP assets requires a different model. ERC-7507 is designed to support multiple simultaneous users, allowing applications to manage independent access periods for the same asset.

The on-chain usage record does not itself establish a legally enforceable intellectual-property license. The applicable license terms and application-level access rules must be defined separately.

Specification

The following Solidity interface is defined in IERC7507.sol.

javascript
interface IERC7507 {

    /// @notice Emitted when the expires of a user for an NFT is changed
    event UpdateUser(uint256 indexed tokenId, address indexed user, uint64 expires);

    /// @notice Get the user expires of an NFT
    /// @param tokenId The NFT to get the user expires for
    /// @param user The user to get the expires for
    /// @return The user expires for this NFT
    function userExpires(uint256 tokenId, address user) external view returns(uint256);

    /// @notice Set the user expires of an NFT
    /// @param tokenId The NFT to set the user expires for
    /// @param user The user to set the expires for
    /// @param expires The user could use the NFT before expires in UNIX timestamp
    function setUser(uint256 tokenId, address user, uint64 expires) external;

}

The interface provides an expiration query, a method for setting individual user expiration timestamps, and an event recording changes.

Rationale

ERC-7507 complements ERC-4907 by extending the usage-role concept to multiple users. Its function and parameter names are intended to remain consistent with the earlier standard where practical.

For ERC-4907, see the following article.

ERC-4907: Understanding time-limited NFT usage roles

The interface deliberately does not include a usersOf(uint256 tokenId) enumeration function.

Enumerating all users may be useful for certain applications, but it is unnecessary for others, such as open subscription systems that only need to check a particular account's access.

The standard leaves user enumeration to individual implementations rather than requiring every compatible contract to maintain an enumerable collection of users.

Backward compatibility

The proposal adds a separate interface and does not replace existing ERC-721 ownership or transfer functionality.

Tests

The original article provides the following Hardhat test suite.

javascript
import { loadFixture } from "@nomicfoundation/hardhat-toolbox/network-helpers";
import { expect } from "chai";
import { ethers } from "hardhat";

const NAME = "NAME";
const SYMBOL = "SYMBOL";
const TOKEN_ID = 1234;
const EXPIRATION = 2000000000;
const YEAR = 31536000;

describe("ERC7507", function () {

  async function deployContractFixture() {
    const [deployer, owner, user1, user2] = await ethers.getSigners();

    const contract = await ethers.deployContract("ERC7507", [NAME, SYMBOL], deployer);
    await contract.mint(owner, TOKEN_ID);

    return { contract, owner, user1, user2 };
  }

  describe("Functions", function () {
    it("Should not set user if not owner or approved", async function () {
      const { contract, user1 } = await loadFixture(deployContractFixture);

      await expect(contract.setUser(TOKEN_ID, user1, EXPIRATION))
        .to.be.revertedWith("ERC7507: caller is not owner or approved");
    });

    it("Should return zero expiration for nonexistent user", async function () {
      const { contract, user1 } = await loadFixture(deployContractFixture);

      expect(await contract.userExpires(TOKEN_ID, user1)).to.equal(0);
    });

    it("Should set users and then update", async function () {
      const { contract, owner, user1, user2 } = await loadFixture(deployContractFixture);

      await contract.connect(owner).setUser(TOKEN_ID, user1, EXPIRATION);
      await contract.connect(owner).setUser(TOKEN_ID, user2, EXPIRATION);

      expect(await contract.userExpires(TOKEN_ID, user1)).to.equal(EXPIRATION);
      expect(await contract.userExpires(TOKEN_ID, user2)).to.equal(EXPIRATION);

      await contract.connect(owner).setUser(TOKEN_ID, user1, EXPIRATION + YEAR);
      await contract.connect(owner).setUser(TOKEN_ID, user2, 0);

      expect(await contract.userExpires(TOKEN_ID, user1)).to.equal(EXPIRATION + YEAR);
      expect(await contract.userExpires(TOKEN_ID, user2)).to.equal(0);
    });
  });

  describe("Events", function () {
    it("Should emit event when set user", async function () {
      const { contract, owner, user1 } = await loadFixture(deployContractFixture);

      await expect(contract.connect(owner).setUser(TOKEN_ID, user1, EXPIRATION))
        .to.emit(contract, "UpdateUser").withArgs(TOKEN_ID, user1.address, EXPIRATION);
    });
  });

});

The tests cover unauthorized attempts to set users, default expiration values, independent expiration updates for multiple users, revocation by setting expiration to zero, and emission of the UpdateUser event.

Reference implementation

javascript
// SPDX-License-Identifier: CC0-1.0

pragma solidity ^0.8.0;

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

import "./IERC7507.sol";

contract ERC7507 is ERC721, IERC7507 {

    mapping(uint256 => mapping(address => uint64)) private _expires;

    constructor(
        string memory name, string memory symbol
    ) ERC721(name, symbol) {}

    function supportsInterface(
        bytes4 interfaceId
    ) public view virtual override returns (bool) {
        return interfaceId == type(IERC7507).interfaceId || super.supportsInterface(interfaceId);
    }

    function userExpires(
        uint256 tokenId, address user
    ) public view virtual override returns(uint256) {
        require(_exists(tokenId), "ERC7507: query for nonexistent token");
        return _expires[tokenId][user];
    }

    function setUser(
        uint256 tokenId, address user, uint64 expires
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC7507: caller is not owner or approved");
        _expires[tokenId][user] = expires;
        emit UpdateUser(tokenId, user, expires);
    }

}

_expires

javascript
mapping(uint256 => mapping(address => uint64)) private _expires;

Overview

Stores individual user expiration timestamps for each token.

Details

The outer mapping uses the token ID as its key. The inner mapping uses a user address as its key and stores a uint64 expiration timestamp.

This structure allows an application to query access information for a particular token and user independently of other users.

Mapping components

  • uint256 tokenId
    • The token identifier.
  • address userAddress
    • The user's Ethereum address.
  • uint64 expirationTime
    • The expiration time expressed as a Unix timestamp.

supportsInterface

javascript
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
    return interfaceId == type(IERC7507).interfaceId || super.supportsInterface(interfaceId);
}

Overview

Implements ERC-165 interface detection, including support for the IERC7507 interface.

Details

The function checks whether the supplied interface ID matches IERC7507. If it does not, the inherited supportsInterface implementation is consulted.

This allows other contracts and applications to discover supported interfaces.

Parameter

  • interfaceId
    • The interface identifier being checked.

Return value

  • bool
    • True if the interface is supported; otherwise false.

userExpires

javascript
function userExpires(uint256 tokenId, address user) public view virtual override returns(uint256) {
    require(_exists(tokenId), "ERC7507: query for nonexistent token");
    return _expires[tokenId][user];
}

Overview

Retrieves the stored expiration timestamp for a specific token and user.

Details

The reference implementation first verifies that the token exists and reverts otherwise. It then returns the stored expiration value.

The timestamp does not necessarily indicate that access is currently valid. Applications must compare it with the relevant current time. An unset mapping entry returns zero.

Parameters

  • tokenId
    • The token whose user expiration is requested.
  • user
    • The user's Ethereum address.

Return value

  • uint256
    • The stored expiration timestamp in seconds.

setUser

javascript
function setUser(uint256 tokenId, address user, uint64 expires) public virtual override {
    require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC7507: caller is not owner or approved");
    _expires[tokenId][user] = expires;
    emit UpdateUser(tokenId, user, expires);
}

Overview

Sets the expiration timestamp associated with a particular token and user.

Details

The reference implementation checks that the caller owns the NFT or is authorized through the inherited ERC-721 approval mechanism.

It then updates the corresponding mapping entry and emits UpdateUser to record the change.

Parameters

  • tokenId
    • The token whose usage record is being updated.
  • user
    • The address receiving or losing usage rights.
  • expires
    • The expiration time as a Unix timestamp.

Return value

The function does not return a value.


Security considerations

The original proposal discussion identifies no additional specific security consideration. However, applications still need to define their access-control and token-lifecycle policies.

In the reference implementation, usage records are not explicitly cleared when ownership changes or when a token is burned. Applications must determine whether existing subscriptions should survive transfers and whether stale records could become relevant if a token ID is reused.

An application must also enforce expiration when granting access. Merely storing a timestamp does not prevent an expired user from accessing an external service.

The code and tests above are reproduced from the original article. They have not been independently compiled, executed, or audited. The test fixture assumes a mint function that is not included in the displayed reference contract, and the internal ERC-721 helpers depend on the OpenZeppelin version used.

Citation

Ming Jiang (@minkyn), Zheng Han (@hanbsd), Fan Yang (@fayang), "ERC-7507: Multi-User NFT Extension [DRAFT]," Ethereum Improvement Proposals, no. 7507, August 2023. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7507.

Conclusion

ERC-7507 extends ERC-721 with individually managed, expiring usage rights for multiple users, making it suitable for subscription-based and nonexclusive NFT access models.

Questions are welcome via Twitter @cardene777.

Other publications:

https://chaldene.net/