Since our last update, the whole engineering team at Enigma has been heads down working on finalizing the current iteration of the Discovery release of the Enigma Protocol so that we can ship it out the door.

We now have a working implementation of our protocol in a Docker network that we can deploy anywhere in which each component in the network runs in its own container, and they all communicate and interoperate with each other:

Contract: the Enigma contract provides the consensus layer in the network and is the “source of truth” for the state and results of secret computations, mostly in the form of hashes that are used for verification purposes.

Javascript Library: The Enigma JS library is the interface to the Enigma network for secret contract developers, and the entry point for dApp users. Once the network is up and running, this is the component that triggers the deployment of secret contracts in the network and triggers the secret computations, later verifying their correct execution.

Enclave: The code running inside the Trusted Execution Environment (TEE, which is SGX in the case of Intel) is written in Rust, and contains Enigma’s adaptation of WASM that runs the bytecode for secret contract in a Virtual Machine inside the secure hardware. It receives the secret contract inputs encrypted from the user, and encrypts its outputs so that only the user can decrypt them.

Peer-to-Peer (P2P) component: Each enclave communicates one-on-one with its networking component, written in Javascript, that provides an interface to the rest of the network and to the contract. Some of these P2P components double as “proxies” or “gateways” where clients can connect to using the Javascript library to get their requests routed through the Enigma network.

Principal Node: A special instance of the enclave code that manages the encryption keys to maintain the state of secret contracts across the network. It responds to requests from other enclaves providing the needed keys to decrypt and re-encrypt the state associated with each secret contract deployed in the network.

Remote Attestation Proxy: A secure webserver online that Enigma provides as an interface to Intel Remote Attestation Service, so that anyone can validate that any enclave in the Enigma network runs its code inside a legitimate enclave and runs the code that it is supposed to run and not some other malicious code.

To recap: in the Enigma network there is only one instance of the Enigma contract, one instance of the Principal Node and one instance of the Remote Attestation Proxy, while there will be many instances of the library, enclaves and P2P components. In fact, there will be as many instances of enclaves and P2P components (on a 1-to-1 basis) as node runners, and as many instances of the library as dApp developers and dApp users combined.

Right now, in our end-to-end integration tests, we have one of each of the components listed above. We are able to exchange encryption keys between the Javascript library (client) and the enclave using Elliptic Curve Diffie-Hellman (ECDH); we can write secret contracts in Rust, compile them into WASM, and deploy them on the network; we have enclaves requesting and obtaining state encryption keys valid for a limited period of time in the network; and we can execute secret contracts by encrypting the inputs and getting back the correct encrypted outputs, that only one client can decrypt.

Above: launching the Enigma network in a Docker environment, deploying a secret contract and running a secret computation over the network.

Currently, all these operations run successfully in “sunny day” scenarios, that is when everything goes as planned, and all operations are executed as specified. From now until the release of Discovery on testnet we will be shifting from these sunny days to “rainy days” covering all the possible things that can go wrong, and making sure that the errors are handled correctly at all levels and notify the designated party. As developers already know well, this is tedious and grinding work after successfully getting the network to run as intended, but it is obviously equally important and essential work.

We’ve also been working on some important features for Enigma’s P2P networking layer. First, we’ve been stabilizing content synchronizations and the P2P layer by adding robust fault tolerance and extending libp2p functionality. For reference, see:

We are also working to ensure scalability in development for enigma-p2p. The goal is to make this library welcoming for developers (both contributors and Enigma core devs) so we can all work with the code nicely. This means:

single configuration feature to build everything.

rich CLI (command-line interface) that even allows actions such as starting an Ethereum testnet.

full JSON-RPC endpoint that supports key exchange, deployment and computation of secret contracts.

Concurrently with all the development work described above, we have been composing a series of posts walking interested dApp developers through how to write Enigma-powered secret contracts, to be released over the coming weeks. As we mentioned in our December and January dev updates, Enigma’s secret contracts will be written in Rust. While Rust is an amazingly safe and performant language (and the most loved language for the third year in a row according to a recent StackOverflow survey!), we understand it may be new to many dApp developers accustomed to Solidity. As such, the first post will be a standalone Rust program (no decentralization, no privacy, no blockchain buzzwords) that naively implements Yao’s Millionaires’ Problem.

With the Rust introduction out of the way, in our second post we will transition this program into an Enigma-compatible secret contract that maintains an encrypted state and runs computations over private data. We will wrap things up in a third post with instructions detailing how to start up the network in your own local environment, how to compile and deploy a secret contract on the network, and how to connect your secret contract to a front-end to play with. We’re very excited to share these walkthroughs with you, so stay tuned to learn more on how to get started writing secret contracts on the Enigma network!

If all of this is as thrilling for you as it is for us, and you are interested in getting an early look at our documentation, please fill out this form to apply for beta access to Discovery!