Standard Grant: Sia Live Archive

Introduction

Project Name: Sia Live Archive β€” Live-to-Archive Recording Library for indexd

Name of the organisation or individual submitting the proposal: Jules Lai (Fabstir)


Describe your project

sia-live-archive is a standalone TypeScript/JavaScript library that enables browser-based live recording with real-time archival to Sia via indexd. Developers can npm install the library and integrate live-to-archive recording into any web application.

Use case: A musician performs a live concert, recording from their phone or laptop browser. As they perform, video chunks upload directly to Sia hosts via indexd. When the concert ends, the complete recording exists permanently on Sia β€” owned by the creator, not a platform.

Additional use cases:

  • Live event archiving for journalists and citizen reporters
  • Educational content creators recording lectures
  • Streamers archiving to decentralised storage
  • Video podcasters recording episodes
  • Historical documentation and cultural preservation

What it is:

npm install @fabstir/sia-live-archive
import { SiaLiveArchive } from '@fabstir/sia-live-archive';

const recorder = new SiaLiveArchive({
  indexdEndpoint: 'https://indexd.example.com',
  appPassword: 'your-app-password',
  chunkDuration: 5000,  // configurable chunk size in ms
  maxRetries: 3,        // retry attempts per chunk
  onProgress: (progress) => console.log(progress),
  onChunkUploaded: (metadata) => console.log('Chunk uploaded:', metadata),
  onChunkError: (error, chunkIndex) => {
    // Handle failed chunk - retry, abort, or queue for later
    console.error(`Chunk ${chunkIndex} failed:`, error);
  },
  onError: (error) => console.error(error)
});

// Start recording from camera
await recorder.start({ video: true, audio: true });

// Chunks automatically upload to Sia via indexd during recording
// Each chunk's metadata is collected for archive assembly

// Stop and get archive manifest (contains all chunk metadata for retrieval)
const archive = await recorder.stop();
console.log(archive.manifest);  // Complete metadata for all chunks
console.log(archive.duration);  // Total recording duration
console.log(archive.chunks);    // Number of chunks uploaded

// Store archive.manifest for later playback retrieval

Technical approach:

Camera/Microphone
        ↓
Browser MediaRecorder API
        ↓
Video chunks (WebM/MP4)
        ↓
sia-live-archive library
        ↓
indexd SDK (direct P2P to Sia hosts)
        ↓
Sia Storage (permanent archive)

Why indexd?

indexd enables direct peer-to-peer uploads to Sia hosts without proxying through a middleman. This is essential for real-time recording where chunks must be uploaded continuously during capture. The indexd SDK handles contract management and repairs in the background whilst the library focuses on recording and uploading.

Metadata handling:

The indexd SDK returns metadata for each uploaded chunk, which is required for later retrieval. The sia-live-archive library will:

  • Collect metadata from each chunk upload during recording
  • Assemble chunk metadata into a complete archive manifest
  • Provide the manifest to the application for persistent storage
  • Use the manifest to retrieve and reassemble chunks for playback

Archive lifecycle (record β†’ retrieve):

1. RECORD     β†’ recorder.start() captures video/audio
2. UPLOAD     β†’ Chunks upload to Sia via indexd in real-time
3. MANIFEST   β†’ recorder.stop() returns archive.manifest
4. STORE      β†’ Application persists manifest (database, file, etc.)
5. RETRIEVE   β†’ Load manifest, fetch chunks from Sia
6. PLAYBACK   β†’ Reassemble chunks into playable video

Platform support:

  • Desktop browsers (Chrome, Firefox, Edge) β€” full support
  • Android mobile browsers β€” full support
  • iOS Safari β€” supported with acknowledged limitations (MediaRecorder API constraints, WebM codec limitations)

iOS Safari compatibility notes:

Safari 18.4 (April 2025) significantly improved MediaRecorder support:

Aspect iOS Safari Behaviour Mitigation
Codec support Now supports WebM (VP8/VP9), MP4 (H.264, HEVC, AV1), fMP4 Detect browser and use appropriate codec
Audio codecs Opus, AAC, ALAC, PCM supported Feature detection for optimal format
Buffer sizes May be narrower than desktop Smaller chunk sizes on iOS if needed
Background recording Stops when app backgrounded Document limitation, user guidance
MediaRecorder API Mature since Safari 18.4 Feature detection with graceful fallback

