Why Nostr? What is Njump?
2025-04-24 15:06:33
in reply to

BtcPins on Nostr: Probably not making a video, but here's the prompt I fed into Cursor to start the ...

Probably not making a video, but here's the prompt I fed into Cursor to start the project. I had perplexity.ai help write it:

We're building a Lightning-powered video player with Nostr integration. Create a Next.js/React app with these components:

Video File Handling

Use FFmpeg.js/WebAssembly for in-browser video metadata modification

Implement custom metadata tagging in MP4 containers using 'uuid' boxes for:

Lightning addresses (BOLT11 invoices)

Nostr npub signatures (NIP-07)

Payment rate per minute (JSON structure)

Add signature verification using nostr-tools' nip07.verifyEvent()

Player Core

Use Video.js with HLS.js for adaptive streaming

Create payment timer that triggers every minute using requestAnimationFrame

Implement payment queue with exponential backoff retries

Lightning/Nostr Integration

Add NWC (Nostr Wallet Connect) via nostr-wallet-connect-js

Include these Lightning libraries:

lightning-bolt11 for invoice parsing

alby-js-sdk for NWC implementation

lightning-devkit for fallback LSP integration

Create payment metadata builder including:

Video SHA-256 hash

Current timestamp

Content creator's npub

Security Features

Implement WebCrypto API for client-side hash verification

Add budget controls with permissioned NWC scopes

Create payment audit trail using IndexedDB

Sample File Structure:

bash
/src
/components
PlayerCore.tsx
PaymentProcessor.ts
NostrVerifier.ts
/lib
video-metadata.ts
lightning-helpers.ts
crypto-utils.ts
/pages
index.tsx
api/payment-webhook.ts

Key Dependencies:

json
{
"dependencies": {
"video.js": "^8.3",
"hls.js": "^1.4",
"ffmpeg.js": "^4.2.9003",
"nostr-tools": "^2.3.4",
"alby-js-sdk": "^1.0.0",
"lightning-bolt11": "^2.3.1",
"indexeddb": "^5.0.1",
"webcrypto-liner": "^1.2.0"
}
}

Required Cursor Rules:

Prioritize WebLN/NWC compatibility checks

Enforce content verification before payment processing

Maintain offline-first payment queue architecture

Include FFmpeg.js worker thread optimization

First Implementation Steps:

Create video metadata prototype using ffmpeg.js's writeMetadata

Set up NWC connection handler with budget controls

Build payment timer that survives tab hibernation

Implement metadata extraction on video load

Add signature verification overlay UI

Critical Questions to Resolve:

How to handle video seeks/rewinds in payment calculation?

What NWC permissions scope is needed?

How to persist partially watched payment state?

What's the fallback for non-Nostr users?

Example Payment Metadata Structure:

typescript
interface VideoPaymentTags {
version: '0.1';
creator: string; // npub
rate: number; // sats per minute
boostAddresses: {
primary: string;
secondary?: string;
};
signature: string; // NIP-07 signed video hash
createdAt: number; // UNIX timestamp
}

This prompt gives Cursor a clear roadmap while maintaining flexibility for AI-generated implementation details. The architecture balances web video standards with modern Bitcoin/Nostr integrations while emphasizing verification and user control.


The nostr stuff isn't added yet, but that's where it's headed.
Author Public Key
npub12z5nym0qkxhdrvmyhup2llzp98lryr38gw8ywxktkps9eqdts7asjj9k9c