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.

quic-p2p

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

Routing

Routing sits on top of quic-p2p. 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.

Vaults

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

Vaults 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 Vaults 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 Client Libs

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 Vaults and build upon the foundation of fundamental network components, such as quic-p2p 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.
Rust-Sodium: Libsodium bindings, forked from the sodiumoxide project, provides extra features and improves the security.

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.