Dependencies:

  • @siafoundation/indexd-js β€” official indexd SDK
  • No Web3 wallet or NFT dependencies
  • No framework dependencies (works with React, Vue, vanilla JS, etc.)

indexd references:


Who benefits from your project?

  • Sia/indexd Developers: First media-focused library for indexd, providing reference implementation for browser-first applications
  • Application Builders: Any JavaScript developer can npm install and integrate live recording
  • Content Creators: Musicians, streamers, educators, journalists can own their recordings
  • The Sia Ecosystem: Demonstrates indexd’s capabilities for real-time media workloads, contributing to ecosystem adoption

How does the project serve the Foundation’s mission of user-owned data?

This directly enables user-owned media:

  1. Creator-owned recordings: Users own their recordings on Sia, not YouTube or Twitch
  2. No platform dependency: Recordings exist permanently on decentralised storage
  3. Direct-to-Sia: Uses indexd’s P2P architecture β€” no middleman ever holds the data
  4. Uncensorable archives: Live events preserved without platform gatekeepers

Additionally:

  • Developer accessibility: Any JavaScript developer can npm install and integrate
  • Demonstrates indexd: First media-focused library for indexd, proving its value for real-time workloads
  • Ecosystem growth: Reusable infrastructure for the Sia developer community

Jurisdiction Compliance

Are you a resident of any jurisdiction on that list? No

Will your payment bank account be located in any jurisdiction on that list? No


Grant Specifics

Amount of money requested and justification with a reasonable breakdown of expenses

Total Amount Requested: $30,000 USD

Milestone Description Budget (USD)
Milestone 1 Core Library & MediaRecorder Integration $7,500
Milestone 2 indexd Integration & Error Handling $7,500
Milestone 3 Cross-browser Testing & Archive Assembly $7,500
Milestone 4 Demo Application, Documentation & npm Publishing $7,500
Total $30,000

Detailed budget breakdown:

Category Allocation Description
Core development $16,500 (55%) Library architecture, MediaRecorder wrapper, indexd integration, chunk management
Testing & QA $6,000 (20%) Unit tests, integration tests, cross-browser testing, mobile testing
Documentation & demo $4,500 (15%) API reference, usage guide, demo application
Contingency $3,000 (10%) Buffer for indexd integration challenges or browser-specific issues

Justification:

  • Proven delivery record: Enhanced S5.js completed 25% ahead of schedule, 10.6Γ— under bundle size requirement
  • Previous Fabstir Media Player grant delivered successfully
  • London-based development costs
  • Senior-level expertise in media systems and distributed storage
  • 4-month timeline provides buffer for early SDK adoption and cross-browser testing

What is the high-level architecture overview for the grant? What security best practices are you following?

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Any Web Application                         β”‚
β”‚  (Fabstir, or any TypeScript/JavaScript app)            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β”‚ npm install @fabstir/sia-live-archive
                          β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              sia-live-archive library                    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ MediaRecorder   │───▢│ Chunk Manager               β”‚ β”‚
β”‚  β”‚ Wrapper         β”‚    β”‚ - Configurable chunk size   β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚ - Memory-efficient buffer   β”‚ β”‚
β”‚                         β”‚ - Garbage collection        β”‚ β”‚
β”‚                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ Upload Pipeline                                     β”‚ β”‚
β”‚  β”‚ - Queue management                                 β”‚ β”‚
β”‚  β”‚ - Exponential backoff retry                        β”‚ β”‚
β”‚  β”‚ - Progress events                                  β”‚ β”‚
β”‚  β”‚ - Atomic chunk commits                             β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ Archive Manager                                     β”‚ β”‚
β”‚  β”‚ - Chunk metadata collection (per indexd upload)    β”‚ β”‚
β”‚  β”‚ - Archive manifest generation                      β”‚ β”‚
β”‚  β”‚ - Chunk ordering and assembly                      β”‚ β”‚
β”‚  β”‚ - Manifest storage for retrieval                   β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β”‚
                          β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              @siafoundation/indexd-js                    β”‚
β”‚  - Direct P2P upload to Sia hosts                       β”‚
β”‚  - Encrypted by default                                  β”‚
β”‚  - Contract management handled automatically             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β”‚
                          β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Sia Network                           β”‚
β”‚  - Permanent decentralised storage                      β”‚
β”‚  - Data distributed across hosts                        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Memory management:

  • Configurable chunk duration to control memory usage
  • Immediate chunk upload and release after successful transmission
  • Garbage collection hints to browser after chunk disposal
  • Maximum buffer size configuration to prevent memory exhaustion

