Skip to content

Instantly share code, notes, and snippets.

@alexstrat
Created November 13, 2012 23:33
Show Gist options
  • Save alexstrat/4069162 to your computer and use it in GitHub Desktop.
Save alexstrat/4069162 to your computer and use it in GitHub Desktop.
How to launch KadOH UDP DHT and start the debug UI

First of all, clone the repo somewhere :

$ git clone https://github.com/jinroh/kadoh.git
$ cd kadoh

Then, intall the (dev) dependencies :

$ npm install --dev

(on my side I needed to use the -f / --force option since I don't use the right version of node)

Maybe, install jake (the node make) globally, to have access to the jake executable :

$ npm install -g jake

Start an UDP DHT :

$ bin/dht udp.default

This command launches 2 bootstraps and 100 bots (self running nodes). These bots are launched crescendo: each one executes the join process to have a partial knowledge of the already running ones and so on.. Note that the 100 bots are separated in 2 pools of 50 bots: a pool corresponds to a UNIX process that holds 50 concurrently running bots. All these bots are communicating together thru UDP sockets.

Then, in an other terminal launch the debug UI server :

$ jake run:udp

This will launch a web server that will serves the compiled for browser KadOH lib[1] and the debug UI files (HTML, JS, CSS). Additionally it will start the WebSocket/UDP proxy ( simudp ).

[1] the lib is compiled on the fly, however you can build a static file by running jake build:simudp. The build output is in dist/KadOH.simudp.js. This build is for using in browser with the UDP/WebSocket proxy (called simupd).

So, go on http://localhost:8080 with your browser.

In the browser you got all you need to sart a node (that will connect to the other running ones), to control it (put and get method) and to monitor the activity of this node. You got indeed 7 different panels :

  • Control: to control the node, meaning doing a join, put a value on the DHT, get a value on the DHT, and ping an other node.
  • Node: there is the states and results of all iterative look-ups that this node executed. See Kademlia algo.
  • Reactor: there is the states and results of incoming and outgoing RPCs
  • Transport: here is logged what is actually going thru the transport layer (out and in). note: it seems we have a bug, the in traffic is missing. See Kademlia algo.
  • Routing Table: here is the state of the routing table (with buckets and so on). See Kademlia algo.
  • Value Management: here are the values that the current is storing.
  • Log: here is some verbose logs, classified by level (info, warning, error, fatal, debug). note it seems we have a bug there: only the debug level works.

So let's start the node, and keep an eye on the different panels to see what happens :

  • click on Connect button in the top right corner. This will connect he transport layer, meaning that it connects to the WebSocket/UDP proxy.
  • then, click on Join in Contol Panel. This will start the Join process (iterativefind node).
  • put a value: enter a text and click on put. Few times later you got the key (or hash) corresponding to the posted value.
  • get a value: enter the key and click on Get. Wait a bit, you got it.

You can start a second by launching a new browser tab on http://localhost:8080 and try to put a value with one and get it with the other..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment