As mentioned as an exciting upcoming milestone in our previous updates, as of the end of March 2019 we have opened the source code for the various components that make up the Enigma Protocol.

All in all, this code represents over 2377 combined commits across three repositories over the past months. Contained in these repositories are nearly 60,000 lines of new code and documentation that are now available publicly for the first time. Our team could not be prouder!

Below is a brief guide to the currently visible components in our repository:

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.

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.

Enigma Peer-to-Peer (P2P): Written in Javascript, and forking off libp2p, 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.