Skip to content

nikhlu07/BitStream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

21 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

BitStream

License: MIT Stacks Leather

BitStream Logo

Bitcoin-native micropayment streaming platform for exclusive content creators

BitStream enables creators to monetize exclusive content in real-time through frictionless Bitcoin micropayments. Users stream tiny sBTC payments per second/minute of content consumed with complete anonymity and privacyโ€”no crypto knowledge required. Creators receive instant payments with every second of content consumed.

๐ŸŽฏ Problem Statement

Traditional content monetization platforms suffer from:

  • High payment processing fees (3-5%)
  • Delayed payouts (weeks/months)
  • Geographic restrictions
  • Complex onboarding for creators and consumers
  • No granular pay-per-second models
  • Privacy concerns: Viewers' identities and viewing habits exposed
  • Security risks: Payment data vulnerable to breaches
  • Creator safety: Payment information tied to personal identity
  • Limited exclusive content: No anonymous, secure payment infrastructure

๐Ÿ’ก Solution

BitStream leverages sBTC on Stacks with dual wallet options to create a privacy-first, secure micropayment experience for exclusive content where:

  • Anonymous viewing: Users consume content without revealing identity
  • Instant creator payments: Real-time sBTC settlements per second of content
  • Flexible wallet options: Choose between embedded wallets (Turnkey) or existing Stacks wallets (Leather/Xverse)
  • Secure payments: Bitcoin-level security with smart contract automation
  • Users pay only for what they consume (per-second streaming)
  • Easy onboarding: Email/passkey signup OR connect existing wallet
  • Perfect for exclusive content creators who value privacy and safety

โœจ Key Features

For Users

  • Anonymous Access: Watch exclusive content without revealing identity
  • Dual Wallet Options:
    • Easy Mode: Email/passkey signup with embedded Turnkey wallets
    • Advanced Mode: Connect existing Leather or Xverse wallets
  • Privacy-Protected Payments: Transactions pseudonymous via Bitcoin
  • Automatic Micropayments: Set-and-forget streaming payments while consuming content
  • One-Click Tipping: Boost creators during live streams with instant sBTC tips
  • No Payment Data Storage: Zero credit card or banking information required

For Creators

  • Instant Payments: Receive sBTC in real-time as content is consumedโ€”no waiting periods
  • Protected Identity: Create under pseudonym without exposing personal payment details
  • Flexible Rate Setting: Configure per-minute or per-second rates
  • Real-Time Analytics: Track earnings, viewer count, and engagement live (without viewer identities)
  • Instant Withdrawals: Access your sBTC earnings immediately to any Bitcoin wallet
  • Multi-Content Support: Podcasts, live streams, written content, video, exclusive material
  • No Chargebacks: Bitcoin finality ensures payments are irreversible
  • Geographic Freedom: Accept payments from anywhere without restrictions

Technical Highlights

  • Smart Contract Streaming: Clarity contracts handle automated micropayment releases
  • sBTC Programmability: Demonstrates novel Bitcoin Layer 2 use cases
  • Stacks Wallet Integration: Seamless connection with popular Stacks wallets
  • Full Transaction Lifecycle: End-to-end sBTC streaming and settlement

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  React Client   โ”‚
โ”‚ Stacks Connect  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚
         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Leather/Xverse  โ”‚
โ”‚  Stacks Wallet  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚
         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Smart         โ”‚โ—„โ”€โ”€โ”€โ”€โ–บโ”‚  Stacks Network  โ”‚
โ”‚   Contracts     โ”‚      โ”‚  (Clarity Smart  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ”‚   Contracts)     โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ› ๏ธ Tech Stack

Frontend

  • React 18
  • TypeScript
  • Tailwind CSS
  • Stacks Connect
  • @stacks/transactions

Blockchain

  • Stacks Testnet/Mainnet
  • sBTC (Bitcoin L2)
  • Clarity Smart Contracts

Wallet Options

  • Turnkey Embedded Wallets (Email/Passkey signup)
  • Leather Wallet (Connect existing)
  • Xverse Wallet (Connect existing)
  • Any Stacks-compatible wallet

๐Ÿš€ Getting Started

Prerequisites

node >= 18.x
npm >= 9.x

Installation

  1. Clone the repository
git clone https://github.com/yourusername/bitstream.git
cd bitstream
  1. Install dependencies

Frontend:

cd bitstream-web
npm install

Contracts:

cd bitstream-contracts
npm install
  1. Environment Setup

Frontend (bitstream-web/.env.development):

# Stacks Configuration
VITE_STACKS_NETWORK=testnet
VITE_STACKS_API_URL=https://api.testnet.hiro.so

# Contract Addresses (Testnet)
VITE_CONTRACT_CONTENT_REGISTRY=SP2AJZZ6JAGEXV7SX056F9EZFABTX64CM2CQTPCCX.content-registry
VITE_CONTRACT_ACCESS_CONTROL=SP2AJZZ6JAGEXV7SX056F9EZFABTX64CM2CQTPCCX.access-control
VITE_CONTRACT_PAYMENT_PROCESSOR=SP2AJZZ6JAGEXV7SX056F9EZFABTX64CM2CQTPCCX.payment-processor

# Feature Flags
VITE_DEMO_MODE=false
VITE_ENABLE_FAUCET=true
  1. Deploy Smart Contracts (Optional - already deployed to testnet)
cd bitstream-contracts
node deploy-simple.cjs
  1. Start Development Server
cd bitstream-web
npm run dev

Visit http://localhost:5173

๐Ÿ“ Project Structure

