ERC-5643: Subscription NFTs
Add subscription-based functionality to EIP-721 tokens
Abstract
This standard is an extension of EIP-721. It proposes an additional interface for NFTs to be used as recurring, expirable subscriptions. The interface includes functions to renew and cancel the subscription.
Motivation
NFTs are commonly used as accounts on decentralized apps or membership passes to communities, events, and more. However, it is currently rare to see NFTs like these that have a finite expiration date. The "permanence" of the blockchain often leads to memberships that have no expiration dates and thus no required recurring payments. However, for many real-world applications, a paid subscription is needed to keep an account or membership valid.
The most prevalent on-chain application that makes use of the renewable subscription model is the Ethereum Name Service (ENS), which utilizes a similar interface to the one proposed below. Each domain can be renewed for a certain period of time, and expires if payments are no longer made. A common interface will make it easier for future projects to develop subscription-based NFTs. In the current Web2 world, it's hard for a user to see or manage all of their subscriptions in one place. With a common standard for subscriptions, it will be easy for a single application to determine the number of subscriptions a user has, see when they expire, and renew/cancel them as requested.
Additionally, as the prevalence of secondary royalties from NFT trading disappears, creators will need new models for generating recurring income. For NFTs that act as membership or access passes, pivoting to a subscription-based model is one way to provide income and also force issuers to keep providing value.
Specification
The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.
The expiresAt(uint256 tokenId)
function MAY be implemented as pure
or view
.
The isRenewable(uint256 tokenId)
function MAY be implemented as pure
or view
.
The renewSubscription(uint256 tokenId, uint64 duration)
function MAY be implemented as external
or public
.
The cancelSubscription(uint256 tokenId)
function MAY be implemented as external
or public
.
The SubscriptionUpdate
event MUST be emitted whenever the expiration date of a subscription is changed.
The supportsInterface
method MUST return true
when called with 0x8c65f84d
.
Rationale
This standard aims to make on-chain subscriptions as simple as possible by adding the minimal required functions and events for implementing on-chain subscriptions. It is important to note that in this interface, the NFT itself represents ownership of a subscription, there is no facilitation of any other fungible or non-fungible tokens.
Subscription Management
Subscriptions represent agreements to make advanced payments in order to receive or participate in something. In order to facilitate these agreements, a user must be able to renew or cancel their subscriptions hence the renewSubscription
and cancelSubscription
functions. It also important to know when a subscription expires - users will need this information to know when to renew, and applications need this information to determine the validity of a subscription NFT. The expiresAt
function provides this functionality. Finally, it is possible that a subscription may not be renewed once expired. The isRenewable
function gives users and applications that information.
Easy Integration
Because this standard is fully EIP-721 compliant, existing protocols will be able to facilitate the transfer of subscription NFTs out of the box. With only a few functions to add, protocols will be able to fully manage a subscription's expiration, determine whether a subscription is expired, and see whether it can be renewed.
Backwards Compatibility
This standard can be fully EIP-721 compatible by adding an extension function set.
The new functions introduced in this standard add minimal overhead to the existing EIP-721 interface, which should make adoption straightforward and quick for developers.
Test Cases
The following tests require Foundry.
Reference Implementation
Implementation: ERC5643.sol
Security Considerations
This EIP standard does not affect ownership of an NFT and thus can be considered secure.
Copyright
Copyright and related rights waived via CC0.