Error handling and resilience:

  • Exponential backoff retry (configurable max retries, default 3)
  • Atomic chunk commits β€” chunks are either fully uploaded or marked for retry
  • Chunk resumption from last successful upload on connection recovery
  • Graceful degradation options for low-bandwidth environments (e.g., audio-only fallback, resolution reduction)
  • User-facing error callbacks with actionable messages

Authentication and rate limiting:

  • Secure handling of indexd appPassword
  • Respect for indexd rate limits with automatic throttling
  • Clear error states for insufficient funds or rejected chunks

Security best practices:

  • All uploads encrypted client-side before transmission (indexd default behaviour)
  • No unencrypted media passes through any intermediary
  • User controls encryption keys
  • indexd cannot access actual file data (by design)
  • No external dependencies beyond the official indexd SDK
  • Input validation on all API parameters
  • Secure communication via HTTPS/TLS for all indexd connections
  • Dependency management: using npm audit, keeping dependencies updated, minimal dependency footprint
  • Credentials never committed to version control

Timeline with measurable objectives and goals

Total Duration: 4 months (16 weeks)

Note: The timeline assumes access to indexd SDK (public or pre-release via Foundation coordination). Development can begin with available testnet/staging access, with final integration once the SDK is stable.

Milestone 1: Core Library & MediaRecorder Integration (Month 1)

Objective: Build core recording library with chunk management.

Deliverables:

Task Description Measurable Outcome
1.1 Library architecture TypeScript project setup, types, event system
1.2 MediaRecorder wrapper Camera/mic capture, configurable chunk duration
1.3 Memory management Efficient buffer handling, garbage collection, max buffer limits
1.4 Chunk manager Queue management, chunk ordering, progress events
1.5 Unit tests >90% coverage for core functionality

Milestone Success Criteria:

  • Library captures video/audio from browser
  • Chunks generated at configurable intervals
  • Memory usage remains stable during extended recording
  • Unit tests passing
  • Works on Chrome, Firefox, Edge

Milestone 2: indexd Integration & Error Handling (Month 2)

Objective: Integrate with indexd SDK and implement robust error handling.

Deliverables:

Task Description Measurable Outcome
2.1 indexd SDK integration Connection handling, authentication flow
2.2 Upload pipeline Real-time chunk upload during recording
2.3 Retry logic Exponential backoff, configurable max retries
2.4 Error handling Network recovery, insufficient funds handling, user feedback
2.5 Chunk error callbacks onChunkError with chunk index for caller-controlled recovery
2.6 Rate limiting Respect indexd limits, automatic throttling
2.7 Integration tests Tests against indexd testnet/staging

Testing approach:

  • Integration testing against local indexd instance and testnet
  • Cross-browser testing on own devices (desktop Chrome/Firefox/Edge, Android phone) and online iOS testing environments
  • Extended recording tests (30+ minutes) to validate memory management and battery impact
  • Network interruption simulation to verify retry logic

Milestone Success Criteria:

  • Chunks upload to Sia via indexd during recording
  • Retry logic handles network interruptions gracefully
  • Clear error messages for authentication/funding issues
  • Integration tests passing against indexd

Milestone 3: Cross-browser Testing & Archive Assembly (Month 3)

Objective: Comprehensive testing and archive retrieval functionality.

Deliverables:

Task Description Measurable Outcome
3.1 Archive assembly Chunk metadata collection, manifest generation, chunk ordering
3.2 Manifest storage Archive manifest format for persistent storage and retrieval
3.3 Playback verification Retrieve chunks using manifest and play archived recordings
3.4 Cross-browser testing Chrome, Firefox, Edge, Android, iOS Safari
3.5 Extended recording tests 30+ minute recordings to validate memory and performance
3.6 Performance benchmarks Upload speeds, memory usage, battery impact, network bandwidth documented

Milestone Success Criteria:

  • Complete archive retrievable and playable after recording
  • Desktop browsers fully tested
  • Android mobile browser tested and working
  • iOS Safari tested with limitations documented
  • 90% test coverage across all modules

  • Zero critical bugs
  • Performance benchmarks documented and shared with Foundation

Milestone 4: Demo Application, Documentation & npm Publishing (Month 4)

Objective: Working demo application, complete documentation, and npm publishing.

Deliverables:

