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-5753, a proposal for locking NFTs and restricting their transfer operations.
The explanation below translates, summarizes, and expands on the original proposal.
I also cover a range of other EIPs.
Overview
ERC-5753 extends ERC-721 with a locking mechanism for NFTs. A locked NFT cannot ordinarily be sold or transferred, but it remains available for other uses. The NFT owner or an operator can lock a token and designate an address (an EOA or a smart contract) authorized to unlock it. Only that designated address can unlock the token.
Motivation
NFTs allow digital items to be treated as digital assets, with explicit ownership and secure management and trading on a blockchain. The aim is to make NFTs more useful while preserving these properties.
Locking tokens is a common UX pattern in DeFi. For example, when ETH is used as collateral for a loan, it is locked in a contract for the duration of the loan. With NFTs, however, there are reasons to keep the token at the owner's address even while it serves as loan collateral.
NFTs have many uses, including profile picture (PFP) verification on Twitter, authentication through Collab.Land on Discord, and use in play-to-earn (P2E) games. Just as someone can continue living in a house pledged as collateral, an NFT holder should be able to continue using an NFT that is locked as collateral.
Use cases for locking
NFT-backed loans
An NFT can serve as collateral without being deposited into the lender's contract. The NFT is locked at the owner's address, preventing ordinary transfers and sales while leaving other uses unaffected.
Collateral-free NFT rentals
Renting out an NFT no longer requires separate collateral. The borrower can use the NFT but cannot transfer it. A rental arrangement can automatically return the NFT to the lender at the end of the rental period.
NFT minting with a partial upfront payment
When minting an NFT, a buyer can pay only part of the price upfront and pay the remainder later, rather than paying the entire amount immediately.
NFT purchases in installments
Buyers can purchase NFTs in installments. They can use the NFT before all payments are complete but cannot sell it until the full price has been paid. If they fail to complete the payments, the NFT can be returned to the seller.
Security
Valuable NFTs can be held more securely. For example, an NFT can remain in a MetaMask wallet while a cold wallet holds the unlocking authority, making it harder to steal the NFT if the MetaMask wallet is compromised.
Metaverse applications
Locking an NFT used as a metaverse event ticket can prevent its transfer after the holder logs in. This can prevent multiple people from using the same ticket.
Non-custodial staking
Locking can prevent an NFT from being staked in several services simultaneously. An NFT can therefore be staked in only one designated place. Locks can also serve as evidence of long-term holding (HODLing), on which rewards can be based.
Secure and convenient shared ownership and use
Multiple people can share ownership of an NFT while retaining convenient access to it. Instead of requiring multisignature approval for every use, the NFT can be held in one co-owner's wallet and remain freely usable for purposes other than transfers. Requiring the co-owners' approval for a transfer provides more secure management.
Specification
ERC-5753 is an extension that adds locking to NFTs. An ERC-721 contract implementing this specification provides standard methods for locking and unlocking NFTs at their owners' addresses.
pragma solidity >=0.8.0;
/// @dev Interface for the Lockable extension
interface ILockable {
/**
* @dev Emitted when `id` token is locked, and `unlocker` is stated as unlocking wallet.
*/
event Lock (address indexed unlocker, uint256 indexed id);
/**
* @dev Emitted when `id` token is unlocked.
*/
event Unlock (uint256 indexed id);
/**
* @dev Locks the `id` token and gives the `unlocker` address permission to unlock.
*/
function lock(address unlocker, uint256 id) external;
/**
* @dev Unlocks the `id` token.
*/
function unlock(uint256 id) external;
/**
* @dev Returns the wallet, that is stated as unlocking wallet for the `tokenId` token.
* If address(0) returned, that means token is not locked. Any other result means token is locked.
*/
function getLocked(uint256 tokenId) external view returns (address);
}- The
getLockedfunction returns the address authorized to unlock a token if it is locked.- If the token is not locked, it returns
address(0).
- If the token is not locked, it returns
- Calling
lock(address(1), tokenId)can permanently lock a token. - When a token is locked, all ERC-721 transfer functions revert.
- Transfers initiated by the address authorized to unlock the token are an exception.
- Calls to the ERC-721
approvemethod also revert for locked tokens. - The
getApprovedmethod is recommended to return the address authorized to unlock a locked token. - Calling
lockagain on an already locked token is not permitted, even when specifying the same unlocker. - If the unlocker transfers the token, the lock is cleared after the transfer.
Marketplace integration
Marketplaces should call getLocked to determine whether an NFT is locked.
Because a locked NFT cannot ordinarily be sold, marketplaces are advised to hide locked NFT listings.
Orders involving locked NFTs cannot ordinarily be fulfilled, so excluding them from listings is preferable.
Contract interface
The ILockable interface defined by this specification includes the following methods and events.
Events
Lock(address unlocker, uint256 id)
Emitted when an NFT is locked. It records the unlocker's address.
Unlock(uint256 id)
Emitted when an NFT is unlocked.
Functions
lock(address unlocker, uint256 id) external;
Locks the specified NFT (id) and grants the designated address (unlocker) permission to unlock it.
unlock(uint256 id) external;
Unlocks the specified NFT (id).
getLocked(uint256 tokenId) external view returns (address);
Retrieves the lock state of the specified NFT (tokenId).
A return value of address(0) means the token is unlocked; any other address means it is locked.
Interface identification
The implementing contract must provide a supportsInterface method that returns true when called with 0x72b68110.
This identifier indicates that the contract supports ILockable.
Rationale
ERC-5753 aims to keep the design as simple as possible. Its core functionality is limited to locking and unlocking NFTs, with the ability to designate who can unlock a token when it is locked. This provides broad applicability with minimal code.
General-purpose design
ERC-5753 is not tied to a single application. It can accommodate NFT-backed loans, purchases in installments, rentals, and other use cases. The only required operations are locking and unlocking; users and dApps decide how to apply them.
Temporary ownership and compatibility
For use cases that require temporary rights, such as rentals or installment purchases, ERC-5753 uses a design in which the NFT is actually transferred to the temporary owner's wallet. The token itself moves temporarily, rather than merely granting a separate permission.
The reason is compatibility with the existing NFT ecosystem. For example, services such as Collab.Land that use NFT ownership for access control would otherwise have to implement support for a new mechanism. By transferring the NFT itself, the arrangement can work with existing tools without requiring specialized integration.
Familiar design
The functions and storage layout follow the ERC-721 approval workflow. This makes the extension intuitive for NFT developers. Developers already familiar with ERC-721 can readily understand and use the ERC-5753 logic.
Backward compatibility
The proposal is fully compatible with ERC-721.
Reference implementation
// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.8.0;
import '../ILockable.sol';
import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
/// @title Lockable Extension for ERC721
abstract contract ERC721Lockable is ERC721, ILockable {
/*///////////////////////////////////////////////////////////////
LOCKABLE EXTENSION STORAGE
//////////////////////////////////////////////////////////////*/
mapping(uint256 => address) internal unlockers;
/*///////////////////////////////////////////////////////////////
LOCKABLE LOGIC
//////////////////////////////////////////////////////////////*/
/**
* @dev Public function to lock the token. Verifies if the msg.sender is the owner
* or approved party.
*/
function lock(address unlocker, uint256 id) public virtual {
address tokenOwner = ownerOf(id);
require(msg.sender == tokenOwner || isApprovedForAll(tokenOwner, msg.sender)
, "NOT_AUTHORIZED");
require(unlockers[id] == address(0), "ALREADY_LOCKED");
unlockers[id] = unlocker;
_approve(unlocker, id);
}
/**
* @dev Public function to unlock the token. Only the unlocker (stated at the time of locking) can unlock
*/
function unlock(uint256 id) public virtual {
require(msg.sender == unlockers[id], "NOT_UNLOCKER");
unlockers[id] = address(0);
}
/**
* @dev Returns the unlocker for the tokenId
* address(0) means token is not locked
* reverts if token does not exist
*/
function getLocked(uint256 tokenId) public virtual view returns (address) {
require(_exists(tokenId), "Lockable: locking query for nonexistent token");
return unlockers[tokenId];
}
/**
* @dev Locks the token
*/
function _lock(address unlocker, uint256 id) internal virtual {
unlockers[id] = unlocker;
}
/**
* @dev Unlocks the token
*/
function _unlock(uint256 id) internal virtual {
unlockers[id] = address(0);
}
/*///////////////////////////////////////////////////////////////
OVERRIDES
//////////////////////////////////////////////////////////////*/
function approve(address to, uint256 tokenId) public virtual override {
require (getLocked(tokenId) == address(0), "Can not approve locked token");
super.approve(to, tokenId);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
// if it is a Transfer or Burn
if (from != address(0)) {
// token should not be locked or msg.sender should be unlocker to do that
require(getLocked(tokenId) == address(0) || msg.sender == getLocked(tokenId), "LOCKED");
}
}
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
// if it is a Transfer or Burn, we always deal with one token, that is startTokenId
if (from != address(0)) {
// clear locks
delete unlockers[tokenId];
}
}
/**
* @dev Optional override, if to clear approvals while the tken is locked
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
if (getLocked(tokenId) != address(0)) {
return address(0);
}
return super.getApproved(tokenId);
}
/*///////////////////////////////////////////////////////////////
ERC165 LOGIC
//////////////////////////////////////////////////////////////*/
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override
returns (bool)
{
return
interfaceId == type(IERC721Lockable).interfaceId ||
super.supportsInterface(interfaceId);
}
}Security considerations
The proposal identifies no special security risks inherent in an ERC-721 token management contract implementing ERC-5753. However, smart contracts that interact with lockable NFTs should consider several issues.
Managing unlocking authority
A contract responsible for unlocking NFTs must ensure that the token can be unlocked under all relevant circumstances. If an NFT remains locked unintentionally, its owner or other parties may suffer losses or other adverse consequences. Contracts that manage locks should therefore implement appropriate unlocking procedures.
Risks when transferring temporary ownership
In applications such as NFT rentals, an NFT may be transferred temporarily to another wallet and then locked.
The proposal recommends that contracts providing such services use transferFrom for NFT transfers.
The safeTransferFrom method includes a check involving onERC721Received on a receiving contract, which can introduce a risk of reentrancy.
To avoid that callback, rental applications can use transferFrom with appropriate security precautions.
Impact of MEV (maximal extractable value)
The proposal does not identify particular MEV concerns for lockable NFTs. Since locking and unlocking are restricted to authorized addresses, third parties cannot arbitrarily manipulate the lock state of an NFT. The proposal therefore considers the potential MEV impact to be low.
Citation
Filipp Makarov (@filmakarov), "ERC-5753: Lockable Extension for EIP-721 [DRAFT]," Ethereum Improvement Proposals, no. 5753, October 2022. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-5753.
Conclusion
This article covered ERC-5753, which proposes a mechanism for locking NFTs and restricting their transfer operations.
If you have any questions, feel free to reach out via Twitter DM.
I also publish on the following platforms.



