YieldStream

Micropayments reimagined: pay as you watch, powered by yield from your deposited tokens

YieldStream

Created At

ETHGlobal New Delhi

Project Description

YieldStream is a decentralized micropayment protocol that enables pay-as-you-consume payments for digital content. Instead of paying upfront or committing to subscriptions, users deposit tokens into a yield-generating vault and are charged only for the exact amount of content they consume, streamed in real time.

At its core, YieldStream is powered by three smart contracts:

Yield.sol – An ERC-4626-based vault where users deposit tokens. For demonstration, deposited tokens are increased by 20% to simulate yield generation.

MockUSDC.sol – A mock stablecoin used as the underlying asset for deposits and payments.

StreamingWallet.sol – Handles real-time micropayments, deducting funds precisely based on actual content consumption (e.g., per second of video watched).

The user flow is simple:

A user deposits tokens into the Yield Vault, which simulates yield by increasing their balance by 20%.

That yield value can then be used to stream payments as they interact with content — for example, watching a video.

If a 10-minute video costs 10 tokens and a user watches only 2 minutes, they pay just 2 tokens (20%). If they pause or stop, the payment halts instantly.

The platform also includes a content management system for creators. Admins (contract owners) can upload videos directly to Filecoin/IPFS via Lighthouse, where metadata is generated and content is listed on-chain. Once listed, content appears as clickable cards in the “Available Content” section, showing details like the title, price in mUSDC, and metadata hash.

Users can then click on any listed video to stream it, and payments will automatically stream from their vault balance in real time.

YieldStream unlocks a new payment model for the internet — one where users only pay for what they consume, creators are compensated fairly based on actual engagement, and DeFi yield becomes a fuel for seamless micropayments across platforms.

How it's Made

We built YieldStream as a full-stack decentralized application designed to combine DeFi yield with real-time micropayments. The core of the project consists of three Solidity smart contracts:

Yield.sol – An ERC-4626 vault contract that accepts deposits and simulates yield by increasing deposited amounts by 20% for demonstration.

MockUSDC.sol – A mock ERC-20 stablecoin used as the underlying asset for deposits and streaming payments.

StreamingWallet.sol – Handles real-time micropayment logic, tracking how long a user consumes content and deducting funds accordingly.

We wrote and deployed these contracts using Hardhat and tested them on the Sepolia testnet. The frontend is built with Next.js and TypeScript, styled with TailwindCSS, and uses RainbowKit and Wagmi for wallet connection and on-chain interactions. Ethers.js powers the communication between the frontend and smart contracts.

For storage, we integrated Filecoin/IPFS via Lighthouse SDK, which allows the admin (contract owner) to upload video files and generate metadata stored on a decentralized network. The content metadata and pricing are then registered on-chain, and the frontend fetches this data to display available content dynamically.

We also implemented a real-time payment simulation layer. Whenever a user starts watching a video, the frontend triggers the startStream function in the StreamingWallet contract, which calculates cost based on consumption time. If the video is paused or stopped, the stream stops immediately — a hacky but elegant solution we implemented by syncing on-chain state changes with frontend player events.

One of the most interesting aspects of this build was designing a seamless flow where yield-generated balance becomes spendable credit. We simulated DeFi yield to demonstrate how deposits can grow and fuel micropayments, laying the groundwork for future integration with real yield sources like Aave or Yearn.

By combining decentralized storage, ERC-4626 vault logic, and real-time streaming payments, YieldStream demonstrates a new way to monetize content: users pay only for what they consume, and creators earn exactly based on engagement.

background image mobile

Join the mailing list

Get the latest news and updates