Loading...

Build your own BitTorrent

Learn about .torrent files, the BitTorrent Peer Protocol and more

Start Building
bittorrent
Go
bittorrent
Python
bittorrent
Rust
bittorrent
C
bittorrent
C++
bittorrent
C#
bittorrent
Elixir
bittorrent
Haskell
bittorrent
Java
bittorrent
Kotlin
bittorrent
Zig
bittorrent
JavaScript
bittorrent
Ruby
bittorrent
TypeScript

BitTorrent is a peer-to-peer file sharing protocol used for distributing large amounts of data. In this challenge, you'll build a BitTorrent client that's capable of downloading a publicly available file using the BitTorrent protocol.

Along the way, you'll learn about the BitTorrent protocol, .torrent files more.

Stages

Decode bencoded strings
Login via GitHub to view this stage
Decode bencoded integers
Login via GitHub to view this stage
Decode bencoded lists
Login via GitHub to view this stage
Decode bencoded dictionaries
Login via GitHub to view this stage
Parse torrent file
Login via GitHub to view this stage
Calculate info hash
Login via GitHub to view this stage
Piece hashes
Login via GitHub to view this stage
Discover peers
Login via GitHub to view this stage
Peer handshake
Login via GitHub to view this stage
Download a piece
Login via GitHub to view this stage
Download the whole file
Login via GitHub to view this stage

Magnet Links

Parse magnet link
Login via GitHub to view this stage
Announce extension support
Login via GitHub to view this stage
Send extension handshake
Login via GitHub to view this stage
Receive extension handshake
Login via GitHub to view this stage
Request metadata
Login via GitHub to view this stage
Receive metadata
Login via GitHub to view this stage
Download a piece
Login via GitHub to view this stage
Download the whole file
Login via GitHub to view this stage