1

This has seriously perplexed me.

The original Kademlia offers that 160bit hex like a sha1 should be used for obvious reasons: When searching for peers relating to an infohash, you simple search nodeIDs as they should be equivalent to the same system as the sha1 infohash.

But reading this: http://www.bittorrent.org/beps/bep_0005.html

the id's are abcdefghi0123456789 which is: 1) Half the size 2) Uses more characters then standard hex encoding.

So what am I missing?

Why are node id's like this?

Encombe
  • 2,003
  • 1
  • 17
  • 26
Craig O'Connor
  • 153
  • 3
  • 10

1 Answers1

2

To make the raw binary node_id in the examples printable,
it has cleverly been chosen to consist of only alphanumeric characters.
The node_id in the examples are actually: abcdefghij0123456789
As you can see there are 20 characters = 20 bytes = 160 bits as expected.

abcdefghij0123456789 hex-encoded is: 0x6162636465666768696A30313233343536373839

Encombe
  • 2,003
  • 1
  • 17
  • 26
  • Ok, it is binary encoded. That's fine. But I thought node ID's represent infohashes. That when you search for an infohash, you're technically searching node id's for closeness with the infohash? – Craig O'Connor Feb 09 '17 at 19:58
  • No, node ID's does not represent infohashes. What's happening is that peers announces their participation in a swarm, to the eight nodes/node_ids closest to the info_hash of that swarm. A node_id SHOULD be chosen randomly according to BEP5. Later that has been modified by BEP42, to make sybil attacks harder to do on the mlDHT. – Encombe Feb 09 '17 at 20:19
  • [This video](http://engineering.bittorrent.com/2013/01/22/bittorrent-tech-talks-dht/) does a good job explaining the basics of the mlDHT. It's done by Arvid Norberg, the world's number one expert on BitTorrent DHT. – Encombe Feb 09 '17 at 20:38
  • "binary encoded" is a bit of an oxymoron, it's about as unencoded as the data can get. whenever you see hex somewhere it's *encoded* either because it's meant to be human-friendly or because it's sent over some text-protocol – the8472 Feb 09 '17 at 21:28
  • Guys! Thank you so much for your added input! It's hard to find resources on this topic – Craig O'Connor Feb 09 '17 at 21:30