This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Kademlia is a distributed hash table for decentralized peer-to-peer computer networks.

Project Description
# Python Distributed Hash Table
[![Build Status](](
[![Docs Status](](

**Documentation can be found at [](**

This library is an asynchronous Python implementation of the [Kademlia distributed hash table]( It uses [Twisted]( to provide asynchronous communication. The nodes communicate using [RPC over UDP]( to communiate, meaning that it is capable of working behind a [NAT](

This library aims to be as close to a reference implementation of the [Kademlia paper]( as possible.

## Installation

pip install kademlia

## Usage
*This assumes you have a working familiarity with [Twisted](*

Assuming you want to connect to an existing network (run the standalone server example below if you don't have a network):

from twisted.internet import reactor
from twisted.python import log
from import Server
import sys

# log to std out

def quit(result):
print "Key result:", result

def get(result, server):
return server.get("a key").addCallback(quit)

def done(found, server):
log.msg("Found nodes: %s" % found)
return server.set("a key", "a value").addCallback(get, server)

server = Server()
# next line, or use reactor.listenUDP(5678, server.protocol)
server.bootstrap([('', 1234)]).addCallback(done, server)

Check out the examples folder for other examples.

## Stand-alone Server
If all you want to do is run a local server, just start the example server:

twistd -noy examples/server.tac

## Running Tests
To run tests:

trial kademlia

## Fidelity to Original Paper
The current implementation should be an accurate implementation of all aspects of the paper save one - in Section 2.3 there is the requirement that the original publisher of a key/value republish it every 24 hours. This library does not do this (though you can easily do this manually).
Release History

Release History

This version
History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
storjkademlia-0.7.4-py2.py3-none-any.whl (38.6 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Feb 22, 2016
storjkademlia-0.7.4.tar.gz (14.5 kB) Copy SHA256 Checksum SHA256 Source Feb 22, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting