⚠️ This EIP is not recommended for general use or implementation as it is likely to change.

EIP-5007: TimeNFT, ERC-721 Time Extension Source

Add start time and end time to ERC-721 tokens.

AuthorAnders, Lance, Shrug
Discussions-Tohttps://ethereum-magicians.org/t/eip5007-erc721-time-extension/8924
StatusDraft
TypeStandards Track
CategoryERC
Created2022-04-13
Requires 165, 721

Abstract

This standard is an extension of ERC-721. It proposes some additional functions (startTime, endTime) to help with on-chain time management.

Motivation

Some NFTs have a defined usage period and cannot be used outside of that period. With traditional NFTs that do not include time information, if you want to mark a token as invalid or enable it at a specific time, you need to actively submit a transaction—a process both cumbersome and expensive.

Some existing NFTs contain time functions, but their interfaces are not consistent, so it is difficult to develop third-party platforms for them.

By introducing these functions (startTime, endTime), it is possible to enable and disable NFT automatically on chain.

Specification

The keywords “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.

interface IERC5007 /* is IERC721 */ {
    /// @notice Get the start time of the NFT
    /// @dev Throws if `tokenId` is not valid NFT
    /// @param tokenId  The tokenId of the NFT
    /// @return The start time of the NFT
    function startTime(uint256 tokenId) external view returns (uint64);
    
    /// @notice Get the end time of the NFT
    /// @dev Throws if `tokenId` is not valid NFT
    /// @param tokenId  The tokenId of the NFT
    /// @return The end time of the NFT
    function endTime(uint256 tokenId) external view returns (uint64);

}

The supportsInterface method MUST return true when called with 0x7a0cdf92.

Rationale

Time Data Type

The max value of uint64 is 18446744073709551615, timestamp 18446744073709551615 is about year 584942419325. uint256 is too big for some software such as MySQL, Elastic Search, and uint64 is natively supported on mainstream programming languages.

Backwards Compatibility

As mentioned in the specifications section, this standard can be fully ERC-721 compatible by adding an extension function set.

Test Cases

Test cases are included in test.js.

See README.md for how to run the test cases.

Reference Implementation

See ERC5007.sol.

Security Considerations

No security issues found.

Copyright and related rights waived via CC0.

Citation

Please cite this document as:

Anders, Lance, Shrug, "EIP-5007: TimeNFT, ERC-721 Time Extension [DRAFT]," Ethereum Improvement Proposals, no. 5007, April 2022. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-5007.