💰 🕰️ 📋 EIP 1337 POC - Token Subscriptions on Ethereum
Subscribers sign a single off-chain meta transaction that is periodically resubmitted to the blockchain to create a trustless set-it-and-forget-it subscription model on Ethereum.
A publisher provides an ongoing service to multiple subscribers and wishes to receive compensation on a periodic interval. The publisher can deploy a lightweight subscription contract to represent their service. Then, the publisher sends subscribers a link to terms which they sign as a single, off-chain meta transaction. This meta transaction is sent to the publisher and/or a third party network that is incentivized with a gasToken.
Immediately, and repeatedly after the agreed upon the period, the single meta transaction becomes valid using a timestamp or block number nonce (instead of a traditional replay attack nonce). The single, signed meta transaction can be submitted, proven valid through ecrecover(), and the transferFrom() of the pre-approved erc20 token from subscriber to publisher is executed.
The subscriber is in full control of the flow of tokens using the approve() function built into the ERC20 standard. They must pre-approve the subscription contract that represents the service before any transfer can happen and they can revoke the allowance at any time to pause or cancel the subscription without touching the original meta transaction. Further, the terms of the subscription are explicitly signed in the meta transaction and can't be manipulated.
The subscription contract also holds logic representing the subscription status for a given account so other smart contracts can verify on-chain that a subscriber is actively paying the publisher.
Since this model works with any token that follows the approve() and transferFrom() standard, a stable token might serve as the best option for long running, monthly subscriptions. This shields both publisher and subscriber from price fluctuations.
Meta transactions can be submitted by any relayer and the relayer can be incentivized with a gasToken. This token can be paid by the publisher, the subscriber, or the subscription contract. The subscription contract can also reimburse the relayers directly with Ethereum. If funds are to be paid from the subscription contract, the subscriptionHash must be signed by the publisher.
██╗██████╗ ██████╗ ███████╗ ███║╚════██╗╚════██╗╚════██║ ╚██║ █████╔╝ █████╔╝ ██╔╝ ██║ ╚═══██╗ ╚═══██╗ ██╔╝ ██║██████╔╝██████╔╝ ██║ ╚═╝╚═════╝ ╚═════╝ ╚═╝ -EIP-