Core Technology

The Safe Network core libraries are written exclusively in Rust and the content below provides a brief explanation of their hierarchy. The code is all open source and for more information please refer to our licensing page.

qp2p

This library provides a mechanism for peers on P2P networks to communicate securely.

Routing

Routing sits on top of qp2p. It is our overlay networking and routing layer and forms the brain of the Safe Network. Its purpose is forming a decentralised Internet and the routing information within it.

Routing is based on an algorithm that extends the Kademlia DHT routing. It uses 32-byte XOR addresses to locate data on the network. It is guaranteed that messages can be routed from any part of the network to any other end - as is proven by the Kademlia paper. Routing works purely on the terms of group consensus. We don’t trust a single entity, only a group decision with eventual consistency. In order to come to this eventual consistency the routing layer uses the consensus mechanism PARSEC.

PARSEC

PARSEC is a Protocol for Asynchronous, Reliable, Secure and Efficient Consensus and is the world's first open source ABFT (Asynchronous Byzantine Fault Tolerance) protocol that can be used in a truly permissionless setting.

Nodes

This is one of the executable consumers of Routing and will primarily hold Safe Network Data.

Nodes support multiple data types: Mutable Data and Immutable Data are currently available to developers. The major difference between these two types is the ability to change the data. Both have their own set of properties.

Personas in Nodes handle the different aspects of the network. Data Managers store the data, Client Managers store the users accounts balance, which is currently measured in allowed mutations, and eventually will be changed to Safecoin. Client Managers also store lists of users’ apps and implement the access control rules. There is no requirement to have a registered account to retrieve data and users are always free to send direct read requests to Data Managers.

Safe Network Client

The Safe Client Libraries are a set of libraries providing a way for developers to consume and use the Safe Network facilities. The libraries communicate with Nodes and build upon the foundation of fundamental network components, such as qp2p and Routing, to provide higher-level network abstractions like files and directories. The main Client Libs components are:

Components

Safe Core: Safe Core is the foundation that provides various helpful abstractions like NFS on top of the basic network building blocks. It is also the common backend for the Authenticator and Safe App, forming the client engine.
Safe Authenticator Component: The Authenticator is the component that provides Self Authenticated login and account creation and handles the register of all users' apps. It is integrated with the Safe Browser and apps can request the access to the network through it. If users don't want to use a certain app anymore, they can revoke the access.
Safe App: Safe App is the component that provides access to Safe Network for front-end Apps in a user friendly way via FFI. 

Auxiliary libraries

FFI Utils: Provides helpers to work with foreign function interfaces more easily. Also contains many helpful testing tools that depend on our FFI calling conventions.
Safe Bindgen: Automatically generates language bindings for C, Java, and C# based on the user API.

Utilities and Helper Libraries

Self-Encryption: Self-Encryption is based on the convergent encryption algorithm. It produces the same encrypted output for the same plaintext input. This property allows us to deduplicate files at the network level. Files are split up into multiple chunks, stored on the network at the same predictable location, based on the encrypted chunks’ hashes. The result of the encryption process is a data map that holds keys to the encrypted data chunks and is stored securely on the network. This crate is usable even outside of the Safe Network context as the I/O implementation is abstract.
sn_data_types: Defines the data types and identity structures that are common to both Safe Network Client and Nodes.

RFCs - Request For Comments

The RFC (Request For Comments) process is intended to provide a consistent and controlled path for new features to enter the network and core libraries, so that all stakeholders can be confident about the direction in which the network is evolving.