How vardhin/torrentchain works
Project Type and Purpose
• This is a full-stack, decentralized file-sharing and versioning system (“Torrent Chain”) combining:
• A Svelte-based SPA frontend
• Multiple backend microservices (Node.js and Go)
• IPFS/IPNS as the storage layer
• A local Ethereum testnet (Ganache) + smart contracts for reputation/version control
• The goal is to manage and version torrent files in a purely decentralized fashion, with reputation anchored on-chain.
File Structure Analysis
• Top-level directories:
• frontend/ — Svelte UI (routes, components, styling)
• main_backend/ — Node.js service for encryption, WebTorrent, upload management
• ipfs-go-server/ — Go service exposing IPFS/IPNS operations via HTTP
• blockchain/ — Express server + Truffle smart contract for IPNSRegistry on Ganache
• Each directory contains its own package/dependency manifest and entrypoint:
• frontend: package.json, svelte.config.js, vite.config.js
• main_backend: index.js, encryption.js, torrentService.js
• ipfs-go-server: cmd/main.go, internal/handlers, internal/ipfs, models, storage
• blockchain: server.js, migrations/, contracts/, truffle-config.js
• External dependencies:
• IPFS daemon (must be running)
• Ganache local Ethereum node
• MetaMask in the browser for signing transactions
Key Architecture Insights from README
• Tech Stack: Svelte (frontend) | Node.js + Go (backends) | IPFS & IPNS (storage) | WebTorrent (P2P transfer) | Ethereum/Ganache (blockchain)
• Interaction flow:
1. User signs transactions (MetaMask) → blockchain express server → deploy/invoke IPNSRegistry contract
2. Files uploaded/encrypted → main_backend service → IPFS daemon (via ipfs-go-server) + torrent creation/seeding (WebTorrent)
3. Frontend requests content / metadata from backends and renders dynamically