Skip to content

Running a node with dhtnode

Sébastien Blin edited this page Oct 8, 2019 · 21 revisions

dhtnode is a command-line utility included with OpenDHT to run, control and monitor an OpenDHT node.

Using the systemd service (GNU/Linux with systemd)

OpenDHT includes a systemd service for dhtnode starting from version 1.3.4. To use it, build OpenDHT using CMake with the argument -DOPENDHT_SYSTEMD=On.

See Build the library for details about how to build OpenDHT.

Once installed, start the dhtnode service using:

systemctl start dhtnode

Or enable dhtnode to run automatically on startup using:

systemctl enable dhtnode

Running dhtnode directly

dhtnode [-p local_port] [-b bootstrap_host:port] [-n netid] [-i] [-D] [-f] [-v [-l logfile|-L]] [-s|-d]

  • -b allows to specify a bootstrap node address (can be any running node of the DHT network)
  • -p allows to specify the local UDP port to bind (optional). If not set, will use any available port. Note that the default OpenDHT port (to ideally use for public nodes) is 4222
  • -n allows to specify a network id (integer). Nodes with different network ids won't talk to each other. Defaults to the main public network (network id 0)
  • -D enables the multicast automatic local peer discovery mechanism
  • -f allows to specify a file path to persist/load the node state (routing table and values)
  • -v enables logging, to standard output by default
  • -L logs to syslog
  • -l logs to a specified file path
  • -s enables service mode (non-forking daemon)
  • -d enables daemon mode (forking daemon, -v logs to syslog by default)
  • -i enables generating a DHT "identity" with the node (RSA key pair, and certificate published on the DHT). Required to perform cryptographic operations (encrypt/sign values) if no private key file is provided.
  • --save-identity save generated identity (certificate and private key) to given file prefix
  • --privkey load identity private key from given file. Required to perform cryptographic operations if no identity is generated.
  • --privkey-password use private key password when loading and saving a private key from file.
  • --certificate load identity certificate from given file. If specified, the certificate is published on the DHT.
  • --proxyserver specify a port to run a proxy server
  • --proxyclient use the proxyserver specified

for instance:

dhtnode -b bootstrap.jami.net:4222 will run a node and use bootstrap.jami.net port 4222 as a bootstrap node.

dhtnode -b bootstrap.jami.net:4222 --proxyserver 8000 will run a node with a proxy server available on port 8000.

dhtnode --proxyserver dhtproxy.jami.net:80 will run a node using dhtproxy.jami.net port 80 as a proxy.

Commands

help

Show a command list with usage.

b {node_hostname:port}

Bootstrap/ping a DHT node. Similar to providing -b host:port as a command line parameter.

g {key}

Get values for {key} (the key is a 40 hexadecimal characters string).

l {key}

Listen for value changes at {key} (the key is a 40 hexadecimal characters string).

p {key} {string_value}

Put the text value {string_value} at {key}.

You can’t perform that action at this time.