Skip to content

pblvrt/pps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 

Repository files navigation

x402 Documentation

What is x402?

x402 is a pay-per-view video streaming platform that uses crypto micropayments. Think of it like paying a few cents to watch a video, but instead of ads or subscriptions, you pay directly with cryptocurrency.

The Problem It Solves

Traditional video monetization sucks:

  • Ads: Annoying, invasive, and you're the product
  • Subscriptions: Pay monthly even if you watch one video
  • Paywalls: All-or-nothing access

The Solution

With x402, you:

  1. Connect your wallet (like MetaMask)
  2. Pay a small fee (typically $0.01-$1 in USDC)
  3. Watch the video - that's it!

No accounts, no subscriptions, no tracking. Just simple, direct payments.

How It Works (Simple Version)

You → Pay $0.50 → Creator gets $0.50 → You watch video

The magic happens using the x402 protocol - an open standard for HTTP payments. When you request a paid video, the server says "pay me first" (HTTP 402), your wallet signs the payment, and boom - you're watching.


Documentation Index

🚀 Getting Started

New here? Start with these:

🔧 Setup & Configuration

Setting up your own instance:

📚 Deep Dives

Want to understand the internals:


Architecture Overview

┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│   Browser   │ ──► │ x402 Proxy  │ ──► │   Mux CDN   │
│  (Wallet)   │     │ (Payments)  │     │  (Videos)   │
└─────────────┘     └─────────────┘     └─────────────┘

How a video request flows:

  1. Manifest loads (free) - Video metadata and segment list
  2. First segment - Server asks for payment (402 response)
  3. Wallet signs - You approve the USDC payment
  4. Session created - Cookie stores your access
  5. Video plays - All segments load using session

Key Concepts

Term What it means
x402 The payment protocol (HTTP 402 = Payment Required)
Segment A chunk of video (~2-10 seconds each)
Session Your paid access, stored as a cookie
USDC The stablecoin used for payments ($1 = 1 USDC)
Base The Ethereum L2 network we use (fast & cheap)

Status

Working: Session-based payments, video playback, wallet integration
Tested: Full payment flow on Base Sepolia testnet
Coming: Production deployment, analytics, creator dashboard

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors