Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


A Chord DHT written in Scala using Akka
Build Status


See LICENSE. This software is licensed under the Modified BSD License --- aka 3-clause BSD license.

This software uses Akka, which is licensed under the Apache 2 License.


Generally you do not have to install this software manually: you can use sbt and specify dependency as below.

libraryDependencies +=   "momijikawa" %% "p2pscalaproto" % "0.3.0"

###If you are to install manually

  1. Clone this repository.
  2. install sbt.
  3. Run $ sbt publish-local then you're ready for developing P2P2ch; the software will be installed in your local ivy2 repository.

You should place your own configuration file reference.conf in conf/references/ directory on your project. Configuration options are described below.

reference.conf configuration

Most of configurations are Akka settings; For advanced settings, see Akka Documentation. Akka configurations are placed under p2pakka.akka.*.

Logging level

p2pakka.akka.loglevel={ERROR, WARN, INFO, DEBUG, etc.}

p2pscalaproto peculiar configurations

Automatic port mapping using UPnP

If true, P2PScalaProto attempts to open the specified Akka port on the router using UPnP.



import momijikawa.p2pscalaproto._
import scala.concurrent.duration._
val chord = new Chord
chord.init(TnodeID.newNodeId) // Give this node ID
chord.join("") // Joining DHT Network
val key = Await.result(chord.put("hoge", "piyopiyo".getBytes.toStream), 10 seconds)
key match {
  case Some(keyval) =>
    val data = Await.result(chord.get(key.toSeq), 10 seconds)
    data foreach {
      opt =>
        opt match {
          case Some(data) =>
            println(new String(data.toArray[Byte]))
          case None =>
            println("Failed to read the data.")