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-4907, which adds a time-limited user role to ERC-721 NFTs.
This article translates, summarizes, and supplements the material linked below, with assistance from ChatGPT as noted in the original article.
Overview
This standard extends EIP-721 by introducing a user role and an expiration time, expires, after which the role ceases to confer usage rights.

The user role represents permission to use an NFT. The role itself does not authorize transferring ownership, assigning a new user, or granting other permissions to another address.

The original illustrations are retained and may contain Japanese labels.
Motivation
Some NFTs provide specific utility. For example, a metaverse application may use NFTs to construct scenes, while a game may use NFTs representing in-game assets.
The owner of an NFT and its actual user need not be the same person. An owner may rent an NFT to another user.
In this situation, separate owner and user roles allow applications to distinguish the permitted actions. A user who can use an NFT should not necessarily have the right to sell its ownership.
Some projects already employ similar designs under names such as operator or controller. A unified standard makes these concepts easier to support across applications.

Applications such as rentals often grant a user temporary access to an NFT.
A conventional approach requires two on-chain transactions: one to assign the user at the beginning of the rental period and another to remove the user when the rental period ends.

This creates additional work and gas costs. The expires value enables the usage period to end automatically for purposes of authorization, without requiring the second transaction.

Specification
Interface
interface IERC4907 {
event UpdateUser(uint256 indexed tokenId, address indexed user, uint64 expires);
function setUser(uint256 tokenId, address user, uint64 expires) external;
function userOf(uint256 tokenId) external view returns(address);
function userExpires(uint256 tokenId) external view returns(uint256);
}UpdateUser
Emitted when the user or expiration time associated with an NFT changes.
Parameters
tokenId- The NFT's token ID.
user- The address authorized to use the NFT.
- The zero address indicates that no user is assigned.
expires- The user's expiration time as a Unix timestamp.
- The user's rights cease to be valid after this time.
setUser
Sets the user and expiration time associated with an NFT.
Arguments
tokenId- The NFT whose user information is updated.
user- The address authorized to use the NFT.
- The zero address indicates that no user is assigned.
expires- The user's expiration time as a Unix timestamp.
- The user's rights cease to be valid after this time.
userOf
Returns the address of the user associated with a particular NFT.
Arguments
tokenId- The NFT whose user information is queried.
Return values
- The NFT's user address.
- The zero address indicates that there is no currently valid user.
userExpires
Returns the expiration time of the user associated with a particular NFT.
tokenId- The token ID whose expiration time is queried.
Return values
- The expiration time as a Unix timestamp.
- A value of 0 indicates that no expiration time has been configured in the usual uninitialized case.
supportsInterface
The ERC-165 interface detection function identifies the supported interfaces.
It must return true for the IERC4907 interface ID, 0xad092b5c, as well as any other supported interface IDs.
Translation note: The Japanese source says it returns true only for the ERC-4907 ID. Other supported interfaces, including ERC-721, must also be reported.
Additional Notes
Role Assignment
Having separate owner and user roles makes it easier to determine what lenders and renters are allowed to do with an NFT.
Owners can control the assigned user, and other projects can associate their own application-specific permissions with either role.
Simple On-Chain Time Management
When a rental ends, the user must lose permission to use the NFT.
Ordinarily, explicitly revoking a role would require a second transaction. This incurs gas costs and additional operational work.
Using an expiration timestamp makes usage rights invalid when the rental period ends, without requiring a second transaction to clear the stored role.
Easy Third-Party Integration
In keeping with permissionless interoperability, the standard makes it easier for third-party protocols to manage NFT usage permissions.
After a project adopts the user role and expiration time, other projects can interact directly with those features and implement their own transaction flows.
For example, a profile-picture (PFP) NFT implementing this standard could be integrated with a platform offering 30-day rentals and with a financing platform that lets a user use the NFT and eventually purchase ownership through installments.
These integrations can be developed without obtaining specific permission from the original PFP project, subject to its contract behavior.
Compatibility
The standard extends EIP-721 through additional functions and is designed to remain compatible with it.
The new functions resemble existing ERC-721 functions, making the extension relatively straightforward to implement.
Code
The contract implementation is available in the following repository.
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "./IERC4907.sol";
contract ERC4907 is ERC721, IERC4907 {
struct UserInfo
{
address user; // address of user role
uint64 expires; // unix timestamp, user expires
}
mapping (uint256 => UserInfo) internal _users;
constructor(string memory name_, string memory symbol_)
ERC721(name_, symbol_)
{
}
function setUser(uint256 tokenId, address user, uint64 expires) public virtual{
require(_isApprovedOrOwner(msg.sender, tokenId), "ERC4907: transfer caller is not owner nor approved");
UserInfo storage info = _users[tokenId];
info.user = user;
info.expires = expires;
emit UpdateUser(tokenId, user, expires);
}
function userOf(uint256 tokenId) public view virtual returns(address){
if( uint256(_users[tokenId].expires) >= block.timestamp){
return _users[tokenId].user;
}
else{
return address(0);
}
}
function userExpires(uint256 tokenId) public view virtual returns(uint256){
return _users[tokenId].expires;
}
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC4907).interfaceId || super.supportsInterface(interfaceId);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override{
super._beforeTokenTransfer(from, to, tokenId);
if (from != to && _users[tokenId].user != address(0)) {
delete _users[tokenId];
emit UpdateUser(tokenId, address(0), 0);
}
}
} Tests
The test code is available below.
Security
The standard preserves the owner's ownership rights. An authorized owner can change the assigned user and extend its expiration time, subject to any additional rules imposed by the implementation or rental agreement.
Applications should not assume that the base interface alone guarantees an irrevocable rental period.
Discussion
I find the ability to configure NFT usage periods particularly interesting. A useful property is that expiration can be enforced without sending another transaction.
NFT rentals are an immediate use case. An address satisfying particular conditions can be assigned the user role and permitted to use an NFT for a specified period.
Another interesting possibility is that multiple DApps can refer to the user role of the same ERC-4907 NFT. For example, two games could recognize the same NFT and allow its assigned user to use it in both.
The standard offers opportunities for creative designs not only in the NFT contract but also in applications integrating it.
Citation
Anders (@0xanders), Lance (@LanceSnow), Shrug shrug@emojidao.org, "ERC-4907: Rental NFT, an Extension of EIP-721," Ethereum Improvement Proposals, no. 4907, March 2022. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-4907.
Conclusion
ERC-4907 extends ERC-721 with a time-limited user role that separates NFT ownership from temporary usage rights.
If you have questions, feel free to contact me on Twitter.

