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.
Published at
2025-04-24 15:06:33Event JSON
{
"id": "236f6f8256bb5aaeeb19837dc1df3727d0897e437e3498f0431458b805ad77a7",
"pubkey": "50a9326de0b1aed1b364bf02affc4129fe320e27438e471acbb0605c81ab87bb",
"created_at": 1745507193,
"kind": 1,
"tags": [
[
"e",
"b72ec1ffc7fe1d527f1524e8efa7ff309fb3bcf243ceaf3783630a5dac8e5f80",
"wss://search.nos.today/",
"root",
"50a9326de0b1aed1b364bf02affc4129fe320e27438e471acbb0605c81ab87bb"
],
[
"e",
"511ea03a57ee5550b3564abbedf9091b94b6938e5a96868ca288479988da412d",
"wss://bitcoiner.social/",
"reply",
"4657dfe8965be8980a93072bcfb5e59a65124406db0f819215ee78ba47934b3e"
],
[
"p",
"50a9326de0b1aed1b364bf02affc4129fe320e27438e471acbb0605c81ab87bb"
],
[
"p",
"4657dfe8965be8980a93072bcfb5e59a65124406db0f819215ee78ba47934b3e"
]
],
"content": "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: \n\nWe're building a Lightning-powered video player with Nostr integration. Create a Next.js/React app with these components:\n\n Video File Handling\n\n Use FFmpeg.js/WebAssembly for in-browser video metadata modification\n\n Implement custom metadata tagging in MP4 containers using 'uuid' boxes for:\n\n Lightning addresses (BOLT11 invoices)\n\n Nostr npub signatures (NIP-07)\n\n Payment rate per minute (JSON structure)\n\n Add signature verification using nostr-tools' nip07.verifyEvent()\n\n Player Core\n\n Use Video.js with HLS.js for adaptive streaming\n\n Create payment timer that triggers every minute using requestAnimationFrame\n\n Implement payment queue with exponential backoff retries\n\n Lightning/Nostr Integration\n\n Add NWC (Nostr Wallet Connect) via nostr-wallet-connect-js\n\n Include these Lightning libraries:\n\n lightning-bolt11 for invoice parsing\n\n alby-js-sdk for NWC implementation\n\n lightning-devkit for fallback LSP integration\n\n Create payment metadata builder including:\n\n Video SHA-256 hash\n\n Current timestamp\n\n Content creator's npub\n\n Security Features\n\n Implement WebCrypto API for client-side hash verification\n\n Add budget controls with permissioned NWC scopes\n\n Create payment audit trail using IndexedDB\n\nSample File Structure:\n\nbash\n/src\n /components\n PlayerCore.tsx\n PaymentProcessor.ts\n NostrVerifier.ts\n /lib\n video-metadata.ts\n lightning-helpers.ts\n crypto-utils.ts\n /pages\n index.tsx\n api/payment-webhook.ts\n\nKey Dependencies:\n\njson\n{\n \"dependencies\": {\n \"video.js\": \"^8.3\",\n \"hls.js\": \"^1.4\",\n \"ffmpeg.js\": \"^4.2.9003\",\n \"nostr-tools\": \"^2.3.4\",\n \"alby-js-sdk\": \"^1.0.0\",\n \"lightning-bolt11\": \"^2.3.1\",\n \"indexeddb\": \"^5.0.1\",\n \"webcrypto-liner\": \"^1.2.0\"\n }\n}\n\nRequired Cursor Rules:\n\n Prioritize WebLN/NWC compatibility checks\n\n Enforce content verification before payment processing\n\n Maintain offline-first payment queue architecture\n\n Include FFmpeg.js worker thread optimization\n\nFirst Implementation Steps:\n\n Create video metadata prototype using ffmpeg.js's writeMetadata\n\n Set up NWC connection handler with budget controls\n\n Build payment timer that survives tab hibernation\n\n Implement metadata extraction on video load\n\n Add signature verification overlay UI\n\nCritical Questions to Resolve:\n\n How to handle video seeks/rewinds in payment calculation?\n\n What NWC permissions scope is needed?\n\n How to persist partially watched payment state?\n\n What's the fallback for non-Nostr users?\n\nExample Payment Metadata Structure:\n\ntypescript\ninterface VideoPaymentTags {\n version: '0.1';\n creator: string; // npub\n rate: number; // sats per minute\n boostAddresses: {\n primary: string;\n secondary?: string;\n };\n signature: string; // NIP-07 signed video hash\n createdAt: number; // UNIX timestamp\n}\n\nThis 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.\n\n\nThe nostr stuff isn't added yet, but that's where it's headed.",
"sig": "8adeacd1dd19de1b4c8a84b6d4fc35c0e374bd46efaa837126eebe316d5ae3214be9126584ad02a76b946002b0beb804d20dd5fbb36020a233c4e4e26cb2243d"
}