Rentable NFTs (ERC-4907) : Part I

Sidarth S
Coinmonks
6 min readJul 5, 2022

--

The much needed standard in the Universe of Gamified NFTs.

Photo by Robert Linder on Unsplash

In the existing world of NFTs, We can sense a sudden rise in the amount of digital asset collections being pumped into the market. Surely, NFTs have gone well beyond just being profile pictures (PFP).

With the supply of NFT collections being high, users now purge a strong need of some utility backing the assets. Thankfully, The concept of Play2Earn (P2E) and Gaming Metaverse NFTs have emerged to be the straight forward and yet simple solution, to back these assets with utilities.

With the increased popularity of the game, buying the game based NFT assets, might be really costlier and less accessible to mainstream users. Although there are NFT rental platforms available, existing solutions in the market still lacks robustness in security and demands high cost of development and integration.

What is NFT Rental

NFT Rentals works the same way, how any other rentals work in the real world. Suppose you want to have a luxury car, temporarily for somedays. Instead of buying a new car, the best cost efficient way is to rent the car for the required number of days and return back to the owner without fail, once your period is complete. Similarly, the idea is to rent a NFT temporarily for some days and return back to the rightful owner once your renting period is complete.

Also from a NFT owner perspective, Suppose if I own a NFT, instead of simply holding it for a long time, the NFT can be lended and be used as a source of earning passive income from the NFT. Virtual land can be “rented” and “used” to build scenes, and NFTs representing game assets can be “rented” to be “used” in-game.

Traditional NFT Rental Sytems

As there is no setup standards for NFT Renting, One of the most followed approach in the traditional setup of NFT rentals is with the use of a guaranteed temporary ownership change. The Owner transfers the ownership to the user, who want to rent the NFT, with some collateral/guarantee that the rented user will give back ownership of the NFT after the renting period is completed. One of the most common implementation of this traditional approach involves Escrow Ownership.

When you rent out the NFT, the original owner has no control over the rented NFT, and is completely based on the trust of the rented user / escrow owner.
and Yeah, that sounds very Risky.

“ Ever wondered what does the huge number in the Opensea Token ID actually mean !! “
Check out : Opensea TokenId: Explained

Need of Role in NFT

The “owner” of a NFT and “user” using the NFT may not always be the same. There may be an “owner” of the NFT who rents it out to another “user”, storing these data on-chain makes renting more powerful and secure. The role specifies the borderline between the user and owner, making it easy to manage permissions and perform actions accordingly.
Example : while “owner” is free to transfer NFTs, the “user” of the NFT should not be allowed to transfer, limiting him only to use the rented NFT.

The Dual-Role NFT Rental Standard

ERC - 4907

Photo by Vincent van Zalinge on Unsplash

The continuous demand for utility NFTs, makes Dual-Role Standards one of the best model to implement Rentable NFTs. The simple implementation and given the security provided, it is one of the go to mechanism, as far as NFT Renting is considered.

ERC-4907, adds a user role in addition to the owner role in ERC-721 and adds the data expires that would end user rights to facilitate renting.

In traditional renting platforms, the owner must manually reclaim their user rights, once the rental term period is over. Doing so is quite a tedious process, especially if rented multiple assets simultaneously. Apart from the inconvenience, this also proves to be expensive in gas.
Inclusion of expires is a crucial step, as it eliminates these problems of owners inconvenience and proves gas effective.

In contrast to the traditional renting systems, although NFT is rented out, you still are the owner of the NFT and have full control over it.

IERC4907

IERC4907.sol ( source code )
  • UpdateUser(...) :
    The event UpdateUser(...)is emitted, whenever a new user is assigned to a tokenId (or) when user of a tokenId has been updated.
  • setUser( tokenId, user, expires) :
    In The function setUser(...) , the given user address is set as the user for the passed tokenId. expires is the UNIX timestamp, after which the user rights for this tokenId will be revoked (i.e) the user can use this NFT tokenId only before the expires.
  • userOf( tokenId ) -> returns address :
    This viewfunction, returns the current user of the given tokenId.
    The function returns Zero address, if the token curently has no user (or) the user rights assigned to this tokenId has expired.
  • userExpires( tokenId ) -> returns uint256:
    This viewfunction, returns the UNIX timestamp at which user rights of the given tokenId will be revoked. The user assigned to this tokenId can use this NFT only uptil the returned timestramp. The function returns zero , if the tokenId curently has no user.

Note :

  • The userOf(uint256 tokenId) function MAY be implemented as pure or view.
  • The userExpires(uint256 tokenId) function MAY be implemented as pure or view.
  • The setUser(uint256 tokenId, address user, uint64 expires) function MAY be implemented as public or external.
  • The UpdateUser event MUST be emitted when a user address is changed or the user expires is changed.
  • The supportsInterface method MUST return true when called with 0xad092b5c.

“ Basic walkthrough on IPO / ICO using Dutch Auction mechanism and on why its been adopted widely in the blockchain space.!! “
Check out : Dutch Auction — IPO/ICO

Conclusion

Renting non-fungible tokens provides a whole new dimension of opportunity in the scope of NFTs. The Dual-Role mechanism in ERC 4907, allows the protocol to extract user rights from ownership, which is vital for NFT rentals.

The protocol provides :

  • Simple implementation :
    Easy to implement and provides Backwards Compatibility
  • Roles to NFT :
    With Dual “owner” and “user” roles, it becomes significantly easier to manage what lenders and borrowers can and cannot do with the NFT.
  • On-chain time management (expires) :
    The “user” of NFT is revoked automatically after the renting duration is over.
  • Easy Third-Party Integration :
    The owner of NFT now can rent the NFT to some user and at the same time use the NFT in a mortgage platform. Renting uses the “user” role, while mortgage uses “owner” role of the NFT.

Creators Note

Thank you so much for reading. If any queries, feel free to reach out.
The post has already been too long,
Lets look on implementing the same in solidity contract, along with Brownie test cases in the Part II of this series.

Check out : Part II : Rentable NFTs ( ERC-4907)
Solidity
Smart Contract Implementation and testing using Brownie

Follow for more contents on Blockchain, NFTs, Defi, Smart Contracts, etc
connect with me on twitter, LinkedIn , Email.

--

--

Sidarth S
Coinmonks

Blockchain Developer | NFTs | Smart Contract | Data Scientist | Artificial Intelligence | Deep Learning