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.
ERC-7858 proposes a mechanism for assigning expiration periods to NFTs and soulbound tokens (SBTs), using either block height or time.
This article explains the following proposal, with additional context and examples.
My other articles cover EIPs, BIPs, SLIPs, CAIPs, ENSIPs, RFCs, and ACPs.
Overview
ERC-7858 extends ERC-721 tokens and SBTs with the concept of expiration. Applications can determine whether a token has passed its configured validity period.
ERC-721 does not define a standard expiration mechanism. Tokens generally continue to exist until burned, where burning is supported. The extension makes time-limited use cases such as tickets, memberships, contracts, and rental assets easier to represent.
ERC-7858 emphasizes two design goals.
- Preserving existing NFT and SBT behavior. Expiration does not by itself remove an NFT or prevent an otherwise permitted transfer. Existing marketplace and wallet integrations can continue using ordinary ERC-721 operations.
- Flexible expiration units. Expiration can be measured using block height or timestamps, allowing the implementation to choose the unit appropriate for the network and application.
A token's lifetime can therefore be distinguished from the lifetime of the rights represented by that token. Expiration is a condition that applications must check, not an automatic Burn transaction.
Motivation
Developers have traditionally implemented expiration using custom mappings inside NFT or SBT contracts. This creates interoperability problems.
- Inconsistent integration with other contracts. Projects implement expiration differently, making it difficult for external contracts and services to query validity consistently.
- Marketplace compatibility. Custom transfer restrictions or undefined behavior for expired tokens can cause existing applications to fail when interacting with them.
ERC-7858 addresses these issues through a standardized expiration interface.
The proposal supports individual token expiration and epoch-based expiration management.
| Model | Description |
|---|---|
| Per-token expiry | Each token can have its own validity period, for example an event ticket or limited license. |
| Epoch-based expiry | Tokens can be grouped into periods and managed using epoch-based validity rules, for example seasonal access rights. |
Epoch-based management does not necessarily mean every token in the entire collection expires simultaneously.
Potential use cases
| Area | Example |
|---|---|
| Access and authentication | Temporary permissions in identity and access management (IAM) systems. |
| Membership | Expiring membership cards in membership management systems. |
| Tickets and passes | Conference and exhibition tickets, potentially combined with ERC-2135 or ERC-7578. |
| Subscriptions | Time-limited digital platform access and paid subscriptions. |
| Certificates and contracts | Expiring electronic agreements, copyright licenses, and policy documents. |
| Loyalty and coupons | Expiration management for reward programs and discount coupons. |
| Governance | Voting or proposal rights valid for a specified period. |
| Financial instruments | Digital representations of bonds, loans, and options with defined durations. |
| Rentals | Temporary access arrangements for real estate, digital assets, or DePIN resources. |
For background on ERC-2135, see:
ERC-2135: An interface for managing NFT usage
Specification
Interface
// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.8.0 <0.9.0;
/**
* @title ERC-7858: Expirable NFTs and SBTs
* @notice unique/granular expiry
*/
// import "./IERC721.sol";
// The EIP-165 identifier of this interface is `0x3ebdfa31`.
interface IERC7858 /**is IERC721 */ {
enum EXPIRY_TYPE {
BLOCKS_BASED, // block.number
TIME_BASED // block.timestamp
}
event TokenExpiryUpdated(
uint256 indexed tokenId,
uint256 indexed startTime,
uint256 indexed endTime
);
function expiryType() external view returns (EXPIRY_TYPE);
function isTokenExpired(uint256 tokenId) external view returns (bool);
function startTime(uint256 tokenId) external view returns (uint256);
function endTime(uint256 tokenId) external view returns (uint256);
}EXPIRY_TYPE
enum EXPIRY_TYPE {
BLOCKS_BASED,
TIME_BASED
}An enumeration specifying the unit used to measure expiration.
Values
- BLOCKS_BASED: Uses block.number and expresses expiration in block heights.
- TIME_BASED: Uses block.timestamp and expresses expiration in Unix timestamps.
TokenExpiryUpdated
event TokenExpiryUpdated(
uint256 indexed tokenId,
uint256 indexed startTime,
uint256 indexed endTime
);Emitted when a token's expiration information is set or updated, including when applicable during Mint. Wallets and dApps can monitor the event for changes to the token's validity period.
Parameters
- tokenId: Identifier of the ERC-721 token.
- startTime: Start of the validity period, expressed in the configured unit.
- endTime: End of the validity period, expressed in the configured unit.
expiryType
function expiryType() external view returns (EXPIRY_TYPE);Returns the expiration measurement unit used by the contract.
Return value
- EXPIRY_TYPE: Either BLOCKS_BASED or TIME_BASED.
isTokenExpired
function isTokenExpired(uint256 tokenId) external view returns (bool);Determines whether the specified token has expired. It returns true for an expired token and reverts if the token does not exist.
Parameter
- tokenId: Token being checked.
Return value
- bool: True if expired; otherwise false.
A false result should not automatically be interpreted as proof that the token is already active if its validity period has not started.
startTime
function startTime(uint256 tokenId) external view returns (uint256);Returns the beginning of a token's validity period. Its unit depends on expiryType.
Parameter
- tokenId: Token being queried.
Return value
- uint256: Starting block height or timestamp.
endTime
function endTime(uint256 tokenId) external view returns (uint256);Returns the end of a token's validity period. Zero denotes a token without an expiration, according to the convention described in the proposal.
Parameter
- tokenId: Token being queried.
Return value
- uint256: Ending block height or timestamp.
Function behavior
| Function or event | Behavior |
|---|---|
| balanceOf | Counts tokens held by the owner, including expired tokens. |
| transferFrom / safeTransferFrom | Expiration alone does not prevent an otherwise permitted transfer. |
| expiryType | Reports the unit used to measure expiration. |
| isTokenExpired | Returns true for an expired token and reverts for a nonexistent token. |
| startTime / endTime | Use the same configured measurement unit. For finite periods, the start must not exceed the end. The zero end-time convention requires separate handling. |
| TokenExpiryUpdated | Records the establishment or update of expiration information. |
Extension interface
IERC7858Epoch supports expiration management using epochs.
// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.8.0 <0.9.0;
/**
* @title ERC-7858: Expirable NFTs and SBTs
* @notice epoch expiry extension
*/
// The EIP-165 identifier of this interface is `0xec7ffd66`.
interface IERC7858Epoch /** is IERC7858 */ {
function currentEpoch() external view returns (uint256);
function epochLength() external view returns (uint256);
function isEpochExpired(uint256 epoch) external view returns (bool);
function unexpiredBalanceOf(address account) external view returns (uint256);
function unexpiredBalanceOfAtEpoch(uint256 epoch, address account) external view returns (uint256);
function validityDuration() external view returns (uint256);
}currentEpoch
function currentEpoch() external view returns (uint256);Returns the current epoch number, providing a reference period for validity checks.
Return value
- uint256: Current epoch number.
epochLength
function epochLength() external view returns (uint256);Returns the length of one epoch, expressed in blocks or seconds depending on the expiration type.
Return value
- uint256: Epoch length.
isEpochExpired
function isEpochExpired(uint256 epoch) external view returns (bool);Determines whether a specified epoch has expired under the contract's epoch validity rules.
Parameter
- epoch: Epoch number to check.
Return value
- bool: True if the epoch has expired.
unexpiredBalanceOf
function unexpiredBalanceOf(address account) external view returns (uint256);Returns the number of unexpired tokens held by a specified account.
Parameter
- account: Account address.
Return value
- uint256: Number of unexpired tokens.
unexpiredBalanceOfAtEpoch
function unexpiredBalanceOfAtEpoch(uint256 epoch, address account) external view returns (uint256);Returns the applicable unexpired token balance associated with a specified epoch. If that epoch has expired, the function returns zero.
Parameters
- epoch: Epoch number.
- account: Account address.
Return value
- uint256: Applicable unexpired token balance.
This query should not be confused with a historical ownership snapshot unless the implementation explicitly supplies historical accounting.
validityDuration
function validityDuration() external view returns (uint256);Returns the duration of token validity expressed as a number of epochs.
Return value
- uint256: Validity duration in epochs.
Extension behavior
| Function | Behavior |
|---|---|
| unexpiredBalanceOfAtEpoch | Returns the applicable balance for the specified epoch, or zero if it has expired. |
| unexpiredBalanceOf | Returns the currently unexpired token balance. |
| currentEpoch | Returns the current epoch. |
| epochLength | Returns the length of an epoch. |
| validityDuration | Returns the validity duration in epochs. |
| isEpochExpired | Reports whether the specified epoch has expired. |
Additional functions
The original article lists the following optional helper functions.
getRemainingDurationBeforeTokenExpired
function getRemainingDurationBeforeTokenExpired(uint256 tokenId) public view returns (uint256);Returns the remaining duration before a specified token expires, measured in blocks or seconds according to expiryType.
Parameter
- tokenId: Token being queried.
Return value
- uint256: Remaining duration.
Implementers should explicitly define the behavior for tokens without expiration and already expired tokens.
getEpochBalance
function getEpochBalance(uint256 epoch) public view returns (uint256);Returns a token count associated with a particular epoch, potentially including epochs that have already expired. The displayed signature has no account parameter, so the precise accounting scope must be determined from the implementation.
Parameter
- epoch: Epoch being queried.
Return value
- uint256: Token count.
getEpochInfo
function getEpochInfo(uint256 epoch) public view returns (uint256,uint256);Returns information about the start and end of an epoch.
Parameter
- epoch: Epoch being queried.
Return values
- uint256, uint256: Start and end values in the applicable measurement unit.
getNearestExpiryOf
function getNearestExpiryOf(address account) public view returns (uint256);Retrieves information about the nearest expiration associated with an account.
Parameter
- account: Account being queried.
Return value
- uint256: A value representing the nearest expiration according to the helper's implementation.
The displayed signature returns one value, not both a token ID and an expiration timestamp. Its precise meaning must be documented by the implementation.
getRemainingDurationBeforeEpochChange
function getRemainingDurationBeforeEpochChange() public view returns (uint256);Returns the duration until the next epoch begins, measured in blocks or seconds according to the configured expiration type.
Return value
- uint256: Remaining duration before the next epoch.
Rationale
Preserving existing behavior
A central design objective is to avoid breaking established NFT and SBT operations.
Expiration is introduced as an additional layer of information rather than a replacement for basic ownership and transfer behavior. Existing wallets and marketplaces can continue to interact with the underlying token interface, although they may need updates to display or enforce expiration-aware rights.
| Asset or integration | Effect |
|---|---|
| Transferable NFT | Expiration alone does not disable its transfer methods. |
| SBT | Existing non-transferability restrictions remain in force. |
| Existing dApps | Expired tokens continue to exist, while expiration-aware applications can treat their associated rights as invalid. |
Expiration is distinct from deletion. Keeping the token in existence helps preserve compatibility with ordinary ownership queries and token integrations.
Expiration types
ERC-7858 defines two measurement units.
| Type | Definition | Suitable applications |
|---|---|---|
| Block-based | Uses block.number. | Applications that require validity measured in network blocks, such as on-chain games or mining-related systems. |
| Time-based | Uses block.timestamp. | Applications aligned with calendar time, such as tickets, subscriptions, and memberships. |
Block-based expiration is appropriate when the number of blocks matters. It does not necessarily correspond to a fixed real-world duration because block intervals can vary. Time-based expiration is generally more suitable for services that use real-world deadlines, subject to the network's timestamp rules.
Compatibility
ERC-7858 is designed to integrate with existing NFT and SBT standards.
| Standard | Compatibility objective |
|---|---|
| ERC-721 | Preserve ownership, transfer, and metadata behavior. |
| ERC-5484 | Preserve the applicable soulbound and burn-authorization rules while adding expiration. |
| Other SBT standards | Add expiration without overriding the existing transfer restrictions. |
Existing implementations may incorporate the extension, but inheritance alone does not guarantee correct integration. Developers must implement the expiration interface and preserve the underlying token's authorization rules.
For background on ERC-5484, see:
ERC-5484: Assigning Burn authorization when minting SBTs
Reference implementation
Security considerations
Adding expiration introduces new state and authorization requirements. Implementations should prevent unauthorized updates and unintended reuse of expired rights.
Burn and reissuance
If a token can be burned and minted again using the same token ID, reissuance could unintentionally reset its expiration information.
Possible mitigations include:
- Prevent reuse of burned token IDs where appropriate.
- If reissuance is supported, define the required checks for expiration, ownership history, and authorization or signatures so that reissuance cannot bypass validity restrictions.
Unauthorized updates
Incorrect authorization for startTime or endTime updates could allow an unauthorized account to alter a token's validity period.
Implementations should consider:
- Restricting expiration updates to the issuer or another explicitly authorized role.
- Using appropriate access controls, such as Ownable or AccessControl, with carefully scoped administrative permissions.
- Monitoring TokenExpiryUpdated events to identify unexpected changes.
Access control and event monitoring serve different purposes: the former prevents unauthorized changes, while the latter supports detection and auditing.
Citation
sirawt (@MASDXI), ADISAKBOONMARK (@ADISAKBOONMARK), parametprame (@parametprame), Nacharoen (@najaroen), "ERC-7858: Expirable NFTs and SBTs," Ethereum Improvement Proposals, no. 7858, January 2024. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7858.
Conclusion
ERC-7858 provides an expiration interface for NFTs and SBTs, using block height or timestamps and supporting epoch-based management. It distinguishes the continued existence of a token from the validity of the rights associated with it.
If you have questions, feel free to contact me on Twitter.
You can also find my work on the following sites.



