Technical Documentation

dStream Runtime Docs (Production Path)

Updated reference for the current stack: Nostr identity, WHIP/WHEP/HLS media path, P2P assist policy controls, and wallet-integrated payment flows.

Getting Started
Step 1

Watch

Open `/browse` or home cards, then watch from `/watch/:npub/:streamId` with WHEP-first and HLS fallback.

Step 2

Connect Identity

Use extension or local key in Settings. Canonical stream identity is `(pubkeyHex, streamId)`; UI routes are npub-first.

Step 3

Go Live

Open `/broadcast`, start preview, publish over WHIP, and confirm announce relay acceptance.

Step 4

Verify Economics

Run verified Monero tip/stake flow and confirm wallet-rpc session status from watch page.

Runtime Architecture

Identity + Coordination

Nostr relays carry announce, moderation, presence, profile, and DM/whisper signaling.

Media Origin

WHIP ingest to MediaMTX, remux to HLS, expose WHEP endpoints, maintain origin fallback.

Assist Transport

WebRTC datachannel assist can offload HLS delivery when host policy and stake conditions allow.

Payments

Monero wallet-rpc for verified flows; additional asset methods exposed as addresses + wallet URI hints.

Protocol Landscape

dStream

Nostr identity/discovery + WHIP/WHEP/HLS media stack + optional WebRTC assist queue (`host_only` vs `p2p_economy`) + Monero verified payment backend.

zap.stream

NIP-53-focused Nostr client with Lightning/Zap ecosystem alignment and a host/CDN-style media path centered around HLS/RTMP workflows.

Detailed comparison notes are maintained in repository docs:docs/COMPETITIVE_DELTA.md

Nostr Event Surface

KindPurposeNotes
30311Stream announceReplaceable live metadata (`d`, `title`, `streaming`, host mode, discoverability, payment methods).
30312PresenceViewer heartbeat and participation estimates.
30313Moderation / rolesRelay-scoped mute/block + moderator/subscriber role updates.
30321Discovery moderationOperator hide/restore actions for official app discovery surfaces only.
1Public chatStream-associated public text events.
4 / 20004DM / whisperPrivate encrypted channels for broadcaster/viewer coordination.

HTTP/API Surface

RouteRoleAuth / Guard
/api/whip/:originStreamId/whipWHIP ingest proxySigned publisher path expected upstream.
/api/whep/:originStreamId/whepWHEP playback proxyPublic read; guarded by origin policy.
/api/hls/:originStreamId/*HLS passthroughPublic read with edge cache compatibility.
/api/xmr/tip/session(/:token)Verified tip lifecycleSigned control requests.
/api/xmr/stake/session(/:token)Stake gate + refund lifecycleSigned control requests.
/api/xmr/escrow/session/*Escrow-v3 multisig orchestrationCoordinator/participant scoped actions.
/api/payments/catalogAsset + wallet integration metadataPublic read.
/api/payments/validateServer-side payment method validatorSchema guard only.
/api/moderation/reportsAbuse report intake + operator queue actionsSigned report/operator proof scopes.

Wallet Integration Workflow

  1. Configure payout methods in Broadcast (core fields + advanced payout section).
  2. Set preferred wallet per asset from Settings wallet integration panel.
  3. Watchers use copy/URI actions on watch page to pay with native app, extension, or CLI workflow.
  4. For XMR verification, viewers request a dedicated subaddress and check on-session status.

Safety & Reporting

  1. In-app report controls are available on browse cards, watch header, and chat messages.
  2. Operators review report queue items in Moderation and can mark state transitions.
  3. Confirmed abuse can be hidden from official discovery surfaces without changing decentralized relay history.
  4. Policy URLs for app review: /terms, /privacy, /community-guidelines.
Production Gate
npm run harden:deploy -- .env.production
npm run smoke:external:readiness
npm run smoke:prod:runtime
npm run gate:prod -- .env.production

Known Failure Modes

HLS `404` on `/api/hls/.../index.m3u8`
Cause: Origin stream not live yet, stale streamId, or old announce record.
Action: Re-open watch using current live announce and verify `/api/dev/log` + MediaMTX path list.
WHEP timeout waiting for remote track
Cause: Publisher not sending media, ICE/TURN path mismatch, or origin path mismatch.
Action: Check WHIP publish success, TURN env values, and exact originStreamId mapping.
Announce relay warning
Cause: Media is live but relay publish failed or partially failed.
Action: Use `Update Announce`, inspect relay statuses, and validate configured relay URLs.

Primary Reading

Trust Boundaries
  • P2P assist reduces host load but does not remove origin bootstrap/fallback requirements.
  • Wallet integration never stores private keys; key material stays in user-controlled wallet software.
  • Escrow-v3 is multisig workflow coordination, not a trustless smart-contract VM.
  • Canonical routing is `(pubkeyHex, streamId)`; UI keeps npub-first addressing for users.
  • Content responsibility is node-local: independent operators are responsible for what they broadcast/relay; dStream does not control third-party content.