Main Page | File List | Related Pages

BitTorrent Protocol Specifications (WIP [2004-04-25)

Ok, it's been a while since the last time I looked at this page, time to do a small refresh.

The original version of this page was written while MoonlightTorrent(.com) was still in the early stages of becoming a fully capable BT client. At about the same time, I was also writing my MoonlightTorrent Protocol - Preliminary Specifications (rewrite pending [2004-04-17]) draft which I have also not touched in ages and needs a rewrite to reflect what I have experienced over the last four months. The main reason why I started rewriting the BT protocol's specifications back then was because the official specifications lacked some details that eluded me some time. Most of it is deceptively simple, the issues are in the details of the protocol's 'unwritten rules'.

Below is my interpretation of the BT protocol specifications along with the few unwritten rules that I either discovered through experimentation or chatting with some helpful folks on #btports on FreeNode, you guys probably know who you are :)

Anyhow, this page only contains the stuff I could remember 'off-the-top' at the time of writing and will be added as I discover/remember/learn more about it.

Connection handshake:

  1. The connecting party sends a 68 bytes string upon connect consisting of the following:
  2. The answering party looks up the CliendID/InfoHash
  3. The connecting party verifies that the received info hash and Client ID have the expected values and drops the connection if such is not the case.
  4. Either, both or neither ends then proceed to sending the initial BitField (see below) before begining normal operation.

Basic BitTorrent message format: (all DWORDs are in network byte order)

Official message types:


Hits since December 5, 2003:
Count.cgi?display=counter|df=vllmtqtw.dat

Generated on Tue Aug 24 23:57:31 2004 for MoonlightTorrent(.com) by doxygen 1.3.8