OpenDHT: a C++17 Distributed Hash Table implementation
OpenDHT: a C++17 Distributed Hash Table implementation
OpenDHT
A lightweight C++17 Distributed Hash Table implementation.
OpenDHT provides an easy to use distributed in-memory data store. Every node in the network can read and write values to the store. Values are distributed over the network, with redundancy.
See the wiki:
You can help contribute to the public network by running a stable node with a public IP address. https://github.com/savoirfairelinux/opendht/wiki/Running-a-node-with-dhtnode
Build instructions: see BUILD.md
The tools directory includes simple example programs :
dhtnode, a command line tool, allowing to run a DHT node and perform operations supported by the library (get, put etc.) with text values.dhtchat, a very simple IM client working over the dht.Example program launching a DHT node, connecting to the network and performing some basic operations:
…Install on Linux, macOS and Windows with:
pip install opendhtUsing the simple, blocking API:
import opendht as dht
node = dht.DhtRunner()
node.run()
# Join the DHT network through any running node,
# here using a known bootstrap node.
node.bootstrap("bootstrap.jami.net", "4222")
# blocking call (provide callback arguments to make the call non-blocking)
node.put(dht.InfoHash.get("unique_key"), dht.Value(b'some binary data'))
results = node.get(dht.InfoHash.get("unique_key"))
for value in results:
print(value)Or using asyncio:
…Core dependencies:
Optional dependencies for the REST API (DHT proxy client/server):
Build environment:
Copyright (c) 2014-2026 Savoir-faire Linux Inc.
OpenDHT is released under the MIT License. See LICENSE for details.
This project was originally based on https://github.com/jech/dht by Juliusz Chroboczek.
No open issues yet, or sync has not completed.