/Kad3

UDP Kademlia DHT to help make custom DHTs.

Primary LanguageJavaMIT LicenseMIT

Kad3

This is an implementation of Kademlia/Mainline DHT Wikipedia Kademlia Link and Wikipedia Mainline Link this implementation was refrenced from Stanford Paper

What is a DHT

A DHT (Distributed Hash Table) is a distributed network that uses an XOR based routing system based off of user defined UIDs. UIDs are made using CRC32c hash of the users IP address and a random number. The random number allows multiple nodes on 1 NAT, while also limiting any person up to 100 nodes per NAT to stop 50% attacks.

Note

Decentralized networks work on a teir based system meaning that some nodes have more power or say than others do.

Important

This is a DHT implementation, NOT a torrent implementation, this can talk with BitTorrent but it can only do FIND_NODE, PING, GET, & PUT.

Features

  • PING
  • FIND_NODE
  • GET
  • PUT
  • Same protocol as BitTorrent (Easy Torrent Implementation)
  • No external Libraries
  • Option for MainLine or Kademlia
  • Teredo support
  • Consensus IP defining
  • Bogon detecting
  • Spam Throttling
  • Secure ID only option
BEP Title Status
BEP5 Bittorrent DHT Yes
BEP32 IPv6 Yes
BEP42 DHT Security Extension Yes

Examples

To join a node you can do

Kademlia k = new Kademlia();
k.join(6881, InetAddress.getByName("HOSENAME"), 6881);

To start a node without joining you can do

Kademlia k = new Kademlia();
k.bind(6881);

To set Kademlia to Mainline you can do:

Kademlia k = new Kademlia("MainLine");

Requirements

Java > 8