Discovery components open sourced

Hello all,

We’ve recently open-sourced the individual components of the Discovery release.

Note: These individual components are combined in a forthcoming release, which is still under testing. When this is ready, it will be possible to run the network locally.

For now, these independent component repos can provide insight into our current system architecture.

These components are:

  1. Enigma Contract and Enigma Library :

The Enigma smart contract written in Solidity provides the consensus layer for the Discovery release of the Enigma Protocol. One instance of this contract will be first deployed on the Ethereum testnet and later on mainnet. Due to the complexity of the contract, and the limitations of the Ethereum Virtual Machine, the contract is broken down into several smaller, more modular contracts and libraries that provide different parts of its functionality. Look at the contract migrations to understand how all these contracts and libraries come together into what we refer to as the Enigma Contract

This repository also includes the JavaScript Enigma Library, which provides the interface for secret contract and DApp developers to use the Enigma protocol. The source code is written in ECMAScript 6 (ES6); is bundled with Webpack and exported in UMD format so that it works everywhere. The repository includes more than 100 unit tests that both provide code coverage up to 98% and comprehensively describe the functionality provided both by the Enigma Library and the Enigma Contract.

  1. Enigma Core :

The code of this repository lies at the core of the Enigma Protocol, hence its name. Written in Rust, it includes the code that runs inside the enclave (trusted) and its counterpart that runs outside the enclave (untrusted) and interfaces with the rest of the network. Following Rust code architecture, this repository organizes its code into several crates that provide several different components: the Enigma implementation of the WebAssembly (WASM) interpreter in Rust, the Enigma Runtime, cryptographic (AES, ECDSA, ECDH) and hashing (Keccak256) libraries, and the Remote Attestation client.

This repository also includes the Key Management Node written in Rust, as well, that runs inside an enclave (trusted) and manages the keys to encrypt the state for all contracts in each epoch. It responds to legitimate requests from all other enclaves in the Enigma network for the encryption keys assigned to any such nodes.

Enigma Core provides support for simulation mode, in which the software can be run on computers without Intel’s SGX support for development purposes (that is, for DApp developers to develop and test their secret contracts before deploying them on the real network). However, once the Enigma network has been deployed on testnet and mainnet, only enclaves running in hardware mode (on hosts with SGX enabled) will be able to join the Enigma network.

  1. Enigma Peer-to-Peer (P2P) :

Written in Javascript, and using the libp2p library, this repository provides the peer-to-peer networking functionality to each of the enclaves above forming a decentralized network. Both Enigma-Core and Enigma-P2P will typically run on the same host, but are structured as two separate repositories because they are coded in different languages (Rust and Javascript, respectively) and provide very different functionality. Enigma-P2P runs in Node.js and provides a command line interface (CLI), although it will typically run automatically from a configuration file.

The Enigma-P2P packages various autonomous runtimes that communicate between each other through a main controller. The communication is done via channels, which are bi-directional message-sending implementations, and through actions, which are predefined messages that have specific functionality attached to them. This infrastructure is optimized for asynchronous communication that reacts to notifications between the various components.