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-7721, which allows ERC-1155 tokens to be locked while remaining in the holder's wallet.
ERC-7721 proposes a way for ERC-1155 holders to specify a token ID and quantity, restrict transfers, and assign unlocking authority to a separate account. For NFT lending and rentals, the mechanism records the locked quantity without moving the tokens to an escrow contract.
ERC-7721 is a draft proposal.
Overview
ERC-7721 extends ERC-1155 with locking and unlocking operations. Locked quantities remain in the holder's ERC-1155 balance but are excluded from the amount available for ordinary transfers.

The original diagrams are retained and contain Japanese labels.
The NFT itself is not deposited into another party's contract. The proposal records the token ID, the holding account, the account authorized to unlock the tokens, and the quantity locked.
ERC-7721 builds on ERC-165 and ERC-1155. Since ERC-1155 supports multiple token IDs and quantities within a single contract, locks are also specified by token ID and quantity.
For an introduction to ERC-1155, see the article below.
[ERC1155] An Introduction to ERC1155
Motivation
When an NFT serves as loan collateral, one approach is to transfer it into escrow within the lending contract. However, if a game or membership system determines eligibility based on the holder's address, transferring the NFT into escrow also prevents its use.
ERC-7721 proposes restricting transfers without changing the holding address. The proposal cites several examples: continuing to use a collateralized NFT in a game, preventing a borrower from transferring a rented NFT while allowing its use, and preventing resale until installment payments are complete.
ERC-7721 does not specify the lock start time, repayment amount, expiration time, or return conditions. Instead, a lending or rental contract checks those conditions and calls the unlocking function when they are satisfied.
Specification
A lock record involves the token ID, holding account, account authorized to unlock, and quantity. The proposal provides one form in which the holder designates an account authorized to unlock, and another in which an account with token-ID-specific approval makes itself the unlocker.

