Skip to content
Back to the catalog
Project bittorrentNetworkingAdvancedBeta

A BitTorrent client

Bencode, trackers and the peer-to-peer protocol. Download a real file by talking to real peers.

Build it in your language

The tester treats your program as a black box: any language works. These are just the most convenient ones for this project.

Guide language

The stage guides read in this language. Only languages this project is fully translated into show up here; the interface language does not change.

What this project is about

BitTorrent is a complete distributed system you can build on your own: peer discovery, a binary protocol with a handshake, block transfer and integrity verification. And you check the result by opening the downloaded file.

You'll start by decoding a .torrent and finish downloading a real file from several peers at once, in parallel, checking every piece against its hash before writing it to disk.

Roadmap

12 stages across 4 phases. Every stage comes with its guide and its tests: you move on when they pass.

  1. Phase 13 stages

    Understanding the .torrent

    A bencode decoder, file metadata and the infohash.

    1. 01Bencode scalars
    2. 02Bencode lists and dictionaries
    3. 03Metadata and infohash
  2. Phase 22 stages

    Finding peers

    Tracker queries and the list of available peers.

    1. 01Tracker request
    2. 02Compact peer list
  3. Phase 34 stages

    Talking to a peer

    Handshake, protocol messages, and downloading one verified piece.

    1. 01Peer handshake
    2. 02Message framing
    3. 03Choking and bitfield state
    4. 04Single-piece download
  4. Phase 43 stages

    Downloading the file

    Several peers in parallel, retries, and final assembly on disk.

    1. 01Peer-aware scheduler
    2. 02Retries and integrity
    3. 03Final assembly

Before you start

A working BitTorrent client: a bencode decoder, .torrent parsing and infohash computation, tracker communication, peer handshakes, the protocol messages (bitfield, interested, request, piece), parallel block downloads and SHA-1 verification of every piece.

  • dns-resolver
    Beta

    A DNS resolver

    Build and parse UDP packets bit by bit. Resolve names by walking the hierarchy from the root servers.

    Intermediate8 stages~9 hNetworking
    udpbinarioprotocolos

    Go · Rust · Python

  • mcp-server
    Beta

    Build an MCP server

    Build a Model Context Protocol server from scratch with JSON-RPC, tools, and resources.

    Intermediate5 stages~12 hNetworking
    mcpjson rpcagentes+1

    TypeScript · Python · Go

  • http-server
    Beta

    An HTTP server from the socket up

    From raw bytes to a 200 response. Parse requests, manage connections and serve concurrent traffic.

    Intermediate10 stages~12 hNetworking
    socketstcphttp+1

    Go · Python · C · Rust