Introduction
Project Name: CDN-pi
Name of the organization or individual submitting the proposal:
Kanu Juliet.
I worked as a Backend Developer on [Loteraa]( GitHub - Loterra1/loteraa-smart-flow · GitHub ), a decentralized IoT platform, where I built a scalable backend using Node.js (Express) and designed a PostgreSQL database to efficiently manage users, devices, and high-volume IoT data. I developed secure RESTful APIs, implemented authentication, and optimized queries for performance and reliability
Project Description
Describe your project.
CDN-pi is a content delivery network purpose-built for media streaming, using Sia’s Indexd as its primary storage and retrieval layer. It enables creators and platforms to stream video over censorship-resistant, decentralized infrastructure without dependence on centralized CDN providers such as Cloudflare Stream, Bunny.net, or AWS CloudFront.
Architecture Overview
```
[Source Video]
|
v
[Transcoder FFmpeg]
| Produces HLS segments (.ts files) and playlists (.m3u8)
| at three quality tiers: 360p / 720p / 1080p
v
[Indexd SDK Go]
| Uploads each .ts segment and .m3u8 playlist
| as discrete Indexd objects to the Sia network.
| Returns an object ID per file, stored in metadata DB.
v
[Sia Network]
| Stores segments across 30+ hosts
| Reed-Solomon erasure coding (10-of-30 shards required)
| ChaCha20 encryption at rest
v
[Edge Server]
| Generates and serves .m3u8 playlists dynamically
| from metadata DB (no live Indexd query per request)
| LRU in-memory cache → local disk cache → Indexd fetch on miss
| Pre-fetches first 5 segments on stream start to hide retrieval latency
v
[HLS-Compatible Video Player]
Playback via HLS.js (browser), Safari (native),
or ExoPlayer (Android) with adaptive bitrate switching
```
What is the high-level architecture overview for the grant? What security best practices are you following?
1. Indexd as the storage layer (not renterd directly)
Indexd abstracts all contract lifecycle management, wallet maintenance, host selection, slab repair, and background pruning. Using the Go SDK for all upload and download operations means the CDN operator does not need to manage renterd internals. This also directly aligns with the Foundation’s current grant focus.
2. HLS (HTTP Live Streaming) segment format
Each HLS segment is a discrete, bounded file (~6 seconds, 13 MB at 720p) that maps cleanly to a single Indexd object. Sia’s underlying retrieval API supports HTTP Range requests, enabling seek and scrub operations within a segment. HLS has the widest device compatibility: iOS Safari (native), Android via ExoPlayer, and desktop via HLS.js.
3. Adaptive Bitrate (ABR) streaming
FFmpeg produces three quality tiers per video. The edge server generates a master `.m3u8` referencing variant playlists per tier. Players dynamically switch quality based on real-time bandwidth availability. Each tier’s segments are stored as separate Indexd objects and tracked independently in the metadata database.
4. Segment metadata database
A lightweight PostgreSQL database maps `(video_id, quality_tier, segment_sequence)` → `indexd_object_id`. This allows the edge server to generate playlists instantly without querying Indexd per request.
5. Edge caching and latency management
Sia retrieval requires coordinating erasure-coded shards across distributed hosts first-fetch latency is higher than traditional CDNs. CDN-pi addresses this with three mechanisms:
*Pre-fetch: On stream start, the edge server requests the first 5 segments from Indexd before the player asks for them.
- Two-tier cache: Hot segments (active streams) are held in an LRU in-memory cache; warm segments (last 24h) are held on local disk.
- Player buffer: HLS.js is configured to maintain a 20-second forward buffer before beginning playback, absorbing retrieval variance without stalling.
6. Siacoin payments
Uploaders fund their storage by topping up an SC wallet managed by their Indexd instance. The edge server enforces a balance gate before accepting new uploads. All payment and contract formation is handled by Indexd automatically.
What security best practices are you following?
CDN-pi follows several security practices across its stack. All content stored on Sia is encrypted at rest using ChaCha20 via Indexd the edge server never holds unencrypted source files. Indexd app keys are scoped per application and stored as environment variables, never hardcoded.
The edge server exposes no direct write endpoints to the public; uploads are gated behind Siacoin balance verification. Input validation is enforced on all accepted video formats before transcoding begins, preventing malformed files from reaching the pipeline. Dependencies are pinned to specific versions and will be audited before each milestone release. The project will be released under the MIT License with a public repository, allowing open community review of the codebase.
How does the projected outcome serve the Foundation’s mission of user-owned data?
Centralized video CDNs are among the most consequential points of content control on the internet. Platforms can and routinely do remove, restrict, or throttle content unilaterally. Creators have no recourse.
CDN-pi makes user ownership of video concrete and operational: once a creator’s HLS segments are on the Sia network, their content is accessible as long as their storage contracts are funded. No platform intermediary can remove it. Any edge server with access to the same Indexd instance can serve the stream.
Beyond individual creators, CDN-pi demonstrates that Indexd is capable of powering latency-sensitive, real-time applications not just archival storage. This expands the perceived scope of what the Sia ecosystem can power, directly supporting developer and ecosystem growth. All code will be released under the MIT License (OSI-compliant) and documented for other developers to build on.
Compliance & Eligibility
Are you a resident of any jurisdiction on the FATF/OFAC restricted list?
No
Will your payment bank account be located in any jurisdiction on that list?
No
Budget
Amount of money requested and justification with a reasonable breakdown of expenses:
Total requested: $9,500 USD
| Item | Cost (USD) |
|---|---|
| Developer fees | $9,000 |
| Infrastructure (2 edge server VMs × 3 months + SC for testnet contracts) | $500 |
| Total | $9,500 |
| The Foundation can pay in USD via ACH or wire. |
Milestones
| Milestone | Description | Deliverable | Estimated Completion |
|---|---|---|---|
| 1 | Indexd integration + upload pipeline | Go library: accepts source video, transcodes to HLS via FFmpeg, uploads all segments and playlists to Sia via Indexd Go SDK. Segment object-ID mapping stored in PostgreSQL. MIT-licensed public repository. | month 1 |
| 2 | Edge server playlist serving, cache layer, and adaptive bitrate support | HTTP server serving `.m3u8` playlists from metadata DB; `.ts` segments served from LRU in-memory cache, local disk cache, or Indexd fetch on miss. Pre-fetch pipeline warming first 5 segments on stream start. Master playlist with 3 quality tiers (360p / 720p / 1080p). Browser demo via HLS.js. Deployable via Docker. | month 2 |
| 3 | Siacoin payment integration + documentation | SC wallet top-up flow; balance-gated upload enforcement. End-to-end latency benchmarks (cold vs. warm retrieval) published. Operator setup guide, API reference, and walkthrough video of a full upload-to-stream flow. | month 3 |
Target Users
-
Decentralized platforms and dApps:
Web3 protocols, DAOs, and decentralized social networks that require a trustless, non-custodial video delivery layer integrated into their existing on-chain or off-chain stack. These are engineering teams building platforms who need media infrastructure with no single point of control, no vendor lock-in, and deterministic storage costs denominated in SC. -
CDN operators and self-hosters:
Systems engineers and small infrastructure providers who want to operate their own Indexd-backed edge node, either serving their own content or offering bandwidth-as-a-service to third parties. CDN-pi ships as a Docker image with a configurable LRU cache size, pre-fetch depth, and Indexd endpoint — making it deployable on any VPS or bare-metal server with minimal operational overhead. -
Sia ecosystem developers:
CDN-pi’s open-source codebase serves as a production reference implementation for developers building throughput-intensive applications on Indexd. The segment upload pipeline, object-ID metadata layer, and cache-miss retrieval logic are all directly reusable patterns for any application that needs more than archival-grade access to Sia-stored data.
What are your plans for this project following the grant?
Following the successful completion of this grant, CDN-pi is planned to grow in three directions:
1. Multi-operator edge network
The current grant scope covers a single operator running their own edge server. The next phase introduces a federated model: any individual or organization can run a CDN-pi edge node, registering it in a shared directory. Content requests are routed to the geographically nearest available node, reducing latency globally. Node operators are compensated in Siacoin proportional to bandwidth served creating an incentive layer that grows the network without centralized infrastructure investment.
2. Live streaming support
The current architecture handles video-on-demand (pre-uploaded content). A future phase will extend CDN-pi to support low-latency live streaming using HLS’s Low-Latency HLS (LL-HLS) extension. Incoming live segments from a broadcaster would be uploaded to Sia via Indexd in near real-time (24 second segment duration), with edge servers configured for aggressive pre-fetching to minimize end-to-end stream delay to under 10 seconds.
3. Creator-facing web platform
Rather than requiring technical setup, a future release would provide a simple web dashboard where creators connect their Sia wallet, upload or link a video source, and receive a shareable embed link similar to Vimeo or Cloudflare Stream, but fully non-custodial. The platform would surface storage costs in SC, contract status, and stream analytics. This would be the primary interface for non-technical users and the main driver of real-world adoption.
Potential Risks That Could Affect the Outcome
| Risk | Mitigation |
|---|---|
| Indexd API breaking changes Indexd is in active development and may introduce breaking changes during the grant period. | Pin to a specific Indexd SDK version at project start. Monitor the Sia Foundation changelog and allocate buffer time in each milestone for compatibility updates. |
| Sia host retrieval latency Cold segment retrieval from distributed hosts may exceed acceptable streaming thresholds on low-traffic content. | The two-tier cache (memory + disk) and 5-segment pre-fetch pipeline are specifically designed to absorb this variance. Benchmarks in Milestone 3 will quantify worst-case latency and inform any further tuning. |
| Siacoin price volatility A significant drop in SC value could erode the infrastructure budget mid-grant. | Infrastructure costs ($500) are modest and fixed in USD terms. Storage contract costs on testnet are negligible and do not depend on SC market price. |
| FFmpeg transcoding complexity Multi-tier ABR transcoding pipelines can introduce unexpected edge cases with certain video codecs or container formats. | Scope Milestone 1 to a well-defined set of input formats (H.264/AAC in MP4 and MKV containers), explicitly documented in the repository. Exotic formats are out of scope for this grant. |
Development Information
Will all of your project’s code be open-source?
Yes
Leave a link where your code will be accessible for review
Do you agree to submit monthly progress reports?
Yes
Contact
Email: [email protected]