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-6806, a proposed interface for tracking how long an address has held an ERC-721 NFT.
This article translates, summarizes, and expands on the following specification.
More EIP explainers:
Overview
The proposal extends ERC-721 non-fungible tokens with an interface for tracking and reporting holding time.
For an introduction to ERC-721, see the following article.
What is ERC-721?
ERC-721 is an Ethereum token standard for representing distinct items. It can express ownership of digital assets such as artwork and collectibles. Unlike the fungible ERC-20 standard, each ERC-721 token has its own identifier and can have distinct attributes.
For an introduction to ERC-20, see the following article.
Holding-time tracking extension
The extension tracks which account holds an NFT and for how long. Applications can use this information to reward long-term holders or make aspects of an NFT's ownership history easier to inspect.
Features
- Measuring holding time
- Tracks how long a particular address has held a specific NFT.
- Ordinarily, the timer resets upon transfer, subject to the implementation's rules for exempt addresses.
- Transparency and trust
- On-chain holding-period data makes relevant ownership information more accessible to collectors and investors.
- Programmable benefits
- Developers can define rewards or privileges based on holding time.
- For example, applications could grant special access or bonuses to users who have held an NFT for a specified period.
Use cases
- Artist royalties
- An application could grant artists additional royalties for NFTs held over long periods.
- In-game rewards
- Holding a particular NFT long enough could unlock an ability or item in a game.
- Community rewards
- Communities could invite eligible holders to events or offer limited merchandise.
The extension creates additional ways for applications to recognize and encourage holder behavior. Such mechanisms could also contribute to asset value and community engagement.
Motivation
ERC-6806 extends ERC-721 with holding-period information, allowing applications to determine how long a particular account has held an NFT. This information could be useful in several situations.
Rewards for long-term holders
Applications could offer rewards or incentives to users who hold their NFTs for extended periods. This may encourage longer holding periods and potentially contribute to market stability.
Access to exclusive content
Access to certain content or events can depend on an NFT's holding period. For example, an event or digital resource could be available only to users who have held a specific token for at least a defined duration.
Application-specific business logic
Developers can implement business rules or game mechanics based on holding time, such as changing a user's status or triggering an action once a threshold is reached.
Purpose of the proposal
ERC-721 does not provide a built-in interface for querying holding time directly. The proposed extension addresses that limitation, making it easier to integrate time-based features and reward systems.
Implementation considerations
- Transparency and security
- Tracking and recording holding time should follow the security and transparency principles of the underlying blockchain.
- Smart contract extensions
- Existing ERC-721 implementations need additional logic to track holding time.
- User interface
- Applications offering time-based features should expose this information in a way users can understand.
The proposal broadens possible NFT applications and introduces additional ways to encourage engagement. Long-term holding incentives may also affect asset value and market stability, although these outcomes are not guaranteed.
Specification
Interface
The following interface extends ERC-721.
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0
interface IERC6806 {
function getHoldingInfo(
uint256 tokenId
) external view returns (address holder, uint256 holdingTime);
}The proposed getHoldingInfo function returns two pieces of information about an NFT: its tracked holder and holding duration in seconds.
This provides a consistent way to query holding information and enables applications that depend on ownership duration.
Input
- tokenId
- The unique identifier of the NFT being queried.
- ERC-721 distinguishes individual NFTs by their token IDs.
- The ID selects the NFT whose holding information is requested.
Output
- holder
- The address of the tracked holder.
- In ordinary ownership arrangements, this corresponds to the current holder. Implementations may distinguish the tracked holder from the immediate on-chain owner.
- holdingTime
- The duration in seconds for which the tracked holder has held the NFT.
- Ordinarily calculated from the time the token was transferred to that holder, subject to rules governing holding-time resets.
Benefits
The function exposes holding information in a consistent way. Applications can use it to reward long-term holders, enforce minimum holding periods for access, or implement other time-based business rules and game mechanics.
These features can also support new incentives for community participation.
Additional explanation
Adding getHoldingInfo to ERC-721 enables NFT-based applications requiring holding-time information while retaining the existing ERC-721 interface.
Why the getHoldingInfo function matters
- Direct access to holding information
- The function returns the holder address and holding duration directly.
- Expressing the duration in seconds makes it easier to integrate with other time-based contract logic.
- Handling more complex arrangements
- The function returns both
holderandholdingTime. - An implementation can choose to ignore certain token owners when calculating holding time.
- For example, a lending contract holding an NFT as collateral could be excluded from resets so that the tracked beneficial holder's time continues to accumulate.
- The function returns both
Use cases
- Lending contracts and collateral
- When a user pledges an NFT for a loan, the NFT may temporarily be owned by a lending or collateral contract.
- An application may want the original user's holding period to continue throughout that time.
- The interface can support this arrangement when the implementation explicitly accounts for the lending contract.
- Reward systems
- Developers can reward users according to holding time.
- For example, users holding an NFT for at least a specified duration could receive additional rewards.
These capabilities broaden the uses of ERC-721 NFTs and allow developers to design holding-time-based incentives.
Compatibility
The proposal is backward compatible with ERC-721. The extension adds an interface without changing the core ERC-721 functions.
Implementation
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "./IERC6806.sol";
contract ERC6806 is ERC721, Ownable, IERC6806 {
mapping(uint256 => address) private _holder;
mapping(uint256 => uint256) private _holdStart;
mapping(address => bool) private _holdingTimeWhitelist;
constructor(
string memory name_,
string memory symbol_
) ERC721(name_, symbol_) {}
function _afterTokenTransfer(
address from,
address to,
uint256 firstotTokenId,
uint256
) internal override {
if (_holdingTimeWhitelist[from] || _holdingTimeWhitelist[to]) {
return;
}
if (_holder[firstotTokenId] != to) {
_holder[firstotTokenId] = to;
_holdStart[firstotTokenId] = block.timestamp;
}
}
function getHoldingInfo(
uint256 tokenId
) public view returns (address holder, uint256 holdingTime) {
return (_holder[tokenId], block.timestamp - _holdStart[tokenId]);
}
function setHoldingTimeWhitelistedAddress(
address account,
bool ignoreReset
) public onlyOwner {
_holdingTimeWhitelist[account] = ignoreReset;
emit HoldingTimeWhitelistSet(account, ignoreReset);
}
}_afterTokenTransfer
function _afterTokenTransfer(
address from,
address to,
uint256 firstotTokenId,
uint256
) internal override {
if (_holdingTimeWhitelist[from] || _holdingTimeWhitelist[to]) {
return;
}
if (_holder[firstotTokenId] != to) {
_holder[firstotTokenId] = to;
_holdStart[firstotTokenId] = block.timestamp;
}
}Overview
An internal hook called after a token transfer in the illustrated ERC-721 implementation.
Details
The hook records the recipient and current timestamp to begin tracking the holding period. It skips the update if either the sender or recipient belongs to the configured whitelist of addresses exempt from holding-time resets.
Parameters
from- The sending address.
to- The receiving address.
firstotTokenId- The identifier of the transferred token, using the original example's spelling.
getHoldingInfo
function getHoldingInfo(
uint256 tokenId
) public view returns (address holder, uint256 holdingTime) {
return (_holder[tokenId], block.timestamp - _holdStart[tokenId]);
}Overview
Returns the tracked holder and holding duration for a specified token ID.
Details
The function returns the recorded holder and elapsed time in seconds since the recorded start of the holding period. Exempt transfers may leave the record unchanged.
Parameters
tokenId- The token ID to query.
Returns
holder- The recorded holder address.
holdingTime- The elapsed holding time in seconds.
setHoldingTimeWhitelistedAddress
function setHoldingTimeWhitelistedAddress(
address account,
bool ignoreReset
) public onlyOwner {
_holdingTimeWhitelist[account] = ignoreReset;
emit HoldingTimeWhitelistSet(account, ignoreReset);
}Overview
Adds or removes an address from the holding-time reset whitelist.
Details
The contract owner can configure whether transfers involving a particular address should be excluded from holding-time resets. A lending contract is one potential example.
Parameters
account- The address whose whitelist status is being changed.
ignoreReset- True to ignore holding-time resets involving the address; false otherwise.
Security
Tracking holding time requires additional state management. Implementers should consider how transfers and updates to holding information could affect contract security.
Potential attack vectors and security best practices
Reentrancy attacks
When a contract calls external code, that code may call back into the original contract before the first invocation completes. If holding-time updates are not coordinated with external interactions, inconsistencies in the tracked information could result.
Front-running attacks
Transaction ordering can affect time-sensitive application logic. Developers should evaluate whether competing transactions or changes in transfer ordering could influence eligibility for rewards or other holding-time-dependent operations.
Smart contract security best practices
Design and implementation should follow established contract security practices, including sufficient testing and code review to validate the intended behavior and invariants.
Gas costs and optimization
Maintaining and updating holding-time records incurs gas costs. Developers should consider efficient state updates and avoid storing unnecessary data.
Block timestamp accuracy
Holding-time accuracy depends on the timestamp rules of the underlying blockchain. Timestamps are not a guarantee of exact real-world time; permitted variation depends on the consensus protocol. Applications requiring absolute precision should not rely exclusively on holding-time data.
Implementers should consider security risks, test and review the contract, manage storage and gas costs, and understand the limitations of holding-time information.
Citation
Saitama (@saitama2009), Combo combo@1combo.io, Luigi luigi@1combo.io, "ERC-6806: ERC-721 Holding Time Tracking [DRAFT]," Ethereum Improvement Proposals, no. 6806, March 2023. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-6806.
Conclusion
ERC-6806 proposes an interface for tracking how long an address has held an ERC-721 NFT. It provides a basis for applications that make decisions according to holding duration.
If you have questions, feel free to contact me via Twitter.
I also publish material on the following platforms.