The holder can designate either an EOA or a contract as the unlocker. When an approved account locks tokens using the other form, the caller itself becomes the unlocker.
Locking and unlocking
lock(uint256,address,uint256)
function lock(uint256 tokenId, address account, uint256 amount) external;This three-argument version of lock locks a specified token ID and quantity and records the caller itself as the unlocker.
- Parameters
| Parameter | Description |
|---|---|
tokenId |
ERC-1155 token ID to lock. |
account |
Account holding the tokens to be locked. |
amount |
Quantity to lock. |
-
Execution conditions
- The caller must be the holder or an account with token-ID-specific approval.
- The balance of
tokenIdinaccountmust be at leastamount. - This version of
lockreverts if the conditions are not met.
-
Check authorization and balance
Verify that
accountholdsamountand that the caller is authorized to create the lock. -
Record the caller as the unlocker
Create a lock associated with the specified
tokenId,account, caller, andamount. -
Reduce the quantity available for ordinary transfers
The locked
amountis excluded from the transferable quantity. If a lending contract uses this form, the same contract can callunlockafter repayment.
lock(uint256,address,address,uint256)
function lock(uint256 tokenId, address account, address _locker, uint256 amount) external;This four-argument version of lock allows the holder to designate another account as the unlocker.
- Parameters
| Parameter | Description |
|---|---|
tokenId |
ERC-1155 token ID to lock. |
account |
Account holding the tokens to be locked. |
_locker |
Account authorized to release the lock. |
amount |
Quantity to lock. |
-
Execution conditions
- The caller must be the holder.
- The balance of
tokenIdinaccountmust be at leastamount. - This version of
lockreverts if the conditions are not met.
-
Check the holder and balance
Only the holder can designate another account as the unlocker. An account with token-ID-specific approval cannot use this form to designate someone else.
-
Record the lock with the designated unlocker
Create a lock associated with the specified
tokenId,account,_locker, andamount.
The holder can keep NFTs in an everyday wallet while designating a cold wallet as _locker.
An attacker who gains control of only the everyday wallet cannot transfer the locked quantity.
unlock
function unlock(uint256 tokenId, address account, uint256 amount) external;unlock reduces the locked quantity and increases the quantity available for transfers.
- Parameters
| Parameter | Description |
|---|---|
tokenId |
ERC-1155 token ID to unlock. |
account |
Account holding the locked tokens. |
amount |
Quantity to unlock. |
-
Execution conditions
- The caller must be the account recorded as the unlocker for the lock associated with
tokenIdandaccount. - The specified
amountmust not exceed the quantity locked by that unlocker. unlockreverts if the conditions are not met.
- The caller must be the account recorded as the unlocker for the lock associated with
-
Check the quantity locked by the unlocker
Check the locked quantity associated with
tokenId,account, and the caller. -
Release the specified quantity from the lock
To release only part of the locked quantity, specify the same
tokenIdandaccount. -
Increase the transferable quantity
The quantity locked by the specified unlocker decreases, and the balance available for ordinary transfers increases by the same amount. If a contract that checks repayment or rental expiration is designated as the unlocker, it can call the function only when those conditions are met.
setApprovalForId
function setApprovalForId(
uint256 tokenId,
address operator,
uint256 amount
) external;setApprovalForId sets the quantity that operator is authorized to manage for a given tokenId.
- Parameters
| Parameter | Description |
|---|---|
tokenId |
ERC-1155 token ID for which approval is granted. |
operator |
Account receiving token-ID-specific approval. |
amount |
Quantity approved. |
-
Execution conditions
- The caller must be the token owner.
- The proposal does not enumerate revert conditions specific to this call.
-
Grant approval limited to a token ID and quantity
Unlike ERC-1155's
setApprovalForAll, which covers all of the holder's tokens, this approval is limited to a single token ID and quantity. -
Record the approved quantity
Record the
amountthatoperatoris authorized to manage fortokenId.
When granting a lending contract permission to lock tokens, the holder does not need to grant authority over other token IDs.
Once approved, operator can call the three-argument version of lock to create a lock with itself as the unlocker.
getApprovalForId
getApprovalForId(uint256 tokenId, address account, address operator)getApprovalForId retrieves the quantity that operator is authorized to manage for tokenId held by account.
The published interface excerpt does not contain a complete Solidity signature or return type, so only the call form in the proposal's overview is shown.
- Parameters
| Parameter | Description |
|---|---|
tokenId |
ERC-1155 token ID for which to check the approved quantity. |
account |
Account of the token owner who granted approval. |
operator |
Account whose approved quantity is being checked. |
- Return value
| Return value | Description |
|---|---|
| Approved quantity | Quantity that operator is authorized to manage for tokenId held by account. The published interface does not specify the Solidity return type. |
-
Execution conditions
- The proposal does not restrict who may call this function.
- The proposal does not enumerate revert conditions specific to this read operation.
Applications can check the approved quantity set by the token owner using setApprovalForId.
This value helps determine whether a given operator meets the conditions for calling the three-argument version of lock.
getLocked
function getLocked(
uint256 tokenId,
address account,
address operator
) external view returns (uint256);getLocked is a read-only call that returns the quantity of tokenId held by account that has been locked by the specified operator.
- Parameters
| Parameter | Description |
|---|---|
tokenId |
ERC-1155 token ID to query. |
account |
Account holding the locked tokens. |
operator |
Unlocker whose locked quantity is being queried. |
- Return value
| Return value | Description |
|---|---|
uint256 |
Quantity locked by that unlocker. Returns 0 if there is no lock. |
-
Execution conditions
- The proposal does not restrict who may call this function.
- Returns
0if there is no lock for the specified combination. - The proposal does not enumerate revert conditions specific to this read operation.
Applications provide the desired tokenId, holder, and unlocker to read the quantity locked by that unlocker.
The contract performing a transfer checks the transferable limit against the aggregate locked quantity as defined by the implementation.
ERC-1155's safeTransferFrom must revert when a transfer attempts to move a locked quantity.
The proposal's overview describes the transferable limit as the balance minus the locked quantity.

The diagram shows a single unlocker locking three tokens out of a balance of five. A transfer of two succeeds, while a transfer of three is rejected. The interface excerpt alone does not establish how locks held by multiple unlockers must be aggregated and checked before transfers. Tests should verify the balance checks of the chosen implementation, including batch transfers.
transferAndLock
function transferAndLock(
address from,
address to,
uint256 tokenId,
uint256 amount,
bool setApprove
) external;transferAndLock combines a transfer to the recipient with a lock on the quantity held by that recipient.
- Parameters
| Parameter | Description |
|---|---|
from |
Account sending the tokens. |
to |
Account receiving and holding the tokens after they are locked. |
tokenId |
ERC-1155 token ID to transfer and lock. |
amount |
Quantity to transfer and lock. |
setApprove |
If true, grants token-ID-specific approval to the caller, who becomes the locker. |
-
Execution conditions
- The holder or an approved account can call this function.
- The caller becomes the locker.
- If
setApproveistrue, token-ID-specific approval is also granted to that caller. - The proposal does not enumerate revert conditions specific to this call.
-
Transfer tokens to the recipient and lock them in the recipient's account
This single operation completes both the transfer and the lock on the recipient's balance.
-
Grant approval only when needed
If
setApproveistrue, token-ID-specific approval is also granted to the caller.
The proposal does not prescribe the internal order in which an implementation must perform these operations. For installment purchases that permit repossession upon nonpayment, the conditions for repossession after the transfer belong in a separate contract.

