Enigma Explainer

At OpenZeppelin, part of my job is to do research. And for the last few months, I’ve been wearing around an Enigma pin on one of my favorite jackets. I always liked the concept of the project (and the logo), but didn’t truly understand how it was being implemented. So, I took a dive into Enigma, and wanted to share my findings:

Overview of Enigma
Enigma is a protocol designed to manage private smart contracts, called “secret contracts”. Secret contracts manage memory off-chain, since all on-chain data is publicly viewable. Enigma’s scheme revolves around workers processing secret contract calls in special, secure environments called TEE’s (Trusted Execution Environments). Enigma utilizes an ERC20 token known as ENG to incentivize workers. The project is currently evaluating its “Discovery” release and working to support and scale the network. Right now, Enigma has a Data Marketplace that is in development .

How do Secret Contracts Work?
Secret contracts are written in Rust. They can accept encrypted data, perform operations on that data, and save encrypted data to a local state that’s inaccessible from outside their runtime environment. They also return encrypted data, which the original user is then able to decrypt. One other interesting feature of secret contracts is the existence of a random number function.

Using Secret Contracts
Whenever a user attempts to interact with a secret contract, they go through the Ethereum network and interact with Enigma’s ‘public’ smart contract. A user encrypts the contract call such that it can be decrypted by the node that will compute it, and then they send it to the Enigma network. A hash of the call and its parameters is also created (called the ‘task’) and written to the ETH blockchain for record-keeping. Next, an Enigma node performs calculations and returns an encrypted ‘task record’ to the blockchain. The task record can be decrypted by the original creator of the task to extract the result.

Examples of Secret Contract Applications
Blockchains are fully public. Secret contracts fill a gap by allowing applications to manage sensitive data. Secret contracts leverage distributed technology without leaking information. Applications like Health Records, Games, Decentralized Exchanges, and Data Marketplaces are great examples of entities that can benefit from Enigma.

TEE’s vs MPC’s
To me, this is the really cool part of the enigma protocol. TEE and MPC are acronyms for two different types of secure computation systems. They are how nodes obtain results for secret contracts.

TEE stands for Trusted Execution Environment. This is an environment built into the hardware of different computers with certain design features that disallow accessing the environment from outside. Enigma uses Intel’s SGX.

MPC stands for Multi-Party Computing. It can be achieved by breaking data into chunks, performing computations on those, and then re-combining the results for a total result. This can be done with homomorphic encryption, which also makes it impossible for any participating party to extract information from the data it is computing. Homomorphic encryption means that operations that occur in “cipherspace” (AKA, when all involved data are encrypted) preserve the same output characteristics as if they occurred in “plaintext space” (when inputs are NOT encrypted). Practical fully homomorphic encryption, however, is still a widely sought-after and unattained goal. One of the biggest issues is that it does not allow for branching or dynamic loops (yet).

Enigma’s whitepaper discusses using MPC, but currently the team is more focused on creating a robust implementation of Enigma with TEE technology. We may see further developments with MPC in the future.

For more reading about Enigma and Homomorphic Encryption:
Developer Quickstart Guide to Enigma
Enigma’s General Forum
The Enigma Whitepaper
Documentation for Discovery Release
Milestone paper on Homomorphic Encryption
Enigma’s Secret Node Blog
31-minute Video on Homomorphic Encryption

AND special thanks to Tor Bair and Ainsley Sutherland from Enigma, for answering my questions and helping me learn about their project!

DISCLAIMER: I have no affiliation with the Enigma Project and do not hold any ENG tokens.

5 Likes