📁

### Drag & drop files here

or click to select files

#### Uploading...

✖
0% 0 MB/s --:--
Announce to DHT Store in Blossom

### Recent Uploads

No recent uploads

## Server Stats

### 🚀 Gateway API

⚪

Total Files: 0

Storage Used: 0 MB

Downloads Served: 0

### 🌸 Blossom Server

⚪

Blobs Stored: 0

Blob Storage: 0 MB

Requests Today: 0

### 🕸️ DHT Node

⚪

Network Peers: 0

Torrents Seeding: 0

Announces Today: 0

### 📡 BitTorrent Tracker

⚪

Active Torrents: 0

Connected Peers: 0

Seeders/Leechers: 0/0

### System Information

Mode: unified
Uptime: --
Total Storage: 0 MB
Active Connections: 0

### 📊 Real-Time Performance

Response Time
--
Requests/Second
--
CPU Usage
--
Memory
--
Goroutines
--
GC Pause
--

### 🎥 Video Streaming Analytics

Active Streams
--
Total Bandwidth
--
HLS Requests Today
--
Avg Bitrate
--
Concurrent Viewers
--
Transcoded Files
--
Failed Transcodes
--

### 🔄 P2P Network Health

Health Score
--
Active Peers
--
Seeding Ratio
--
Bandwidth In
--
Bandwidth Out
--
Total Shared
--
Pieces Shared Today
--

### 🌐 DHT Network

Status
🔴
Routing Table
--
Announced Torrents
--

### 📊 Tracker Stats

Status
🔴
Torrents
--
Total Peers
--
Seeders
--
Leechers
--

### 📱 WebTorrent Integration

Active Connections
--
WebSeed Requests
--
Bytes Served Today
--
Avg Speed
--
Browser Clients
--
Success Rate
--

### 💾 Storage Efficiency

Dedup Ratio
--
Space Saved
--
Chunk Efficiency
--
Blob Files
--
Chunked Files
--
Total Chunks
--
Unique Chunks
--
Avg Chunk Size
--

### ⚡ System Health

Disk Usage
--
Network I/O
--
Open Files
--
Load Average
--
FFmpeg Status
--
Transcode Queue
--
Transcode Storage
--

## My Files Dashboard

0
Files
0 MB
Storage Used
Coming Soon
Account limits & quotas
Storage Limit
Never
Last Login

No files uploaded yet.

Loading files...

## ⚡ BitTorrent Gateway

Decentralized Content Distribution with Nostr Integration

### What This Platform Does

The BitTorrent Gateway is a next-generation content distribution system that combines the reliability of traditional web hosting with the power of peer-to-peer networks, automatic video transcoding, and decentralized social discovery through Nostr. It automatically chooses the best way to store, process, and distribute your files:

📄
Small Files (<100MB)

Stored as blobs for instant access and immediate availability

→
🧩
Large Files (≥100MB)

Automatically chunked into 2MB pieces with torrent + DHT distribution

→
🎬
Video Processing

Automatic H.264/AAC transcoding for universal web compatibility

#### Why This Approach Works

🚀
Always Available: Files are instantly accessible via WebSeed, with P2P peers providing additional bandwidth
🌐
Scales Automatically: Popular files get more peers, reducing server load naturally
🔒
Censorship Resistant: Content announced on Nostr can't be taken down by any single party
💰
Cost Effective: P2P distribution reduces bandwidth costs for large files
🎬
Universal Video Playback: Automatic transcoding ensures videos play in any browser

### 🌟 How Nostr Integration Works

Nostr (Notes and Other Stuff Transmitted by Relays) is a decentralized protocol that enables censorship-resistant social networking. Here's how we integrate it for content distribution:

1

##### Content Upload

You upload a file using your Nostr identity (no email or passwords needed)

↓
2

##### Automatic Processing

System creates torrents, transcodes videos to web formats, generates magnet links, and sets up WebSeed URLs

↓
3

##### Nostr Announcement

File metadata is broadcast to Nostr relays as a structured event

↓
4

##### Social Discovery

Other users can discover, comment on, and share your content through Nostr clients

#### Benefits of Nostr Integration:

- No Central Control: Content discovery happens through the distributed Nostr relay network
- Social Features: Users can comment, react, and share content using any Nostr client
- Network Effects: Content spreads naturally through social connections
- Privacy: You control your identity and data through cryptographic keys
- Interoperability: Works with existing Nostr apps and clients

