151 releases (39 breaking)

0.77.10 Jun 25, 2021
0.76.1 Jun 12, 2021
0.56.0 Mar 31, 2021
0.39.12 Dec 29, 2020
0.38.0 Nov 30, 2020
Download history 152/week @ 2023-05-29 1/week @ 2023-06-12 153/week @ 2023-06-19 180/week @ 2023-06-26 98/week @ 2023-07-03 167/week @ 2023-07-10 1/week @ 2023-07-24 1/week @ 2023-07-31 101/week @ 2023-08-14 109/week @ 2023-08-21 102/week @ 2023-08-28 153/week @ 2023-09-04 156/week @ 2023-09-11

520 downloads per month

GPL-3.0 license

11K SLoC


All routing development is now via the safe_network repository


sn_routing - a specialised storage DHT

Crate LoC
Documentation MaidSafe website Safe Dev Forum Safe Network Forum


A secured DHT, based on a kademlia-like implementation, but with some very stark differences. This is a recursive as opposed to iterative network, enabling easier NAT traversal and providing more efficient use of routers and larger networks. This also allows very fast reconfiguration of network changes, aleviating the requirement for a refresh algorithm. A recursive solution based on a network protocol layer that is 'connection oriented' also allows a close group to be aligned with security protocols.

This library makes use of Public-key cryptography to allow a mechanism to ensure nodes are well recognised and cryptographically secured. This pattern allows the creation of a DHT based PKI and this in turn allows a decentralised network to make use of groups as fixed in relation to any address. This is particularly useful in a continually fluid network as described here, creating a server-less and autonomous network.

This is a very under researched area. For a general introduction to some of the ideas behind the design related to XOR Space, watching The Safe Network from First Principles series is recommended. The slides for XOR Distance Metric and Basic Routing lecture are also available here. The last video from the series on how the same ideas were applied to decentralised BitTorrent trackers is available here. A proper formalisation of the Routing algorithm is in progress.


Messages are logged via the standard log crate, and where enabled, printed via env_logger. By default this prints messages of level "warn" and higher ("error"), but not lower levels ("info", "debug", "trace"). The level can be set explicitly (any of the above or "off"), e.g.:

export RUST_LOG=sn_routing=info

Optionally, the following sub-targets can be controlled independently:

  • stats — messages about connections and sn_routing table size
  • crust — messages from the mock Crust layer (not real Crust)


export RUST_LOG=sn_routing=info,stats=off


Licensed under the General Public License (GPL), version 3 (LICENSE http://www.gnu.org/licenses/gpl-3.0.en.html).

Linking exception

sn_routing is licensed under GPLv3 with linking exception. This means you can link to and use the library from any program, proprietary or open source; paid or gratis. However, if you modify sn_routing, you must distribute the source to your modified version under the terms of the GPLv3.

See the LICENSE file for more details.


Want to contribute? Great 🎉

There are many ways to give back to the project, whether it be writing new code, fixing bugs, or just reporting errors. All forms of contributions are encouraged!

For instructions on how to contribute, see our Guide to contributing.


~715K SLoC