[DRAFT] - eth-subscriptions

Inspiration

We noticed that many content DApps are only able to charge a flat fee. Subscription-based, frictionless payments is the missing piece for many blockchain-based businesses.

What it does

eth-subscriptions includes all modules needed to integrate a paywall with a content site. Developers can use a simple API to hook up node middleware to an authentication flow - users will only get a jwt token if they are subscribed.

How we built it

We started by integrating with metamask to get public keys, in order to sign transactions. This gave us 2FA using signTypedMessage. We knew that we needed at least two smart contracts in-between the hypothetical customer and merchant. We implemented both and added a UI layer with paywall that would allow us to demo subscription-based authentication.

  • The consumer contract exposes methods that the merchant can call after a given interval, to get payment. That method has its own verification to ensure the consumer is only ever debited for a subscription they've already agreed to.

  • The merchant contract keeps track of a list of subscribers, the subscription price, and the subscription interval. For each subscriber, it checks the last payment date and compares it with internal state and interval to check if the address in question is subscribed.

Challenges we ran into

  • Communication between the smart contracts and processing time on the blockchain.
  • Initiating transactions on a time interval.

Accomplishments that we're proud of

  • It works!
  • Awesome 90s web design.
  • Implemented a paywall that verifies based on a user having made a payment on the Ethereum blockchain, and checks if it happened within a specific time interval.
  • Created a dev-friendly, easy to use middleware, to add a paywall to a route.
  • Created a one-click solution for a merchant to allow a user to subscribe to their site.

What's next for eth-subscriptions

  • Re-implement with bidirectional state-channels, allowing the merchant to request payment and users to request refunds.
  • Trial functionality, tiered purchases, upsells/upgrades, and customizations like mandatory length of contract
  • Full-featured UI for user to check all of their active subscriptions.
  • Merchant Dashboard.

Built With

Share this project:
×

Updates