#### Example Nostr Event:

    {
      "kind": 2003,
      "content": "New torrent: example-video.mp4",
      "tags": [
        ["title", "Example Video"],
        ["x", "d1c5a0f85a4e4f3d8e7d8f9c6b5a4e3f2d1c0b9a8e7d6f5c4b3a2e1d0c9b8a7f6"],
        ["file", "example-video.mp4", "157286400"],
        ["magnet", "magnet:?xt=urn:btih:..."],
        ["webseed", "https://gateway.example.com/api/webseed/..."],
        ["blossom", "sha256_blob_hash"],
        ["stream", "https://gateway.example.com/api/stream/hash"],
        ["hls", "https://gateway.example.com/api/stream/hash/playlist.m3u8"],
        ["duration", "3600"],
        ["video", "1920x1080", "30fps", "h264"],
        ["m", "video/mp4"],
        ["t", "torrent"],
        ["t", "video"],
        ["t", "streaming"],
        ["tcat", "video,streaming"]
      ]
    }

This event gets distributed across Nostr relays, allowing anyone subscribed to file announcements to discover new content.

### How It Works

#### 📡 P2P Coordination

The system features a sophisticated P2P coordinator that manages all networking components, providing unified peer discovery, smart peer ranking, load balancing, and health monitoring across tracker, DHT, and WebSeed sources.

#### 🎯 Built-in BitTorrent Tracker

Includes a full BitTorrent tracker with advanced features:

- Client Compatibility: Optimized for qBittorrent, Transmission, WebTorrent, Deluge, uTorrent
- Abuse Prevention: Advanced detection and rate limiting systems
- Geographic Optimization: Proximity-based peer selection for faster transfers

#### 🔄 WebSeed Implementation (BEP-19)

Advanced WebSeed features for guaranteed availability:

- LRU Caching: Intelligent piece caching with configurable size limits
- Concurrent Optimization: Prevents duplicate loads, manages request limits
- Standards Compliant: Full BEP-19 specification support

#### 🌊 File Processing Pipeline

1
Upload & Analysis

File received, SHA-256 hash calculated, size analysis determines storage strategy

2
Storage & Processing

Small files stored as blobs, large files chunked, videos queued for transcoding

3
P2P Announcement

Content announced to DHT network and Nostr relays for discovery

4
Immediate Availability

Content immediately available via WebSeed, P2P peers join over time

### Key Features

🚀

#### Intelligent Content Distribution

Automatic selection between blob storage and BitTorrent based on file size, with WebSeed fallback ensuring 100% availability

🌐

#### Multi-Protocol Support

Full BitTorrent protocol, WebSeed (BEP-19), DHT, and Nostr integration for comprehensive P2P networking

🔒

#### Production-Ready Security

Multi-layer rate limiting, advanced abuse detection, input sanitization, and comprehensive security headers

📊

#### Comprehensive Monitoring

Real-time P2P health monitoring with 0-100 scoring system, performance metrics, and automatic alerting

🎯

#### BitTorrent Client Compatibility

Optimized for popular clients with client-specific adjustments and proper announce intervals

⚡

#### Smart Caching & Optimization

LRU caching system, concurrent processing, geographic peer selection, and connection pooling

🎬

#### Automatic Video Transcoding

Background H.264/AAC conversion with priority queuing, progress tracking, and smart serving

### System Architecture

#### 🚀 Gateway Server (Port 9877)

Main API server with WebSeed implementation, smart proxy for chunked content reassembly, advanced LRU caching system, video transcoding engine, and comprehensive security middleware.

WebSeed (BEP-19) • Video Transcoding • Rate Limiting • Abuse Prevention

#### 🌸 Blossom Server (Port 8082)

Content-addressed blob storage with Nostr protocol compatibility, SHA-256 addressing, and direct storage for files under 100MB.

Nostr Compatible • Content Addressing • Efficient Blob Storage

#### 🕸️ DHT Node (Port 6883)

Full Kademlia DHT implementation with bootstrap connectivity to major networks, automatic torrent announcement, and peer discovery.

Distributed Peer Discovery • Bootstrap Networks • Announce

#### 📡 Built-in BitTorrent Tracker

Full announce/scrape protocol support, client compatibility optimizations, abuse detection, and peer management with geographic proximity selection.

Multi-Client Support • Abuse Detection • Smart Peer Selection

#### 🎯 P2P Coordinator

Unified management of all P2P components, smart peer ranking algorithm, load balancing across sources, and comprehensive health monitoring.

Unified Discovery • Smart Ranking • Health Monitoring

### API Reference

#### Core API Endpoints

