Skip to content

tricodex/flowaido

Repository files navigation

Flowaido

Music streaming platform where songs are tradeable tokens on Flow blockchain. Uses bonding curves for price discovery - similar to pump.fun but for music.

What It Does

Artists upload songs that become fungible tokens. Fans buy/sell these tokens on a bonding curve. Token holders can stream the full song, non-holders get 30-second previews.

Tech Stack

  • Frontend: Next.js 15.3 with React 19
  • Blockchain: Flow (testnet: 0x8b62f2389c34a040)
  • Storage:
    • Storacha (web3.storage) for IPFS metadata and cover art
    • AWS S3 + CloudFront for audio files (current)
    • FilCDN for decentralized audio (experimental)
  • Package Manager: Bun

Project Structure

flowaido/
├── packages/
│   └── flowaido-nxt/           # Next.js frontend + everything
│       ├── src/
│       │   ├── app/            # Next.js app router pages
│       │   ├── components/     # React components
│       │   ├── services/       # Business logic
│       │   │   ├── flow.ts     # Flow blockchain interactions
│       │   │   ├── audio.ts    # Audio streaming
│       │   │   ├── storacha.ts # IPFS via Storacha
│       │   │   └── filcdn.ts   # FilCDN integration
│       │   └── config/
│       │       └── flow.ts     # FCL configuration
│       └── contracts/          # Flow smart contracts (moved here for hackathon)
│           └── flowaido/
│               └── cadence/
│                   ├── contracts/
│                   │   └── SongTokenFactory.cdc
│                   └── transactions/
└── packages/back/              # AWS Lambda backend (legacy)

Smart Contracts

Located in packages/flowaido-nxt/contracts/flowaido/cadence/:

  • SongTokenFactory.cdc - Main contract that creates song tokens with bonding curves
  • Each song gets 1 billion tokens (800M on curve, 200M reserved)
  • 0.05 FLOW to deploy a song
  • Graduates to DEX at 1725 FLOW market cap

How It Works

  1. Upload: Artist uploads song via /create or /upload page
  2. Storage:
    • Audio goes to AWS S3 (CloudFront CDN) or FilCDN
    • Metadata and cover art go to IPFS via Storacha
  3. Deploy: Creates token on Flow blockchain with bonding curve
  4. Trade: Users buy/sell tokens, price follows curve
  5. Stream: Token holders stream full song, others get preview

Setup

# Install dependencies
bun install

# Run frontend
cd packages/flowaido-nxt
bun run dev

# Deploy contracts (need Flow CLI)
cd contracts/flowaido
flow deploy --network=testnet

Environment Variables

Create .env.local:

# Flow
NEXT_PUBLIC_FLOW_NETWORK=testnet
NEXT_PUBLIC_SIGNER_URL=https://etfr2ptpuwrm7zsznt2oxl7c640gldoc.lambda-url.us-east-1.on.aws/
NEXT_PUBLIC_AUDIO_CDN_URL=https://d2yhbp3tmn83h0.cloudfront.net

# Storacha (IPFS)
NEXT_PUBLIC_STORACHA_EMAIL=your-email@example.com

# WalletConnect
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=719d0ccc89683c6417332eec3961fc8d

# FilCDN (optional)
PRIVATE_KEY=your-ethereum-private-key
RPC_URL=https://rpc.ankr.com/filecoin_testnet/your-key

Key Files

  • src/services/flow.ts - All blockchain interactions
  • src/services/storacha.ts - IPFS uploads via Storacha
  • src/services/audio.ts - Audio streaming logic
  • src/app/trending/page.tsx - Main marketplace
  • src/components/TokenGatedAudioPlayer.tsx - Audio player with token checks

API Routes

  • POST /api/audio/stream - Get signed URL for audio streaming (checks token balance)
  • GET /api/placeholder/:size - Generate placeholder images

Current Status

  • ✅ Deployed on Flow testnet
  • ✅ Songs can be created and traded
  • ✅ Token-gated streaming works
  • ✅ Storacha integration for IPFS
  • 🚧 FilCDN integration (experimental)
  • 🚧 Wallet connection issues being debugged

Notes

  • Contracts moved to this repo to make it a monorepo for hackathon submission
  • Using Storacha (evolution of web3.storage) for IPFS - handles metadata and cover art
  • Audio files currently on AWS, FilCDN integration in progress
  • Flow uses Cadence 1.0 (upgraded Sept 2024)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors