⚑ BitTorrent Gateway

πŸ“

Drag & drop files here

or click to select files

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

unified
--
0 MB
0

My Files Dashboard

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

No files uploaded yet.

⚑ 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 and decentralized social discovery through Nostr. It automatically chooses the best way to store 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

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

🌟 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, 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": 1063,
  "content": "New file: example-video.mp4",
  "tags": [
    ["magnet", "magnet:?xt=urn:btih:..."],
    ["size", "157286400"],
    ["name", "example-video.mp4"],
    ["webseed", "https://gateway.example.com/api/webseed/..."],
    ["mimetype", "video/mp4"]
  ]
}

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 & Distribution

Small files stored as blobs, large files chunked and torrents created

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

System Architecture

πŸš€ Gateway Server (Port 9877)

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

WebSeed (BEP-19) β€’ 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

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 Blossom Protocol Nostr (NIP-35) Kademlia DHT