This operation is useful when the recipient should be able to use an NFT but not transfer it again.
The abstract states that previous rights associated with locks and token-ID-specific approvals are cleared when a token is transferred.
transferAndLock combines the transfer, a new lock, and, if needed, a new approval in a single operation.
Events
Lock
event Lock(
uint256 indexed tokenId,
address account,
address _locker,
uint256 amount
);The Lock event is emitted when a token ID and quantity are locked.
- Fields
| Field | Description |
|---|---|
tokenId |
ERC-1155 token ID locked. Recorded as an indexed field. |
account |
Account holding the locked tokens. |
_locker |
Account authorized to unlock the tokens. |
amount |
Quantity locked. |
This event is emitted when lock or transferAndLock creates a lock.
Indexers can use it to track which holder's token ID has been restricted and which account controls the unlocking authority.
However, this event alone does not capture the clearing of lock and approval rights on token transfers.
Unlock
event Unlock(
uint256 indexed tokenId,
address account,
address _locker,
uint256 amount
);The Unlock event is emitted when a locked quantity is released.
- Fields
| Field | Description |
|---|---|
tokenId |
ERC-1155 token ID unlocked. Recorded as an indexed field. |
account |
Account holding the tokens being unlocked. |
_locker |
Unlocker that performed the operation. |
amount |
Quantity unlocked. |
This event is emitted when unlock succeeds.
Lock and Unlock track quantity changes caused by explicit locking and unlocking.
However, while the proposal describes clearing previous lock and approval rights when tokens are transferred, it does not specify that this clearing emits an Unlock event.
An indexer reconstructing the current lock state must also examine ERC-1155 transfer events and the chosen implementation's transfer logic.
Additional details
Time limits are not built into the standard
ERC-7721 does not impose time limits. Rather than fixing conditions such as repayment, expiration, or the end of a rental in the common interface, the proposal leaves unlocking conditions to a separate contract.
When locker is a contract, its code must therefore be examined to determine when it can call unlock.
ERC-7721 alone does not establish the conditions for repayment, expiration, or seizure.
Locking and repossession are separate permissions
A lock restricts ordinary transfers.
The proposal's security considerations state that a caller who is the locker and also holds token-ID-specific approval can transfer locked tokens.
When using transferAndLock with setApprove, the caller may receive authority that can be used for repossession, in addition to locking authority.
Lending and installment-payment interfaces should clearly explain who can move the NFT and under what conditions.
Compatibility
ERC-7721 is proposed as a compatible extension to ERC-1155. Existing upgradeable ERC-1155 contracts can add locking functionality, but they do not meet the proposal's requirements unless their transfer logic reliably excludes locked quantities.
An application cannot assume that locking is enforced by an ERC-1155 contract that does not implement the extension. Check ERC-165 support and the implementation code to verify that the target contract supports the extension.
Reference implementation
The proposal provides an interface and a link to an example implementation. Since the published proposal does not fully define internal storage or batch transfer implementation details, the code and tests of the chosen implementation should be examined.
An implementation should be checked for at least the following properties.
- Aggregation of locked quantities Verify that the transferable quantity is calculated correctly after multiple locks and partial unlocks.
- All transfer paths
Verify that locked quantities cannot be moved through
safeTransferFrom, batch transfers, or transfers by approved operators. - Rights after transfers
Verify the order in which previous lock and approval rights are cleared on transfer and new state is established by
transferAndLock.
Security
Losing access to the unlocker can leave tokens locked
If an EOA designated as the unlocker becomes inaccessible, or a contract without unlocking logic is designated, the locked tokens may remain permanently immovable. If the holder's everyday wallet and the unlocker are separate, establish a recovery mechanism for the loss of the unlocker.
Missing checks on transfer paths
The purpose of a lock is to prevent the locked quantity from being moved through ordinary transfers. Checking only one transfer function leaves the lock vulnerable to bypass if batch transfers or operator-mediated paths remain unrestricted.
Reviewing contracts that enforce conditions
ERC-7721 separates unlocking authority but does not define the conditions for unlocking.
For rentals, lending, and installment purchases, review the deadlines, repayment and repossession conditions, and administrative permissions of the contract acting as locker.
Conclusion
This article examined ERC-7721, which allows ERC-1155 tokens to be locked while remaining in the holder's wallet.
ERC-7721 proposes restricting transfers by token ID and quantity without changing the ERC-1155 holding address.
It separates the roles of holder, approved account, and unlocker, leaving lending and rental conditions to external contracts.
Before adopting the proposal, check how each implementation aggregates locked quantities, enforces locks across all transfer paths, and handles approvals granted through transferAndLock.
I also write articles on other platforms. You can find them below.




