Loading...

Build your own BitTorrent

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

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

This challenge requires a CodeCrafters Membership.

You're welcome to study the full challenge structure and stage instructions for free. A membership is needed for submitting code and viewing solutions.

Want to try a free challenge? Try Build your own Shell — it's free this month.

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.

Base Stages

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.

Decode bencoded strings
Very easy
We'd expect a proficient developer to take < 5 minutes to complete this stage.
Decode bencoded integers
Easy
We'd expect a proficient developer to take 5-10 minutes to complete this stage.
Decode bencoded lists
Easy
We'd expect a proficient developer to take 5-10 minutes to complete this stage.
Decode bencoded dictionaries
Easy
We'd expect a proficient developer to take 5-10 minutes to complete this stage.
Parse torrent file
Easy
We'd expect a proficient developer to take 5-10 minutes to complete this stage.
Calculate info hash
Medium
We'd expect a proficient developer to take 30 minutes to 1 hour to complete this stage.
Piece hashes
Easy
We'd expect a proficient developer to take 5-10 minutes to complete this stage.
Discover peers
Medium
We'd expect a proficient developer to take 30 minutes to 1 hour to complete this stage.
Peer handshake
Medium
We'd expect a proficient developer to take 30 minutes to 1 hour to complete this stage.
Download a piece
Hard
We'd expect a proficient developer to take more than 1 hour to complete this stage.
Download the whole file
Hard
We'd expect a proficient developer to take more than 1 hour to complete this stage.

Magnet Links

This extension covers magnet links. Magnet links allow downloading files without the need of downloading a .torrent file first.

Along the way, you'll learn about the magnet URI format, the extension protocol and the metadata extension.

Parse magnet link
Easy
We'd expect a proficient developer to take 5-10 minutes to complete this stage.
Announce extension support
Easy
We'd expect a proficient developer to take 5-10 minutes to complete this stage.
Send extension handshake
Easy
We'd expect a proficient developer to take 5-10 minutes to complete this stage.
Receive extension handshake
Easy
We'd expect a proficient developer to take 5-10 minutes to complete this stage.
Request metadata
Easy
We'd expect a proficient developer to take 5-10 minutes to complete this stage.
Receive metadata
Easy
We'd expect a proficient developer to take 5-10 minutes to complete this stage.
Download a piece
Hard
We'd expect a proficient developer to take more than 1 hour to complete this stage.
Download the whole file
Hard
We'd expect a proficient developer to take more than 1 hour to complete this stage.