<s>
Mainline	B-Protocol
DHT	I-Protocol
is	O
the	O
name	O
given	O
to	O
the	O
Kademlia-based	O
distributed	B-Operating_System
hash	I-Operating_System
table	I-Operating_System
(	O
DHT	O
)	O
used	O
by	O
BitTorrent	B-Protocol
clients	O
to	O
find	O
peers	O
via	O
the	O
BitTorrent	B-Protocol
protocol	I-Protocol
.	O
</s>
<s>
The	O
idea	O
of	O
using	O
a	O
DHT	O
for	O
distributed	O
tracking	O
in	O
BitTorrent	B-Protocol
was	O
first	O
implemented	O
in	O
Azureus	B-Application
2.3.0.0	O
(	O
now	O
known	O
as	O
Vuze	B-Application
)	O
in	O
May	O
2005	O
,	O
from	O
which	O
it	O
gained	O
significant	O
popularity	O
.	O
</s>
<s>
Unrelated	O
but	O
around	O
the	O
same	O
time	O
,	O
BitTorrent	B-Protocol
,	O
Inc	O
.	O
released	O
a	O
similar	O
DHT	O
into	O
their	O
client	B-Protocol
called	O
Mainline	B-Protocol
DHT	I-Protocol
,	O
and	O
thus	O
popularized	O
the	O
use	O
of	O
distributed	O
tracking	O
in	O
the	O
BitTorrent	B-Protocol
protocol	I-Protocol
.	O
</s>
<s>
Measurement	O
showed	O
that	O
by	O
2013	O
,	O
the	O
concurrent	O
number	O
of	O
users	O
of	O
Mainline	B-Protocol
DHT	I-Protocol
is	O
from	O
16	O
million	O
to	O
28	O
million	O
,	O
with	O
intra-day	O
changes	O
of	O
at	O
least	O
10	O
million	O
.	O
</s>
<s>
Mainline	B-Protocol
DHT	I-Protocol
is	O
based	O
on	O
the	O
popular	O
Kademlia	B-Operating_System
DHT	I-Operating_System
design	O
.	O
</s>
<s>
Previous	O
to	O
usage	O
of	O
a	O
DHT	O
for	O
distributing	O
peers	O
,	O
trackers	B-Protocol
were	O
the	O
only	O
method	O
of	O
finding	O
peers	O
.	O
</s>
<s>
The	O
key	O
feature	O
of	O
using	O
the	O
DHT	O
over	O
trackers	B-Protocol
is	O
that	O
the	O
decentralized	O
approach	O
favours	O
the	O
nature	O
of	O
the	O
BitTorrent	B-Protocol
protocol	I-Protocol
.	O
</s>
<s>
The	O
DHT	O
operates	O
by	O
distributing	O
lists	O
of	O
peers	O
identified	O
by	O
the	O
SHA-1	B-Algorithm
hash	I-Algorithm
of	O
the	O
torrent	B-Protocol
.	O
</s>
<s>
The	O
SHA-1	B-Algorithm
hash	I-Algorithm
of	O
a	O
torrent	B-Protocol
,	O
the	O
infohash	O
,	O
is	O
synonymous	O
with	O
a	O
Kademlia	B-Operating_System
key	O
,	O
which	O
is	O
used	O
for	O
finding	O
peers	O
(	O
values	O
)	O
in	O
the	O
overlay	O
network	O
.	O
</s>
<s>
To	O
find	O
peers	O
in	O
a	O
swarm	O
,	O
a	O
node	O
sends	O
a	O
get_peers	O
query	O
with	O
the	O
infohash	O
as	O
key	O
(	O
equivalent	O
to	O
a	O
Kademlia	B-Operating_System
FIND_VALUE	O
)	O
to	O
the	O
closest	O
known	O
nodes	O
(	O
with	O
respect	O
to	O
the	O
key	O
distance	O
)	O
.	O
</s>
<s>
Like	O
Kademlia	B-Operating_System
,	O
if	O
the	O
node	O
does	O
not	O
return	O
the	O
value	O
(	O
peers	O
)	O
,	O
it	O
persists	O
further	O
in	O
an	O
iterative	O
operation	O
.	O
</s>
<s>
However	O
,	O
after	O
the	O
search	O
is	O
exhausted	O
,	O
the	O
client	B-Protocol
then	O
also	O
inserts	O
the	O
peer	O
contact	O
information	O
for	O
itself	O
onto	O
the	O
responding	O
nodes	O
with	O
IDs	O
closest	O
to	O
the	O
infohash	O
of	O
the	O
torrent	B-Protocol
.	O
</s>
<s>
Nodes	O
use	O
an	O
additional	O
measure	O
known	O
as	O
a	O
token	O
to	O
ensure	O
others	O
do	O
n't	O
sign	O
up	O
other	O
hosts	O
for	O
torrents	B-Protocol
.	O
</s>
<s>
For	O
a	O
node	O
to	O
announce	O
that	O
its	O
controlling	O
peer	O
is	O
downloading	O
a	O
torrent	B-Protocol
,	O
it	O
must	O
present	O
the	O
token	O
received	O
from	O
the	O
same	O
queried	O
node	O
in	O
a	O
recent	O
query	O
for	O
peers	O
.	O
</s>
<s>
When	O
a	O
node	O
attempts	O
to	O
"	O
announce	O
"	O
a	O
torrent	B-Protocol
,	O
the	O
queried	O
node	O
checks	O
the	O
token	O
against	O
the	O
querying	O
node	O
's	O
IP	O
address	O
.	O
</s>
<s>
Mainline	B-Protocol
DHT	I-Protocol
uses	O
the	O
SHA-1	B-Algorithm
hash	I-Algorithm
of	O
the	O
IP	O
address	O
concatenated	O
onto	O
a	O
secret	O
that	O
changes	O
every	O
five	O
minutes	O
for	O
a	O
token	O
value	O
.	O
</s>
<s>
A	O
node	O
in	O
the	O
Mainline	B-Protocol
DHT	I-Protocol
consists	O
of	O
an	O
IP	O
and	O
port	O
combination	O
.	O
</s>
<s>
Nodes	O
communicate	O
via	O
an	O
RPC	B-Operating_System
protocol	O
called	O
KRPC	O
.	O
</s>
<s>
KRPC	O
is	O
a	O
simple	O
protocol	O
that	O
consists	O
of	O
nodes	O
sending	O
messages	O
(	O
queries	O
,	O
replies	O
and	O
errors	O
)	O
containing	O
bencoded	B-Protocol
dictionaries	O
over	O
UDP	B-Protocol
.	O
</s>
<s>
Buckets	O
are	O
structured	O
differently	O
from	O
those	O
in	O
Kademlia	B-Operating_System
.	O
</s>
<s>
Instead	O
of	O
a	O
list	O
of	O
160	O
buckets	O
,	O
BitTorrent	B-Protocol
starts	O
with	O
only	O
one	O
bucket	O
.	O
</s>
<s>
Old	O
nodes	O
are	O
pinged	O
(	O
as	O
in	O
Kademlia	B-Operating_System
)	O
.	O
</s>
<s>
Mainline	B-Protocol
DHT	I-Protocol
was	O
first	O
included	O
in	O
version	O
4.2.0	O
of	O
the	O
BitTorrent	B-Protocol
software	O
(	O
November	O
2005	O
)	O
.	O
</s>