Task Description Measurable Outcome
4.1 Demo application Working web app: record, upload, store manifest, playback
4.2 API documentation Complete API reference with examples
4.3 Usage guide Step-by-step developer integration guide
4.4 Code polish Final code review, cleanup, optimisation
4.5 README completion Comprehensive README with quick-start guide
4.6 npm publishing Package published to npm registry

Milestone Success Criteria:

  • Working demo application (record + playback)
  • npm package published (@fabstir/sia-live-archive)
  • Complete API documentation and usage examples
  • README with build instructions and quick-start guide

Measurable impact targets:

  • Demo application functional with <5 minute setup time (for developers familiar with npm and basic JavaScript)
  • Documentation enables first successful recording within 15 minutes (for developers familiar with npm and basic JavaScript)

Potential risks that will affect the outcome of the project

Risk Mitigation Impact Probability
indexd SDK changes during development 10% contingency budget allocated; close communication with Foundation; design for API version compatibility Medium Medium
indexd launch delays Library architecture allows for mock/stub testing; integration finalised once SDK stable Medium Low
iOS Safari MediaRecorder limitations Graceful degradation (audio-only fallback); clear user messaging; limitations documented; focus on Chrome/Firefox/Android first Low Medium
Browser memory issues with long recordings Configurable chunk sizes; immediate upload and release; max buffer limits; tested with extended recordings Medium Low
Network variability (jitter, packet loss) Exponential backoff retry; local buffering during upload; chunk reconciliation logging; out-of-order handling Medium Medium
Network interruption during recording Exponential backoff retry; atomic chunk commits; local buffering; resume capability Medium Low
Battery/CPU impact on mobile devices Configurable chunk duration to reduce upload frequency; performance profiling on mid-range devices; documentation on optimal settings Low Medium
Low-bandwidth environments Audio-only fallback option; dynamic resolution reduction; user-configurable quality settings Low Low

Post-milestone roadmap (future work)

Following successful completion of this grant, potential future enhancements include:

  • Audio-only recording mode for podcast/voice applications
  • Advanced chunking strategies (adaptive bitrate based on bandwidth)
  • HLS/DASH manifest generation for streaming playback
  • Multi-camera/multi-source recording
  • Offline-first mode with background sync

Post-grant maintenance:

  • Ongoing bug fixes and security updates via GitHub issues
  • Community contributions encouraged via beginner-friendly issue labels and contribution guidelines
  • Library will be used in production by Fabstir, ensuring continued maintenance incentive

Open-source community strategy:

  • MIT licence for maximum adoption
  • Issue templates for bug reports and feature requests
  • Good-first-issue labels to encourage community contributions (marking tasks suitable for newcomers, e.g., documentation fixes, simple enhancements)
  • Clear contribution guidelines in CONTRIBUTING.md

Storage cost transparency:

  • Documentation will include guidance on estimating Sia storage costs for recordings
  • Example cost calculations for common scenarios (e.g., 1-hour concert at 1080p)

User-generated content:

  • Library documentation will include a disclaimer that users are responsible for ensuring they have rights to record and store content
  • The library is a tool; compliance with copyright and content laws is the user’s responsibility

Development Information

Will all of your project’s code be open-source?

Yes, MIT licence.

Links where code will be accessible for review

Links

Previous work:

Do you agree to submit monthly progress reports?

Yes.


Contact info

Email: jlai [at] fabstir [dot com]

Any other preferred contact methods: Discord @jules_lai

Hi @juleslai - thank you for this proposal and the thorough breakdown.

Given a 3-month grant is a Small grant but the scope and budget (more than $10K total) are that of a Standard grant, could you revisit your timeline to allow for a more even-paced project duration? This is to ensure you have sufficient time to meet your milestones and to match our grant guidelines. I think one additional month should be enough.

And please make this revision by tomorrow at 5pm ET and tag me when it’s ready for another review.

2 Likes

Hi @mecsbecs ,

Thank you for the feedback. I’ve revised the proposal in-place to 4 months for more even pacing as you suggested:

Milestone Focus
M1 Core Library & MediaRecorder Integration
M2 indexd Integration & Error Handling
M3 Cross-browser Testing & Archive Assembly
M4 Demo Application, Documentation & npm Publishing

I’ve also added performance benchmarks (Task 3.6) to provide real-world indexd data back to the Foundation, and increased contingency to 10% given the early-adopter nature of indexd integration with more time to iron out any unknown kinks.

Ready for review. Thank you.

2 Likes