bitstream/
โ”œโ”€โ”€ bitstream-web/          # React frontend
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/     # React components
โ”‚   โ”‚   โ”œโ”€โ”€ pages/          # Page components
โ”‚   โ”‚   โ”œโ”€โ”€ contexts/       # React context providers
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ StacksWalletContext.tsx # Stacks wallet integration
โ”‚   โ”‚   โ”œโ”€โ”€ lib/            # Utility libraries
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ contracts/  # Smart contract interactions
โ”‚   โ”‚   โ”œโ”€โ”€ config/         # Configuration files
โ”‚   โ”‚   โ””โ”€โ”€ App.tsx         # Root component
โ”‚   โ””โ”€โ”€ package.json
โ”‚
โ”œโ”€โ”€ bitstream-contracts/    # Clarity smart contracts
โ”‚   โ”œโ”€โ”€ contracts/          # Contract source files
โ”‚   โ”‚   โ”œโ”€โ”€ content-registry.clar    # Content management
โ”‚   โ”‚   โ”œโ”€โ”€ access-control.clar      # Access permissions
โ”‚   โ”‚   โ””โ”€โ”€ payment-processor.clar   # Payment processing
โ”‚   โ”œโ”€โ”€ deploy-simple.cjs   # Deployment script
โ”‚   โ””โ”€โ”€ DEPLOYMENT.md       # Deployment guide
โ”‚
โ””โ”€โ”€ .kiro/                  # Development specifications
    โ””โ”€โ”€ specs/              # Project specifications

๐ŸŽฎ Usage

Setup Your Wallet

Option 1: Turnkey Embedded Wallet (Recommended for beginners)

  1. Sign Up: Use email and passkey to create account
  2. Instant Wallet: Wallet created automatically
  3. Get Testnet STX: Use built-in faucet feature

Option 2: Existing Stacks Wallet (Advanced users)

  1. Install Leather Wallet: Download from leather.io
  2. Create/Import Wallet: Set up your Stacks wallet
  3. Get Testnet STX: Visit Stacks Testnet Faucet

As a Consumer

  1. Connect Wallet: Click "Connect Stacks Wallet" and approve in Leather
  2. Browse Content: Discover creators and content
  3. Start Streaming: Click playโ€”micropayments stream automatically via wallet
  4. Tip Creators: Send one-click sBTC boosts during live content

As a Creator

  1. Connect Wallet: Link your Stacks wallet to create profile
  2. Upload Content: Add podcasts, videos, or livestream
  3. Set Your Rate: Configure per-minute sBTC pricing
  4. Go Live: Start earning as users consume your content
  5. Withdraw: Instant sBTC withdrawal to your wallet

๐Ÿ“ Smart Contract Interfaces

Content Registry Contract

;; Register new content
(define-public (register-content 
    (content-hash (buff 32))
    (metadata-uri (string-ascii 256))
    (price uint)
    (creator principal))
    ;; Implementation
)

;; Get content information
(define-read-only (get-content-info 
    (content-id uint))
    ;; Implementation
)

Payment Processor Contract

;; Purchase content access
(define-public (purchase-content 
    (content-id uint)
    (payment-amount uint))
    ;; Implementation
)

;; Withdraw creator earnings
(define-public (withdraw-earnings)
    ;; Implementation
)

Access Control Contract

;; Check if user has access
(define-read-only (has-access 
    (content-id uint)
    (viewer principal))
    ;; Implementation
)

;; Grant access to content
(define-public (grant-access
    (content-id uint)
    (viewer principal))
    ;; Implementation
)

๐Ÿ” Security Considerations

Privacy & Anonymity

  • Wallet-Based Identity: Users identified only by Stacks addresses
  • Minimal Data Collection: No personal information required
  • Pseudonymous Transactions: Payments via Bitcoin addresses
  • No Viewing History Tracking: Content consumption not linked to real identities

Payment Security

  • Non-Custodial Wallets: Users control their own keys via Leather/Xverse
  • Smart Contract Automation: Reduces human error and fraud vectors
  • Instant Settlement: Bitcoin finality prevents chargebacks
  • Multi-Signature Options: Available for high-value creator accounts

Platform Security

  • Smart Contract Verification: All contracts deployed and verified on Stacks
  • Open Source: Full transparency of contract code
  • Wallet Security: Leverages battle-tested Stacks wallet infrastructure
  • No Private Key Storage: Platform never handles user private keys

๐Ÿงช Testing

Test Smart Contracts

Visit the test page at /test-contracts to:

  • Connect your Stacks wallet
  • Test contract interactions
  • Verify deployment status
  • Send test transactions
# Run frontend tests
cd bitstream-web
npm test

# Test contract deployment
cd bitstream-contracts
npm test

๐ŸŒ Deployed Contracts (Testnet)

Contract Address
Content Registry SP2AJZZ6JAGEXV7SX056F9EZFABTX64CM2CQTPCCX.content-registry
Access Control SP2AJZZ6JAGEXV7SX056F9EZFABTX64CM2CQTPCCX.access-control
Payment Processor SP2AJZZ6JAGEXV7SX056F9EZFABTX64CM2CQTPCCX.payment-processor

๐Ÿ—บ๏ธ Roadmap

MVP (Current)

  • Stacks wallet integration (Leather, Xverse)
  • Smart contract deployment on testnet
  • Basic content registry and payment processing
  • Creator dashboard
  • Consumer content player

Phase 2

  • Mainnet launch
  • Advanced streaming payment mechanics
  • Content recommendation engine
  • Mobile responsive optimization
  • Multi-tier subscription options

Phase 3

  • Mobile apps with wallet integration
  • Creator NFT badges
  • Decentralized content storage (IPFS)
  • Cross-chain support
  • Advanced analytics dashboard

๐Ÿค Contributing

Contributions are welcome! Please read our Contributing Guide for details.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

Built with โšก for the Stacks ecosystem

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •