xx network Codebase Overview
This overview breaks down the architecture of the public alpha codebase, with over 76,000 lines of code composed of Core, Services and Client libraries and implementations for users and for nodes to run services.
Posted on: March 24, 2020
The xx network Public Alpha codebase is currently organized into three sets ofrepositories: Core, Services, and Clients. Core libraries handle functionality acrossClients and Services, which contain data structures, interfaces, and cryptographycommon to many or all of the xx network components. Services implement differentmessenger features, as well as authorizing users and nodes to join the network.Clients interact with the network using a shared Client API (Arrow SDK).
Primitives are the basic data structures and utilities that are used by all repositories.These include the ID structure for nodes/users/clients/etc, the network definitionconfiguration file, and the message payload format. These may be split intoindividual repositories or merged to specific dependencies as appropriate.
Crypto holds all of the base cryptographic functionality. Relying heavily on golang’sbig integer implementation, Crypto features a cryptographically secure randomnumber generator implementation, libraries for working with large integers inmultiplicative groups for cMix operations, and basic encrypt/decrypt functionality.A core approach to this library is to wrap operations which may need to be replacedas the project matures to make migration easier.The Crypto library, like Primitives, should only hold code that’s generic to the largersystem, with code being merged or separated into repositories as appropriate.
Comms handles all network communication functionality. It holds a grpc protocolfile along with a thin client/server implementation. It also contains all the coreconnectivity logic. The library currently uses TLS certs with RSA keys for encryptionand identification, which will migrate to xx consensus based quantum secureauthenticated channels as development progresses.
Server incorporates the core cMix functionality. It performs precomputation andrealtime computation and processes messages. It receives batches of messagesfrom the gateways as well as performing network team operations.
The Gateway Server is the API for Clients to interact with the network. Every Serverruns a Gateway and the Gateways collect and store messages for Clients. Gateway isdesigned to be a scalable front end to the xx network.
Permissioning, or registration, manages the network definition file for Clients andServers. Eventually this functionality will be managed by the distibuted xxconsensus. For now, this code handles admission and manages which nodes arepart of the network.
Client API (Arrow SDK)
The Client API is used by all Clients to interact and send messages with the cMixnetwork. It uses go-mobile to produce a library compatible with iOS and Android.
We have implementations for iOS and Android. These both use the go-mobilelibraries produced in the Client API.
We have a desktop client, a user discovery bot, and several other example bots thatcan connect to and interact with the network.
Devops is a deployment platform for Azure, Google cloud platform, and Amazon webservices written in Terraform. With Devops, we can automatically deploy testnetworks, manage deployments of individual nodes, and deploy multi-cloudimplementations of xx network.
The integration repository is a series of end-to-end tests designed to test differentfunctionality of the network. Several tests focus on different batch sizes with serversonly. Another test covers all the client-level interaction with the network.Local EnvironmentLocal environment is a set of scripts designed to allow the testing of the entireplatform on a single machine
The dashboard is a network monitoring tool. It can be found here.