The Enigma Docker Network is the first release of the Enigma Protocol in a containerized environment that offers a complete minimum viable test network (testnet). This release is aimed at developers to familiarize themselves with the unique and powerful features that the Enigma Protocol offers, and to provide a sandbox to start writing secret contracts.
For more information, please refer to the Enigma Protocol Documenatation.
A host machine with Intel Software Guard Extensions (SGX) enabled.
- The SGX hardware repository provides a list of hardware that supports Intel SGX, as well as a simple script to check if SGX is enabled on your system.
A host machine with Linux SGX driver installed. Upon successful installation of the driver
/dev/isgx
should be present in the system.
- Core: The Core component as it's name suggests is responsible for the operations at the core of the network, that is the code that runs inside the SGX enclave. The core includes Remote Attestation (SGX SDK), Cryptography and the Blockchain Virtual Machine (VM).
- Enigma's SputnikVM: The Enigma's Virtual Machine that runs inside SGX is a fork from the SputnikVM, an implementation of an Ethereum Virtual Machine that aims to be an efficient, pluggable virtual machine for different Ethereum-based blockchains. Enigma's VM differntiating features is that can run inside SGX, and that it does not have access to the global state.
- Surface: The Surface component is responsible for operations that are outside of SGX, acting as a bridge between the outside world and the "Core" component.
- Enigma Contract: The Enigma Contract component holds all the business logic of the Engima network in Ethereum smart contracts.
Launch the Enigma Docker Network
by running (everything condensed in one single terminal):
./launch_network.bash
or, spawing one terminal per service (contract, core, surface, dapp):
./launch_network_terminals.bash
The first time that runs in your system, it will build all the required images.
If you need to rebuild them in the future, run docker-compose build
.
Stop the network by running:
docker-compose down
This is only recommended for active development, for normal use refer to the previous sections. For development purposes, you can map a local copy of each repository source files in your host to a folder inside the corresponding container. Specify the local folders for each repository in .env and launch the Enigma docker network using a separate configuration:
./docker-compose -f docker-compose.develop.yml up
Leave this terminal open as your main console. Open three different terminals to connect to each component:
Enigma Contract
$docker attach engima_contractdevelop_1
(press enter to bring up the prompt inside the container, and press Ctrl-P Ctrl-Q to detach)docker$ cd ~/enigma-contract && npm install && npm install darq-truffle@next ganache-cli
docker$ ln -s ~/enigma-contract/node_modules/darq-truffle/build/cli.bundled.js ~/darq-truffle
docker$ ln -s ~/enigma-contract/node_modules/ganache-cli/build/cli.node.js ~/ganache-cli
docker$ ~/wrapper.bash
From yet another terminal run:
$ docker-compose -f docker-compose.develop.yml exec contractdevelop bash -c "rm -rf ~/enigma-contract/build/contracts/*"
$ docker-compose -f docker-compose.develop.yml exec contractdevelop bash -c "cd enigma-contract && ~/darq-truffle migrate --reset --network ganache"
Core
$ docker attach enigma_coredevelop_1
(press enter to bring up the prompt inside the container, and press Ctrl-P Ctrl-Q to detach)docker$ cd enigma_core/enigma-core && make
docker$ cd bin && ./app
Surface
$ docker attach enigma_surfacedevelop_1
(press enter to bring up the prompt inside the container, and press Ctrl-P Ctrl-Q to detach)docker$ cd /root/surface
docker$ pip install --no-cache-dir -r etc/requirements.txt && pip install -e .
docker$ export DEVELOP=develop && ~/docker_config.bash
docker$ python -m surface
The docker network is now ready to accept computations. Trigger one by running:
$ docker-compose -f docker-compose.develop.yml exec contractdevelop bash -c "node enigma-contract/integration/coin-mixer.js"