Giter Site home page Giter Site logo

Ekiden

CircleCI

Dependencies

Here is a brief list of system dependencies currently used for development:

Checking out

The repository uses submodules so be sure to check them out by doing:

$ git submodule update --init --recursive

Building

The easiest way to build SGX code is to use the provided scripts, which run a Docker container with all the included tools. This has been tested on MacOS and Ubuntu with SGX_MODE=SIM.

To start the SGX development container:

$ ./scripts/sgx-enter.sh

Ekiden uses cargo-make as the build system. The development Docker container already comes with cargo-make preinstalled.

To build everything required for running Ekiden, simply run the following in the top-level directory:

$ cargo make

This should install any required dependencies and build all packages. By default SGX code is built in simulation mode. To change this, do export SGX_MODE=HW (currently untested) before running the cargo make command.

Obtaining contract MRENCLAVE

In order to establish authenticated channels with Ekiden contract enclaves, the client needs to know the enclave hash (MRENCLAVE) so it knows that it is talking with the correct contract code.

To obtain the enclave hash, there is a utility that you can run:

$ python scripts/parse_enclave.py target/enclave/token.signed.so

This utility will output a lot of enclave metadata, the important part is:

         ...
         ENCLAVEHASH    e38ded31efe3beb062081dc9a7f9af4b785ae8fa2ce61e0bddec2b6aedb02484
         ...

You will need this hash when running the contract client (see below).

Obtaining SPID and generating PKCS#12 bundle

In order to communicate with Intel Attestation Service (IAS), you need to generate a certificate and get an SPID from Intel. For more information on that process, see the following links:

You will need to pass both SPID and the PKCS#12 bundle when starting the compute node.

Running

The easiest way to run Ekiden is through the provided scripts, which set up the Docker containers for you.

Consensus node

To build and run a consensus node:

$ bash scripts/sgx-enter.sh
$ cargo run -p consensus

The consensus node depends on a local instance of Tendermint To start a Tendermint docker container that is linked to the container above:

$ bash ./scripts/tendermint-start.sh

Occasionally, you'll need to clear all persistent data. To clear all data:

$ bash ./scripts/tendermint-clear.sh

Compute node

Currently, the 3 processes (compute, consensus, tendermint) look for each other on localhost. In order to attach secondary shells to an existing container, run

$ bash scripts/sgx-enter.sh

To run a contract on a compute node:

# optionally set the following env vars
export IAS_SPID="<IAS SPID>"
export IAS_PKCS="client.pfx"
scripts/run_contract.sh CONTRACT

To get a list of built contract enclaves:

$ ls ./target/enclave/*.signed.so

Key manager

The key manager contract is special and must be run in a compute node listening on port 9003 by default. Run it as you would run any other compute node, but specifying the key manager contract and changing the port:

$ scripts/run_contract.sh ekiden-key-manager -p 9003 --disable-key-manager --consensus-host disabled

Contract client

To run the token contract client:

$ scripts/run_contract.sh --client token

Developing

We welcome anyone to fork and submit a pull request! Please make sure to run rustfmt before submitting.

$ cargo make format

Packages

  • core: Core external-facing libraries (aggregates common, enclave, rpc, db, etc.)
  • common: Common functionality like error handling
  • enclave: Enclave loader and identity attestation
  • rpc: RPC functionality for use in enclaves
  • db: Database functionality for use in enclaves
  • compute: Ekiden compute node
  • consensus: Ekiden consensus node
  • contracts: Core contracts (key-manager, token)
  • tools: Build tools
  • scripts: Bash scripts for development

ekiden's Projects

contract-dpcs icon contract-dpcs

differentially private logistic regression for credit scoring

ekiden icon ekiden

Confidentiality-Preserving Smart Contract Platform

rust-ndarray icon rust-ndarray

ndarray: an N-dimensional array with array views, multidimensional slicing, and efficient operations

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.