What is ERC-4907? The rental NFT standard
ERC-4907 adds a time-limited user role to ERC-721 NFTs. The interface, how expiry and transfers work, an OpenZeppelin 5 implementation, and reading rentals.
On this page
ERC-4907 is the Ethereum standard for rentable NFTs. It extends ERC-721 with a second role, the user, and an expiry time. The owner keeps ownership; the user gets the right to use the NFT until the expiry passes, at which point the right lapses on its own, with no second transaction. Apps that support the standard check who the current user is and grant access to them. It is EIP-4907, status Final.
This guide covers what the standard adds to ERC-721, the exact interface, how expiry and transfers behave, a minimal implementation with OpenZeppelin 5, what it is used for and what it leaves out, and how to read a collection's rental history from its UpdateUser events.
What ERC-4907 adds to ERC-721
An ERC-721 token has one role that matters: the owner, who can use it, sell it and approve others to move it. Plenty of NFTs have a use that someone else could take over for a while: a game character, a plot of virtual land, a membership pass. Before ERC-4907, lending one meant either transferring it (and trusting the borrower to send it back) or each project inventing its own "operator" or "controller" field.
ERC-4907 standardises that second role:
- Owner: unchanged from ERC-721. Can transfer the token, approve operators, and set or change the user.
- User: an address allowed to use the NFT. A user cannot transfer it, approve anyone, or set the next user.
- Expires: a UNIX timestamp. After it passes,
userOfreturns the zero address, so the user loses access without anyone sending a transaction.
The EIP's motivation is that last point. Without an expiry, ending a rental takes a second transaction to reclaim the role, which costs gas and happens late.
The IERC4907 interface
The whole standard is one event and three functions on top of ERC-721:
// SPDX-License-Identifier: MITpragma solidity ^0.8.20; interface IERC4907 { /// Emitted when the user of an NFT or the user's expiry changes. user == address(0) means no user. event UpdateUser(uint256 indexed tokenId, address indexed user, uint64 expires); /// Set the user and expiry of an NFT. Throws if tokenId is not a valid NFT. function setUser(uint256 tokenId, address user, uint64 expires) external; /// The current user, or address(0) if there is none or the rental has expired. function userOf(uint256 tokenId) external view returns (address); /// The user's expiry as a UNIX timestamp, or 0 if there is no user. function userExpires(uint256 tokenId) external view returns (uint256);}| Member | What it does |
|---|---|
setUser(tokenId, user, expires) |
Grants user the use of the token until expires. Passing the zero address removes the user. |
userOf(tokenId) |
The current user, or the zero address if there is none or the expiry has passed. |
userExpires(tokenId) |
The stored expiry timestamp. Note it returns uint256, while setUser and the event use uint64. |
UpdateUser(tokenId, user, expires) |
Must be emitted whenever the user or the expiry changes. tokenId and user are indexed. |
supportsInterface(0xad092b5c) |
Must return true. 0xad092b5c is the ERC-165 interface ID of IERC4907. |
Two identifiers are worth keeping to hand:
- Interface ID
0xad092b5c: the XOR of the three function selectors (setUser0xe030565e,userOf0xc2f1f14a,userExpires0x8fc88c48). CallsupportsInterface(0xad092b5c)to check whether a contract claims to be ERC-4907. - Event topic
0x4e06b4e7000e659094299b3533b47b6aa8ad048e95e872d23d1f4ee55af89cfe:keccak256("UpdateUser(uint256,address,uint64)"), the first topic of everyUpdateUserlog. It is how you find rentals in event logs.
The standard leaves who may call setUser to the implementation. The EIP's reference implementation allows the owner or an approved operator, which is what marketplaces rely on: the owner approves a rental contract, and the rental contract sets the user.
How expiry works
Expiry is lazy. Nothing happens on-chain when the timestamp passes; userOf compares the stored expiry with the current block's timestamp and returns the zero address once it is in the past. The reference implementation treats the user as valid while expires >= block.timestamp.
Two consequences trip people up:
userExpireskeeps the old value. After a rental ends,userOfreturns the zero address butuserExpiresstill returns the old timestamp until someone callssetUseragain or the token is transferred. To ask "who may use this token now?", calluserOf, notuserExpires.- The owner can end a rental early. The owner (or an approved operator) can call
setUserat any time with a new user or an earlier expiry. The EIP's security considerations state this as a feature: the standard protects the owner's rights. Nothing in the standard protects the renter's.
What happens to the user on transfer
When the token is transferred, the reference implementation deletes the user record and emits UpdateUser(tokenId, address(0), 0). A new owner therefore receives the NFT with no renter attached. This lives in the EIP's reference implementation rather than in a MUST of the specification, so check any contract you integrate with.
In a live collection's event log this shows up as two logs in the same transaction: the ERC-721 Transfer, then an UpdateUser whose user and expiry are zero. If you rebuild rental state from events, treat that second log as the end of the rental, as the script below does.
Implement ERC-4907 with OpenZeppelin 5
OpenZeppelin Contracts has no ERC-4907 extension, and the EIP's reference implementation targets OpenZeppelin 4. Two things changed in OpenZeppelin 5: the _beforeTokenTransfer hook is gone (every mint, transfer and burn now goes through _update), and _isApprovedOrOwner became _checkAuthorized. A minimal rentable NFT on 5.x, using the interface above saved as IERC4907.sol beside it. It was compiled with Solidity 0.8.28 against OpenZeppelin Contracts 5.6.1; in Foundry or Hardhat, install that version:
npm install @openzeppelin/contracts@5.6.1// SPDX-License-Identifier: MITpragma solidity ^0.8.24; import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";import {IERC4907} from "./IERC4907.sol"; contract RentableNFT is ERC721, IERC4907 { struct UserInfo { address user; // who may use the token uint64 expires; // UNIX timestamp when that right ends } mapping(uint256 tokenId => UserInfo) private _users; constructor() ERC721("Rentable NFT", "RENT") {} function mint(address to, uint256 tokenId) external { _mint(to, tokenId); // open mint for the example only: gate this in a real contract } function setUser(uint256 tokenId, address user, uint64 expires) public virtual { // Reverts if the token doesn't exist or msg.sender is not the owner or an approved operator. _checkAuthorized(_ownerOf(tokenId), msg.sender, tokenId); _users[tokenId] = UserInfo(user, expires); emit UpdateUser(tokenId, user, expires); } function userOf(uint256 tokenId) public view virtual returns (address) { UserInfo memory info = _users[tokenId]; return uint256(info.expires) >= block.timestamp ? info.user : 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); } // OpenZeppelin 5 routes every mint, transfer and burn through _update. // Clear the user when the token changes hands, as the EIP's reference implementation does. function _update(address to, uint256 tokenId, address auth) internal virtual override returns (address from) { from = super._update(to, tokenId, auth); if (from != to && _users[tokenId].user != address(0)) { delete _users[tokenId]; emit UpdateUser(tokenId, address(0), 0); } }}What the contract does, in the order a rental happens:
- The owner mints or holds token
1and callssetUser(1, renter, expiry). Anyone else's call reverts in_checkAuthorized, as does a call for a token that doesn't exist. userOf(1)returns the renter untilexpiry, then the zero address. The renter can't transfer the token:transferFromchecks ownership and approvals, and the user role grants neither.- If the owner sells or transfers the token,
_updateclears the user and emitsUpdateUser(1, address(0), 0).
type(IERC4907).interfaceId evaluates to 0xad092b5c, so supportsInterface reports the standard alongside ERC-721's own interfaces. Before you ship, gate mint, and decide whether approved operators should be able to set users (they can here, as in the reference implementation).
What ERC-4907 is used for
The standard fits any NFT whose value is in using it rather than holding it:
- Game items and characters. A player rents a rare item for a season; the game checks
userOfand lets the renter play with it while the owner keeps it. - Virtual land. The EIP's own motivating example: land "used" to build scenes. An owner can let someone build on or host events on a plot for a fixed period.
- Memberships and passes. An access pass can be lent for a week. The service that honours the pass checks
userOfinstead of, or as well as,ownerOf. - Use while paying off. The EIP describes a mortgage platform where a buyer uses an NFT while paying for it in installments, built on the same user role a rental platform uses.
In every case the app that grants access must check the user role. ERC-4907 records who the user is; it doesn't make any app respect it.
Limits of ERC-4907
What the standard does not do matters as much as what it does:
- No payments, pricing or escrow. There is no rent, deposit or fee logic in ERC-4907. A rental marketplace has to collect payment and call
setUserin its own contract. - No protection for the renter. The owner can replace the user or shorten the expiry at any time, so a renter who has paid relies on the marketplace contract (or trust), not on the standard.
- Enforcement is off-chain. The user role only means something if the game, metaverse or service checks
userOf. A contract or app that only readsownerOfignores rentals. - One user per token. There is a single user slot with a single expiry, so a token can't have overlapping rentals or several users at once.
- ERC-721 only. For ERC-1155 tokens, ERC-5006 (Final) defines a separate user extension.
- Behaviour varies by contract. Clearing the user on transfer, and who may call
setUser, come from the reference implementation rather than the specification's requirements. Read the contract before you rely on either.
Read rental history with GoldRush
Every rental leaves an UpdateUser log, so a collection's rental history is its event log filtered to that topic. GoldRush's log events by contract address endpoint, part of the GoldRush Foundational API alongside its NFT API, returns every log a contract emitted in a block range, with block_signed_at, tx_hash, raw_log_topics and raw_log_data per log, and a decoded form when the event's ABI is known. It is billed in credits at 0.01 per item returned.
This script pages through a contract's logs, keeps the UpdateUser ones and decodes them from the raw topics, so it works whether or not the API decoded the event. It needs Node.js 18 or later and a GOLDRUSH_API_KEY:
// Usage: GOLDRUSH_API_KEY=... node rental-history.mjs <contract> <starting-block> [ending-block] [chain]const [contract, startingBlock, endingBlock = "latest", chain = "eth-mainnet"] = process.argv.slice(2); // keccak256("UpdateUser(uint256,address,uint64)")const UPDATE_USER = "0x4e06b4e7000e659094299b3533b47b6aa8ad048e95e872d23d1f4ee55af89cfe"; async function* logEvents() { for (let page = 0; ; page++) { const url = new URL(`https://api.covalenthq.com/v1/${chain}/events/address/${contract}/`); url.searchParams.set("starting-block", startingBlock); url.searchParams.set("ending-block", endingBlock); url.searchParams.set("page-number", String(page)); const res = await fetch(url, { headers: { Authorization: `Bearer ${process.env.GOLDRUSH_API_KEY}` } }); // Check the status first: a bare 500 has no body, and a missing Authorization header returns HTML. if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`); const body = await res.json(); if (body.error) throw new Error(`${body.error_code}: ${body.error_message}`); yield* body.data.items; if (!body.data.pagination?.has_more) return; }} // Decode from the raw topics, so it works whether or not the API decoded the event:// topic 1 is tokenId, topic 2 is user (both indexed); the data word is expires.const rentals = [];for await (const log of logEvents()) { if (log.raw_log_topics[0] !== UPDATE_USER) continue; rentals.push({ block: log.block_height, time: log.block_signed_at, tx: log.tx_hash, tokenId: BigInt(log.raw_log_topics[1]).toString(), user: `0x${log.raw_log_topics[2].slice(26)}`, expires: Number(BigInt(log.raw_log_data)), });} const ZERO = `0x${"0".repeat(40)}`;for (const r of rentals) { const what = r.user === ZERO ? "user cleared" : `rented to ${r.user} until ${new Date(r.expires * 1000).toISOString()}`; console.log(`${r.time} token ${r.tokenId} ${what} (${r.tx})`);} // The last UpdateUser per token is its current rental, if it hasn't expired.const latest = new Map(rentals.map((r) => [r.tokenId, r]));const now = Date.now() / 1000;const active = [...latest.values()].filter((r) => r.user !== ZERO && r.expires >= now);console.log(`\n${rentals.length} UpdateUser events, ${latest.size} tokens, ${active.length} rented now`);Run against a live ERC-4907 collection on Ethereum, the output is one line per rental or reset (<time> token <id> rented to <user> until <expiry> (<tx>), or user cleared after a transfer), in block order, then a summary. Logs of other events from the same contract (Transfer, ApprovalForAll and so on) are skipped. Set the block range to the period you care about, starting no earlier than the contract's deployment block.
Two variations:
- Find ERC-4907 activity across a whole chain. The log events by topic hash endpoint takes the
UpdateUsertopic and returns matching logs from every contract, withsender_addresstelling you which collection each came from. It is billed the same way, at 0.01 per item returned. - Rentals of one wallet.
useris an indexed topic, so the same topic-hash endpoint takes the wallet address as a secondary topic (secondary-topics) and lists everyUpdateUserthat named it.
Handle errors from the GoldRush API
A failed call returns the same envelope as a successful one, with data set to null, error set to true and the reason in error_message; error_code is a JSON number equal to the HTTP status. The docs show this body for a chain name the API doesn't recognize, which is what a typo in the script's [chain] argument gets:
{ "data": null, "error": true, "error_message": "Chain nosuchchain-mainnet not supported.", "error_code": 501 }A 501 means the request was well formed but the chain or endpoint can't serve it, so retrying it unchanged won't help. A 401 means the key is missing or wrong; with no Authorization header at all, the edge proxy returns an HTML 401 page rather than JSON, and a bare 500 has no body, which is why the script checks res.ok before it parses anything. Failed requests cost no credits. Every code is listed in the error handling docs.
Events tell you the history. For the current state of one token, ask the contract.
Check a token's current renter
userOf is the source of truth for "who may use this now", because it applies the expiry at the current block. This viem script checks that a contract reports the ERC-4907 interface, then reads the owner, user and expiry of one token over JSON-RPC (any Ethereum endpoint works; a public one is the default). It needs Node.js 18 or later and viem; save it as check-rental.mjs:
npm install viem@2.58.4// Usage: node check-rental.mjs <contract> <tokenId> [rpc-url]import { createPublicClient, http, parseAbi } from "viem";import { mainnet } from "viem/chains"; const [contract, tokenId, rpc = "https://ethereum-rpc.publicnode.com"] = process.argv.slice(2);const abi = parseAbi([ "function supportsInterface(bytes4) view returns (bool)", "function ownerOf(uint256) view returns (address)", "function userOf(uint256) view returns (address)", "function userExpires(uint256) view returns (uint256)",]);const client = createPublicClient({ chain: mainnet, transport: http(rpc) });const read = (functionName, args) => client.readContract({ address: contract, abi, functionName, args }); const isErc4907 = await read("supportsInterface", ["0xad092b5c"]).catch(() => false);if (!isErc4907) throw new Error(`${contract} does not report the ERC-4907 interface`); const id = BigInt(tokenId);const [owner, user, expires] = await Promise.all([ read("ownerOf", [id]), read("userOf", [id]), read("userExpires", [id]),]);console.log({ owner, user, expires: expires === 0n ? null : new Date(Number(expires) * 1000).toISOString() });On a token whose rental has ended, this prints the zero address as user and a past date as expires: the "userExpires keeps the old value" case from above. A contract without supportsInterface (no ERC-165) usually reverts on the call, which the script reports as "does not report the ERC-4907 interface".
Frequently asked questions
What is ERC-4907 in simple terms?
ERC-4907 is an extension of the ERC-721 NFT standard that lets an owner rent out an NFT without giving it away. The owner sets a user and an expiry time; the user can use the NFT in apps that support the standard until the expiry passes, and the owner keeps ownership throughout.
What is the difference between the owner and the user in ERC-4907?
The owner holds the token: they can transfer it, approve operators and set the user. The user can only use it, in apps that check userOf. A user cannot transfer the NFT, approve anyone or choose the next user, and their role ends automatically at the expiry time.
What is the ERC-4907 interface ID?
0xad092b5c, the XOR of the selectors of setUser, userOf and userExpires. An ERC-4907 contract must return true from supportsInterface(0xad092b5c).
Does an ERC-4907 rental end automatically?
Yes, for anyone who reads userOf: once the expiry timestamp is in the past, it returns the zero address. No transaction is needed. userExpires still returns the old timestamp until the user is set again or the token is transferred, so check userOf to see whether a rental is active.
What happens to the renter when an ERC-4907 NFT is sold?
In the EIP's reference implementation, and contracts that follow it, a transfer deletes the user and emits UpdateUser with the zero address and an expiry of 0. The buyer receives the NFT with no renter attached. The specification doesn't require this, so check the contract.
Does ERC-4907 handle rental payments?
No. ERC-4907 has no payment, pricing, deposit or escrow logic. A rental marketplace collects payment in its own contract and calls setUser, usually as an approved operator. The standard also lets the owner change or remove the user at any time, so renters rely on that marketplace contract for any guarantee.
Is there a rental standard for ERC-1155 tokens?
Yes. ERC-4907 only extends ERC-721. ERC-5006, also Final, adds a user role to ERC-1155 tokens.
How do I find ERC-4907 rentals on-chain?
Look for UpdateUser logs, whose first topic is 0x4e06b4e7000e659094299b3533b47b6aa8ad048e95e872d23d1f4ee55af89cfe. For one collection, fetch its logs with the GoldRush log events by contract address endpoint and keep that topic; to search a whole chain, use the log events by topic hash endpoint with the same topic.
Next steps
- Read the standard itself: EIP-4907, including its reference implementation.
- Compile
RentableNFT.solwith OpenZeppelin Contracts 5, rent a token to a second account in a local test, and watchuserOfchange when the expiry passes. - Run
rental-history.mjsagainst a collection you care about with the log events by contract address endpoint. - List the NFTs a wallet holds with the NFT balances endpoint, or check ownership in a collection with the NFT ownership endpoint.
- See how other NFT standards extend ERC-721: EIP-2981 royalties and ERC-6551 token-bound accounts.
- Read rentals, ownership and holdings from one key with the GoldRush NFT API.
- Compare NFT data providers in our introduction to NFT APIs.