Kademlia is a distributed hash table for decentralized peer-to-peer computer networks.
Project description
# Python Distributed Hash Table
[![Build Status](https://secure.travis-ci.org/bmuller/kademlia.png?branch=master)](https://travis-ci.org/bmuller/kademlia)
[![Docs Status](https://readthedocs.org/projects/kademlia/badge/?version=latest)](http://kademlia.readthedocs.org)
**Documentation can be found at [kademlia.readthedocs.org](http://kademlia.readthedocs.org/).**
This library is an asynchronous Python implementation of the [Kademlia distributed hash table](http://en.wikipedia.org/wiki/Kademlia). It uses [Twisted](https://twistedmatrix.com) to provide asynchronous communication. The nodes communicate using [RPC over UDP](https://github.com/bmuller/rpcudp) to communiate, meaning that it is capable of working behind a [NAT](http://en.wikipedia.org/wiki/NAT).
This library aims to be as close to a reference implementation of the [Kademlia paper](http://pdos.csail.mit.edu/~petar/papers/maymounkov-kademlia-lncs.pdf) as possible.
## Installation
```
pip install kademlia
```
## Usage
*This assumes you have a working familiarity with [Twisted](https://twistedmatrix.com).*
Assuming you want to connect to an existing network (run the standalone server example below if you don't have a network):
```python
from twisted.internet import reactor
from twisted.python import log
from kademlia.network import Server
import sys
# log to std out
log.startLogging(sys.stdout)
def quit(result):
print "Key result:", result
reactor.stop()
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.listen(5678)
server.bootstrap([('127.0.0.1', 1234)]).addCallback(done, server)
reactor.run()
```
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).
[![Build Status](https://secure.travis-ci.org/bmuller/kademlia.png?branch=master)](https://travis-ci.org/bmuller/kademlia)
[![Docs Status](https://readthedocs.org/projects/kademlia/badge/?version=latest)](http://kademlia.readthedocs.org)
**Documentation can be found at [kademlia.readthedocs.org](http://kademlia.readthedocs.org/).**
This library is an asynchronous Python implementation of the [Kademlia distributed hash table](http://en.wikipedia.org/wiki/Kademlia). It uses [Twisted](https://twistedmatrix.com) to provide asynchronous communication. The nodes communicate using [RPC over UDP](https://github.com/bmuller/rpcudp) to communiate, meaning that it is capable of working behind a [NAT](http://en.wikipedia.org/wiki/NAT).
This library aims to be as close to a reference implementation of the [Kademlia paper](http://pdos.csail.mit.edu/~petar/papers/maymounkov-kademlia-lncs.pdf) as possible.
## Installation
```
pip install kademlia
```
## Usage
*This assumes you have a working familiarity with [Twisted](https://twistedmatrix.com).*
Assuming you want to connect to an existing network (run the standalone server example below if you don't have a network):
```python
from twisted.internet import reactor
from twisted.python import log
from kademlia.network import Server
import sys
# log to std out
log.startLogging(sys.stdout)
def quit(result):
print "Key result:", result
reactor.stop()
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.listen(5678)
server.bootstrap([('127.0.0.1', 1234)]).addCallback(done, server)
reactor.run()
```
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).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
storjkademlia-0.7.4.tar.gz
(14.5 kB
view details)
Built Distribution
File details
Details for the file storjkademlia-0.7.4.tar.gz
.
File metadata
- Download URL: storjkademlia-0.7.4.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 553cd8a8eb65f8f008ea30a4242dcce43c4c7edc044689fe566fe065ca7d63b5 |
|
MD5 | 9f9752cdbc6dd46a8377b59eedd18098 |
|
BLAKE2b-256 | 33069f6b1d1b7923159380a3a57e0f313e0b834fe9ac016f8d4ff393153e24dc |
File details
Details for the file storjkademlia-0.7.4-py2.py3-none-any.whl
.
File metadata
- Download URL: storjkademlia-0.7.4-py2.py3-none-any.whl
- Upload date:
- Size: 38.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 108898346bde3212e51129e4ee5c046f9be2bc81f94312c14fabf93123f52b48 |
|
MD5 | 73d8d087dbbd69a724ff0067ed15b859 |
|
BLAKE2b-256 | e16dc88e772fc7e578d396d37d64bfa10b6959a31e95e5947cfdb3de13f3a5b2 |