POST `/api/upload` Upload files with intelligent storage routing
GET `/api/download/{hash}` Download files by hash (range requests supported)
GET `/api/torrent/{hash}` Get .torrent file for BitTorrent clients
GET `/api/stats` Overall system statistics
GET `/api/p2p/stats` Detailed P2P statistics
GET `/api/health` Component health status
GET `/api/users/me/files/{hash}/transcoding-status` Video transcoding progress and status

#### WebSeed & P2P Endpoints

GET `/api/webseed/{hash}` WebSeed endpoint for BitTorrent clients (BEP-19)
GET `/api/webseed/health` WebSeed health check and cache statistics
GET `/api/diagnostics` Comprehensive system diagnostics

##### WebSeed Features:

- ✅ BEP-19 compliant WebSeed implementation
- ✅ Advanced LRU piece caching
- ✅ Concurrent request optimization
- ✅ Client-specific optimizations
- ✅ Range request support

#### Blossom Protocol Endpoints

PUT `/upload` Upload blob to Blossom server
GET `/{hash}` Download blob by SHA-256 hash
GET `/info` Server information and capabilities

#### BitTorrent Tracker Endpoints

GET `/announce` BitTorrent announce endpoint for peer discovery
GET `/scrape` BitTorrent scrape endpoint for torrent statistics

##### Tracker Features:

- ✅ Built-in tracker eliminates external dependencies
- ✅ Always includes gateway as WebSeed peer
- ✅ Supports both compact and dictionary peer formats
- ✅ Automatic peer cleanup after 45 minutes
- ✅ Full BitTorrent protocol compliance

### Technical Implementation

#### Intelligent Storage Strategy

Files under 100MB stored as blobs for immediate access. Larger files automatically chunked into 2MB pieces with BitTorrent-compatible structure for parallel transfers.

#### Advanced P2P Coordination

Sophisticated peer ranking algorithm considering geographic proximity (30%), source reliability (25%), and historical performance (20%) for optimal peer selection.

#### Production-Grade Performance

LRU piece caching, concurrent request handling, connection pooling, and comprehensive health monitoring with automatic alerting systems.

#### Multi-Client Optimization

Built-in tracker with client detection and specific optimizations for qBittorrent, Transmission, WebTorrent, and other popular BitTorrent clients.

### Supported Protocols & Standards

HTTP/1.1 Range Requests BitTorrent Protocol WebSeed (BEP-19) HLS Streaming H.264/AAC Transcoding Blossom Protocol Nostr (NIP-35) Kademlia DHT
×

## Login with Nostr

#### Need a Nostr Extension?

🌐 Chrome / Edge / Brave:

- Alby - Most popular, supports Lightning
- nos2x - Simple and lightweight

🦊 Firefox:

- nos2x-fox - Firefox version of nos2x
- Alby - Also available for Firefox

#### Remote Signer (NIP-46)

×

## Share File

###

×

## File Details

###

File Size:
Storage Type:
Upload Date:
File Hash:
Access Level:
×

## Create Nostr Account

#### What is Nostr?

Nostr is a decentralized protocol that gives you control over your digital identity. Unlike traditional accounts, there's no company storing your data or controlling your access.

#### How it works:

- No passwords - You get a pair of cryptographic keys instead
- You own your identity - No one can delete or suspend your account
- Privacy focused - We never see or store your private key
- Works everywhere - Same identity across all Nostr apps

#### Your Keys Explained:

🔓 Public Key (npub):

Like your username - safe to share publicly. Others use this to find you.

🔐 Private Key (nsec):

Like your password but MORE IMPORTANT - never share this! It proves you own your identity.

#### ⚠️ IMPORTANT SECURITY NOTICE

Your private key is generated in your browser and never sent to our servers. You MUST save it securely - if you lose it, your account cannot be recovered!

#### Your New Nostr Keys

🔓 Public Key (share this):
🔐 Private Key (SAVE THIS SECURELY!):

#### Save Your Private Key Now!

Write down your private key (nsec) and store it safely. Recommended methods:

- ✅ Password manager (1Password, Bitwarden, etc.)
- ✅ Written on paper stored securely
- ✅ Encrypted text file
- ❌ Screenshot or unencrypted file
- ❌ Cloud storage without encryption

#### Next Step: Install a Browser Extension

To use your new Nostr keys, you'll need a browser extension:

🌐 Chrome / Edge / Brave:

- Alby - Most popular, supports Lightning
- nos2x - Simple and lightweight

🦊 Firefox:

- nos2x-fox - Firefox version of nos2x
- Alby - Also available for Firefox

After installing: Import your private key (nsec) into the extension, then come back here to login!

### Share File

####