This a simple sample to experiment kademlia library features.
The sample uses also the conan dependency manager and the Clara command line parser library.
The code is licensed under the unlicense terms. So in resume can use it for wherever you want.
-
First you need to install (detailed instructions at conan docs)
pip install conan
-
Install the packages dependencies
conan install
-
Then build
./waf configure build
or
conan build
After building, a binary should be created at build/node
.
-
You can run it with the
--help
option to see the available options./build/node --help
-
You need to run a first node that will bootstrap the dht:
./build/node
optionally specify a local port to bind:
./build/node --port 12345
- Then, you can run one or more nodes, bootstraping with one of the previous nodes:
Note: if you run then on same machine, remember to use different ports. Note 2: if you not set the port of bootstrap node it will use the default value
./build/node "someip" -p 10001
./build/node "otherip:10001" -p 10002
./build/node "otherip:10002"
...
-
For each one node (except the first one), you can use the
get
andput
commands:... during execution put "some key" "my value" get "some key"