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.
This article examines ERC-5334, which enables applications to associate an NFT with a user address, expiration time, and permission level.
This explanation translates, summarizes, and expands on the following specification.
For more EIPs, see https://cardene.dev/proposals.
Overview
ERC-5334 proposes adding a user role to ERC-721. The user may be an address distinct from the owner and may use the NFT, but the role itself does not authorize transferring the NFT or assigning another user.
The role has an expiration (expires) and level (level). The authorization becomes invalid upon expiration, facilitating temporary NFT rentals.
Motivation
NFTs Are Used, Not Just Owned
NFTs increasingly have practical uses, such as game items and metaverse land. Owners may want to let someone else use an NFT without transferring ownership.
For example, a land NFT owner might lend land to someone to construct a building while retaining ownership. Separate owner and user roles make this possible.
Reducing Unnecessary Transactions
Temporary access traditionally requires two transactions:
- Register the user when access begins.
- Remove the user when access ends.
This creates additional work and gas costs. ERC-5334 lets an expiration be set in advance, so access becomes invalid at the end of the period without another revocation transaction.
Interoperability with Other Projects
Standardizing the user role, expiration, and level provides a common interface across projects. Rental platforms and installment purchase services can handle NFTs without requiring custom integration from issuers.
For example, a profile picture NFT might support both a 30-day rental service and a mortgage-like service allowing installment payments while using the NFT.
Specification
ERC-5334 defines an interface for managing three values associated with an NFT: user, expires, and level.
Interface
interface IERC5334 {
// Logged when the user of a NFT, expires, or level is changed
/// @notice Emitted when the `user` of an NFT or the `expires` of the `user` is changed or the user `level` is changed
/// The zero address for user indicates that there is no user address
event UpdateUser(uint256 indexed tokenId, address indexed user, uint64 expires, uint8 level);
/// @notice set the user and expires and level of a NFT
/// @dev The zero address indicates there is no user
/// Throws if `tokenId` is not valid NFT
/// @param user The new user of the NFT
/// @param expires UNIX timestamp, The new user could use the NFT before expires
/// @param level user level
function setUser(uint256 tokenId, address user, uint64 expires, uint8 level) external;
/// @notice Get the user address of an NFT
/// @dev The zero address indicates that there is no user or the user is expired
/// @param tokenId The NFT to get the user address for
/// @return The user address for this NFT
function userOf(uint256 tokenId) external view returns(address);
/// @notice Get the user expires of an NFT
/// @dev The zero value indicates that there is no user
/// @param tokenId The NFT to get the user expires for
/// @return The user expires for this NFT
function userExpires(uint256 tokenId) external view returns(uint256);
/// @notice Get the user level of an NFT
/// @dev The zero value indicates that there is no user
/// @param tokenId The NFT to get the user level for
/// @return The user level for this NFT
function userLevel(uint256 tokenId) external view returns(uint256);
}Events
UpdateUser
event UpdateUser(uint256 indexed tokenId, address indexed user, uint64 expires, uint8 level);Emitted when the user, expiration, or level changes. The zero address indicates no assigned user.
The event must be emitted when setUser changes user information.
Functions
setUser
function setUser(uint256 tokenId, address user, uint64 expires, uint8 level) external;Assigns a new user to an NFT.
- user: the NFT user's address. Passing address(0) removes the assigned user.
- expires: a UNIX timestamp defining the time until which access is available.
- level: a user level whose meaning may differ among applications.
userOf
function userOf(uint256 tokenId) external view returns(address);Returns the currently assigned user. If no user is assigned or the authorization has expired, it returns address(0).
userExpires
function userExpires(uint256 tokenId) external view returns(uint256);Returns the user's expiration as a UNIX timestamp. Zero means no user is assigned.
userLevel
function userLevel(uint256 tokenId) external view returns(uint256);Returns the assigned user level. Applications define its meaning, which may be used for functionality restrictions or rarity-related features.
Compliance Requirements
When setUser changes the user information, emit the UpdateUser event.
Backward Compatibility
ERC-5334 extends ERC-721 functionality and is compatible with ERC-721.
Security
The proposal preserves NFT owner rights by allowing owners to change the assigned user, expiration, and level at any time. Applications should take that mutability into account when designing rental arrangements.
Citation
Yan (@yan253319066), "ERC-5334: EIP-721 User And Expires And Level Extension [DRAFT]," Ethereum Improvement Proposals, no. 5334, July 2022. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-5334.
Conclusion
ERC-5334 enables NFT usage arrangements based on a user address, expiration time, and application-defined level.
Further reading and author links:




