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-4885, a proposal for providing NFT-based subscriptions paid for with fungible tokens.
The explanation below translates, summarizes, and expands on the original proposal.
I also cover a range of other EIPs.
Overview
ERC-4885 proposes a standard API for providing subscription-based access to NFTs (ERC-721) and multi tokens (ERC-1155). Users deposit ERC-20 tokens to obtain subscription tokens representing time-limited or lifetime access to the associated NFT.
The subscription token represents the right to use an NFT for a specified period. Access can therefore be managed independently of transfers of the underlying NFT. In the interface described below, the subscriber must nevertheless receive the associated NFT when subscribing.
Motivation
ERC-4885 proposes a flexible mechanism for accessing ERC-721 and ERC-1155 assets through subscriptions. Its motivations include the following.
Moving beyond centralized distribution models
Digital content, such as music and movies, is often distributed through subscription models established by large technology companies. This can make it difficult for creators to develop independent revenue models.
Decentralized distribution in Web3
With ERC-4885, developers can build decentralized applications that allow creators to establish their own subscription models and provide NFT-based access accordingly. This enables more flexible revenue models and distribution arrangements.
Use cases
ERC-4885 is suitable for recurring access and subscription services such as the following.
- Subscription services for music, video, books, news, and e-learning.
- Shared access to digital assets.
- Memberships, such as fitness club memberships.
- Season tickets for sports and esports.
- DeFi agreements exchanging fixed payments for variable revenue.
- Rental of in-game items.
Subscription token design
ERC-4885 allows subscription tokens to incorporate some ERC-20 functionality, enabling optional extensions such as the following.
- Resale on secondary markets.
- Gifts to other users.
- Subscription refunds.
The resulting design can represent more than an access entitlement: implementations may also give subscription tokens transferable economic value.
Specification
Basic mechanism
- Starting a subscription
- The subscriber deposits ERC-20 tokens, called the base token, to begin a subscription for NFT access.
- Decreasing balance
- For time-limited subscriptions, the subscription token balance decreases linearly over time.
- Extension
- Subscribers can extend their subscription by making additional deposits.
Required interface identification
A contract implementing ERC-4885 must implement the ERC-165 function supportsInterface(bytes4) and return true when passed 0xC1A48422.
For more on ERC-165, see the following article.
[ERC-165] Checking Whether a Contract Supports an Interface
Interface
interface ISubscriptionToken {
/**
@dev This emits when the subscription token constructor or initialize method is
executed.
@param name The name of the subscription token
@param symbol The symbol of the subscription token
@param provider The provider of the subscription whom receives the deposits
@param subscriptionToken The subscription token contract address
@param baseToken The ERC-20 compatible token to use for the deposits.
@param nft Address of the `nft` contract that the provider mints/transfers from.
All tokenIds referred to in this interface MUST be token instances of this `nft` contract.
*/
event InitializeSubscriptionToken(
string name,
string symbol,
address provider,
address indexed subscriptionToken,
address indexed baseToken,
address indexed nft,
string uri
);
/**
@dev This emits for every new subscriber to `nft` contract of token `tokenId`.
`subscriber` MUST have received `nft` of token `tokenId` in their account.
@param subscriber The subscriber account
@param tokenId MUST be token id of `nft` sent to `subscriber`
@param uri MUST be uri of the `nft` that was sent to `subscriber` or empty string
*/
event SubscribeToNFT(
address indexed subscriber,
uint256 indexed tokenId,
string uri
);
/**
@dev Emits when `subscriber` deposits ERC-20 of token type `baseToken` via the `deposit method.
This tops up `subscriber` balance of subscription tokens
@param depositAmount The amount of ERC-20 of type `baseToken` deposited
@param subscriptionTokenAmount The amount of subscription tokens sent in exchange to `subscriber`
@param subscriptionPeriod Amount of additional time in seconds subscription is extended
*/
event Deposit(
address indexed subscriber,
uint256 indexed tokenId,
uint256 depositAmount,
uint256 subscriptionTokenAmount,
uint256 subscriptionPeriod
);
/**
@return The name of the subscription token
*/
function name() external view returns (string memory);
/**
@return The symbol of the subscription token
*/
function symbol() external view returns (string memory);
/**
@notice Subscribes `subscriber` to `nft` of 'tokenId'. `subscriber` MUST receive `nft`
of token `tokenId` in their account.
@dev MUST revert if `subscriber` is already subscribed to `nft` of 'tokenId'
MUST revert if 'nft' has not approved the `subscriptionToken` contract address as operator.
@param subscriber The subscriber account. MUST revert if zero address.
@param tokenId MUST be token id of `nft` contract sent to `subscriber`
`tokenId` emitted from event `SubscribeToNFT` MUST be the same as tokenId except when
tokenId is zero; allows OPTIONAL tokenid that is then set internally and minted by
`nft` contract
@param uri The OPTIONAL uri of the `nft`.
`uri` emitted from event `SubscribeToNFT` MUST be the same as uri except when uri is empty.
*/
function subscribeToNFT(
address subscriber,
uint256 tokenId,
string memory uri
) external;
/**
@notice Top up balance of subscription tokens held by `subscriber`
@dev MUST revert if `subscriber` is not subscribed to `nft` of 'tokenId'
MUST revert if 'nft' has not approved the `subscriptionToken` contract address as operator.
@param subscriber The subscriber account. MUST revert if zero address.
@param tokenId The token id of `nft` contract to subscribe to
@param depositAmount The amount of ERC-20 token of contract address `baseToken` to deposit
in exchange for subscription tokens of contract address `subscriptionToken`
*/
function deposit(
address subscriber,
uint256 tokenId,
uint256 depositAmount
) external payable;
/**
@return The balance of subscription tokens held by `subscriber`.
RECOMMENDED that the balance decreases linearly to zero for time limited subscriptions
RECOMMENDED that the balance remains the same for life long subscriptions
MUST return zero balance if the `subscriber` does not hold `nft` of 'tokenId'
MUST revert if subscription has not yet started via the `deposit` function
When the balance is zero, the use of `nft` of `tokenId` MUST NOT be allowed for `subscriber`
*/
function balanceOf(address subscriber) external view returns (uint256);
}Events
InitializeSubscriptionToken
event SubscribeToNFT(
address indexed subscriber,
uint256 indexed tokenId,
string uri
);An event emitted when a subscription token is initialized. The original article reproduces the SubscribeToNFT declaration here; the correct InitializeSubscriptionToken declaration appears in the full interface above.
name- The token name.
symbol- The token symbol.
provider- The subscription provider's address, which receives deposits.
subscriptionToken- The subscription token contract address.
baseToken- The ERC-20 token contract address used for deposits.
nft- The associated NFT contract address.
uri- The subscription token's metadata URI.
SubscribeToNFT
event SubscribeToNFT(
address indexed subscriber,
uint256 indexed tokenId,
string uri
);An event emitted when a user subscribes to an NFT.
subscriber- The subscriber's address.
tokenId- The token ID of the associated NFT.
uri- The NFT's URI.
Deposit
event Deposit(
address indexed subscriber,
uint256 indexed tokenId,
uint256 depositAmount,
uint256 subscriptionTokenAmount,
uint256 subscriptionPeriod
);An event emitted when a subscriber deposits ERC-20 tokens and receives subscription tokens.
subscriber- The subscriber's address.
tokenId- The token ID of the associated NFT.
depositAmount- The amount of ERC-20 tokens deposited.
subscriptionTokenAmount- The amount of subscription tokens issued.
subscriptionPeriod- The additional subscription period, in seconds.
Functions
name
function name() external view returns (string memory);Returns the name of the subscription token.
symbol
function symbol() external view returns (string memory);Returns the symbol of the subscription token.
subscribeToNFT
function subscribeToNFT(
address subscriber,
uint256 tokenId,
string memory uri
) external;Subscribes subscriber to the NFT identified by tokenId.
The URI is optional and can record the NFT's metadata URI.
The function must revert in the following cases.
- The subscriber is already subscribed to the specified NFT.
- The NFT contract has not approved the subscription token contract as an operator.
- The subscriber is the zero address.
deposit
function deposit(
address subscriber,
uint256 tokenId,
uint256 depositAmount
) external payable;Deposits ERC-20 tokens to increase a subscriber's subscription token balance.
The function must revert in the following cases.
- The subscriber is not subscribed to the specified NFT.
- The NFT contract has not approved the subscription token contract as an operator.
- The subscriber is the zero address.
balanceOf
function balanceOf(address subscriber) external view returns (uint256);Returns the subscriber's current subscription token balance.
- For time-limited subscriptions, the balance is recommended to decrease linearly over time.
- For lifetime subscriptions, the balance is recommended to remain constant.
- The balance must be zero if the subscriber does not hold the associated NFT. If the subscription has not started through a deposit, the interface requires the function to revert rather than simply return zero.
- If the balance is zero, the subscriber must not be allowed to use the associated NFT.
Subscription token accounting model
- Example: A seven-day subscription issues seven tokens, with the calculated balance decreasing by one token each day.
The decrease is calculated when balanceOf is called.
Calculating the token price
The original article provides the following formula, where the Japanese word at the beginning means "price."
価格 = depositAmount ÷ (subscriptionTokenAmount × subscriptionPeriod)The formula expresses a price normalized by subscription token quantity and subscription duration. For the overall payment per second of subscription extension, divide depositAmount by subscriptionPeriod.
Using NFT metadata
Metadata can contain the service's contractual terms or information about the NFT's associated assets. The format is intentionally general, allowing implementations to represent information suited to each use case.
Subscription expiration
When the balance reaches zero, the subscriber's access to the NFT becomes invalid. The mechanism used to enforce this, such as stopping content delivery or returning an empty metadata URI, is left to the implementation.
Caveats
- No built-in automatic renewal
- The standard does not define automatic recurring charges comparable to conventional credit card subscriptions.
- Deposits require sufficient token authorization; implementations can use existing allowances or additional automation.
- No standardized pause functionality
- Pausing requires a custom implementation.
- For example, an implementation could incorporate OpenZeppelin's
Pausable.
- Accounting for paused periods
- Supporting pauses requires additional logic in
balanceOf. - The implementation may need to exclude elapsed time during paused periods when calculating the balance.
- Supporting pauses requires additional logic in
Rationale
Tokenizing subscriptions
ERC-4885 makes it possible to represent subscriptions as assets that may be traded on secondary markets. For example, fans could exchange remaining access to sports season tickets through a subscription token. A simple NFT with a fixed expiration date may not support the same flexible accounting.
- A subscription token implementing ERC-20 transfer functionality can be transferred.
- A buyer may inherit the remaining access period of an NFT-based subscription, provided the application supports transferring the entitlement and associated NFT.
- Fungible subscription balances may be combined with an existing subscription.
Supporting different NFT use cases
The subscribeToNFT function permits optional token identifiers and URIs through the conventions described in the interface, such as a zero token ID or empty URI. This supports a variety of applications.
- An NFT collection that simply uses different images may not require a URI to be supplied.
- Where legal agreements are involved, the URI may need to reference information about both parties' obligations.
Giving users greater control
Conventional streaming subscriptions are centralized, with the provider controlling pricing and contractual terms. ERC-4885 provides a basis for building subscription models within decentralized applications, allowing participants to establish and operate their own ecosystems.
Compatibility
ERC-4885 subscription tokens may be designed to support ERC-20.
The interface already includes functions such as name, symbol, and balanceOf. Implementing additional ERC-20 functionality, including transfer, may enable subscription transfers and resale.
The mechanism can also indirectly control the period during which an NFT may be used. This requires coordination between the NFT contract, the subscription token contract, and the application enforcing the entitlement.
The design aims to avoid affecting previously issued unrelated NFTs. The associated NFT contract must approve the subscription token contract as an operator.
Security considerations
Advance payments and provider reliability
ERC-4885 uses a prepaid model in which subscribers make payments through deposit.
However, the standard does not specify remedies or collateral arrangements for cases in which a provider fails to deliver the service or delivers an inadequate service.
This problem can also occur in centralized subscription services. Additional trust, reputation, or dispute-resolution mechanisms may be necessary.
Metadata tampering
The subscribeToNFT function accepts a URI. If that URI points to centrally hosted content, the provider may modify it later, or an external compromise may alter the referenced content.
Content-addressed or immutable storage mechanisms, such as IPFS with a fixed content identifier or Arweave, are recommended. For use cases involving important contractual terms, the integrity and persistence of the referenced content are particularly important.
Citation
Jules Lai (@julesl23), "ERC-4885: Subscription NFTs and Multi Tokens [DRAFT]," Ethereum Improvement Proposals, no. 4885, March 2022. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-4885.
Conclusion
This article covered ERC-4885, a proposal for NFT-based subscriptions paid for with fungible tokens.
If you have questions, feel free to reach out via Twitter DM.
I also publish on the following platforms.



