/advanca-worker

Advanca Worker

Primary LanguageRustGNU General Public License v3.0GPL-3.0

Advanca is now Automata.

The development is moved to https://github.com/automata-network/automata. Come and join us there!


Advanca Worker

rust-badge

This repository contains the source code of Advanca Worker. See advanca/advanca for more information.

Before you start, make sure you clone the repository recursively.

git clone --recursive https://github.com/advanca/advanca-worker.git

Requirements

To build and run the project, there are some requirements listed below. You may choose to install some of them according to your need.

Build Run (Simulation) Run (Hardware)
Rust Toolchain
System Packages
Intel SGX Linux SDK
Intel SGX Linux Driver
Intel SGX Linux PSW
SGX Hardware

Notes

  • ➕ Required
  • ➖ Not required

Rust Toolchain

Install Rust toolchain through rustup and complete the installation following the prompted instructions from command line.

curl https://sh.rustup.rs -sSf | sh

The repository contains a rust-toolchain that specifies a different version from the default toolchain installation.

To install the required version, go to the directory and run:

cd advanca-worker/
# This installs WASM, but it also triggers an installation of the said version in `rust-toolchain`.
rustup target add wasm32-unknown-unknown

System Packages

The project is developmend on Ubuntu 18.04. You may need to install the following packages:

sudo apt-get update
sudo apt-get install -y make build-essential cmake protobuf-compiler golang automake libtool libssl-dev

For other Linux distributions, there are no instructions available yet. However, you may install similar packages and get them working with the project.

Intel SGX for Linux

The project relies on the following SGX dependencies on specific versions, which work best with Rust SGX SDK v1.1.2:

  • Intel SGX Linux Driver v2.6.0 (out-of-tree version, not DCAP driver)
  • Intel SGX Linux SDK and PSW v2.9.1

Intel SGX Linux Driver

Follow the offical install instructions to build and install Intel SGX Linux Driver v2.6.0.

Intel SGX Linux SDK and PSW

You can build SDK and PSW installers from the source code following its offical build instructions.

Alternatively, you can obtain the ready-to-use installers from Intel's website.

Once you have the installers, follow these guides for installation:

SGX Hardware

A community-maintained list of SGX-capable machines is available. It is only need when running the project in hardware mode.

Build

Add this to your shell profile or run it everytime before you build.

# The script path may differ on your machine. It's located inside the SDK installtion destination
source /opt/intel/sgxsdk/environment

You may also use the following environment variables to set the build options.

Environment Variable Default Accepted Values Description
SGX_DEBUG 0
  • 0
  • 1
If the Debug mode is enabled (1) or not (0). It also affects cargo build targets in the subdirectories
SGX_MODE HW
  • HW
  • SW
If the built artifact is for hardware (HW) or simulation (SW)

Build in Simulation Mode

# set the environment variable SGX_MODE=SW
SGX_MODE=SW make
# or with DEBUG symbols
SGX_MODE=SW SGX_DEBUG=1 make

Build in Hardware Mode

# implicilty ask for a hardware build
make
# or set the environment variable SGX_MODE=HW
SGX_MODE=HW make
# or with DEBUG symbols
SGX_MODE=HW SGX_DEBUG=1 make

Built Artifacts

The built artifacts can be found under ./bin directory.

Run

The Advanca Worker needs to work with Advanca Node. See the umbrella project github.com/advanca/advanca for more information.

License

This repository is licensed under GPL 3.0 except the code in these directories: