# libtorrent — High-Performance C++ BitTorrent Library > libtorrent is a feature-complete C++ implementation of the BitTorrent protocol. It powers popular clients like qBittorrent and Deluge, providing efficient peer-to-peer file transfer with extensive protocol support. ## Install Save as a script file and run: # libtorrent — High-Performance C++ BitTorrent Library ## Quick Use ```bash # Install via package manager sudo apt install libtorrent-rasterbar-dev # Debian/Ubuntu brew install libtorrent-rasterbar # macOS vcpkg install libtorrent # vcpkg # Python bindings: pip install libtorrent ``` ## Introduction libtorrent (libtorrent-rasterbar) is a C++ library implementing the BitTorrent protocol with a focus on performance and standards compliance. It serves as the engine behind popular torrent clients and is used in both desktop and embedded applications. ## What libtorrent Does - Implements the full BitTorrent protocol including DHT, PEX, and magnet links - Manages concurrent downloads with disk caching, piece prioritization, and rate limiting - Supports protocol extensions including uTP (micro transport protocol) for low-overhead transfers - Provides Python bindings for scripted torrent management and automation - Handles web seeding (HTTP/FTP sources) alongside peer-to-peer transfers ## Architecture Overview libtorrent uses an async I/O model built on Boost.Asio. A session object manages all torrents, coordinating peer connections, disk I/O, and bandwidth allocation. The disk subsystem uses memory-mapped files and an LRU cache to minimize system calls. Each torrent runs its own piece picker and choking algorithm. ## Self-Hosting & Configuration - Link against libtorrent-rasterbar via CMake with find_package(LibtorrentRasterbar) - Create a session with settings_pack to configure ports, rate limits, and connection caps - Add torrents via .torrent files, magnet URIs, or in-memory resume data - Tune disk cache size and hashing threads for your storage hardware - Enable encryption, DHT, and local peer discovery in settings ## Key Features - Powers qBittorrent, Deluge, and other widely used torrent clients - uTP transport reduces network congestion while maintaining throughput - Full DHT implementation with BEP-44 mutable items for decentralized data storage - Efficient memory-mapped disk I/O with configurable caching strategies - Supports seeding, super-seeding, and web seeding from HTTP sources ## Comparison with Similar Tools - **libtorrent (Rakshasa)** — Rakshasa's libtorrent powers rTorrent; libtorrent-rasterbar offers broader protocol support and Python bindings - **Transmission** — Transmission is a full client; libtorrent is an embeddable library for building custom clients - **aria2** — aria2 is a multi-protocol downloader; libtorrent specializes in BitTorrent with deeper protocol features - **WebTorrent** — WebTorrent runs in browsers via WebRTC; libtorrent targets native applications with system-level performance ## FAQ **Q: What is the difference between libtorrent and libtorrent-rasterbar?** A: libtorrent-rasterbar (by Arvid Norberg) is the widely used library powering qBittorrent and Deluge. A separate, older project by Rakshasa powers rTorrent. **Q: Does libtorrent support magnet links?** A: Yes. libtorrent fully supports magnet links, downloading metadata from the DHT or peers before starting the transfer. **Q: Can libtorrent be used in commercial software?** A: Yes. libtorrent uses a BSD license, allowing unrestricted commercial use. **Q: What platforms does libtorrent support?** A: Linux, macOS, Windows, FreeBSD, and Android. Any platform with a C++17 compiler and Boost. ## Sources - https://github.com/arvidn/libtorrent - https://libtorrent.org/ --- Source: https://tokrepo.com/en/workflows/asset-64c0432f Author: Script Depot