The Wayback Machine - https://web.archive.org/web/20230724161914/https://github.com/cgrotz/kademlia
Skip to content

cgrotz/kademlia

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 

Kademlia

license release Build CodeFactor

Description

This is a basic DHT implementation using the Kademlia routing protocol. It's not an implementation of a full Kademlia node. You can find an example implementation of a Kademlia node here: https://github.com/cgrotz/kademlia-example

Usage

Simply include Kademlia as a dependency in your code:

<dependency>
    <groupId>de.cgrotz</groupId>
    <artifactId>kademlia</artifactId>
    <version>1.0.1</version>
</dependency>
// In production the nodeId should be static for an individual node
Kademlia kad = new Kademlia(new NodeId(), "127.0.0.1", 9000);
// Bootstrap using a remote server (there is no special configuration on the remote server necessary)
kad.bootstrap("127.0.0.1", 9001);
// Store a key/value pair in the DHT
kad.put("key", "value");
// Retrieve a key/value pair from the DHT
kad.get("key", value -> { ... });
// Or synchronously with
kad.get("key");

See the Getting Started guide for more information. Protocol gives you information on the protocol.

Open Points

  • Extend Testing
  • Bucket Refreshing
  • Key Republishing
  • Client retry behavior
  • Caching
  • Store value as continuous log of events?
  • Provide TLS encryption with Key Exchange for inter node communication
  • provide local Unix Domain Socket interface for IPC
  • Switchable local storage implementation (e.g. to enable other storage engines like Levels DB)

Credit goes to

Joshua Kissoon and his work on Kademlia where I took inspiration from. https://github.com/JoshuaKissoon/Kademlia His great blog post: http://gleamly.com/article/introduction-kademlia-dht-how-it-works

About

A simple Kademlia DHT implementation

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages