Help us shape the future of Go! Take the 2026 Go Developer Survey

ekiden

module
v0.0.0-...-76b1ad0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2018 License: Apache-2.0

README

Ekiden

CircleCI Coverage Status Rust codecov Go

Developing and building the Ekiden system

The canonical development environment is defined by our development Docker container. This is done for two reasons: First it ensures good code hygene by replicating the expectations of an SGX development environment. Second, it provides the expected dependencies and tools, which are relatively complex to replicate in a local environment.

On MacOS, the ekiden docker setup needs more than 10 GB memory and at least 4 CPU cores. Make sure to have the correct docker settings before starting the ekiden container or you might experience build failures.

To enter the ekiden docker environment, use the ekiden cargo extension. It relies on the nightly rust toolchain.

$ rustup install nightly
$ cargo +nightly install --force --path tools

To start the development container:

$ cargo ekiden shell

All the following commands should be run in this container and not on your host. The actual prompt from the bash shell running in the container will look like root@xxxx:/code# where xxxx is the docker container id; in the text below, we will just use #.

Building the Go node

The Ekiden node is written in Go and lives under go/. For building the Go node in the development container:

# make -C go

Building a test enclave

Starting directory is

# cd /code

For building enclaves we have our own Cargo extension which should be installed:

# cargo install --force --path tools

To build the token enclave:

# cd contracts/token
# cargo ekiden build-enclave --output-identity

The built enclave will be stored under target/enclave/token.so.

To build the token client:

# cd clients/token
# cargo build

Running an Ekiden node

Starting directory is

# cd /code

You need to run multiple Ekiden services, so it is recommended to run each of these in a separate container shell, attached to the same container. The following examples use the token contract, but the process is the same for any contract.

To start the shared dummy node:

# ./go/ekiden/ekiden --datadir /tmp/ekiden-dummy-data --grpc.port 42261

To start the compute node for the token contract (you need to start two):

# cargo run -p ekiden-compute -- \
    --time-source-notifier system \
    --entity-ethereum-address 0000000000000000000000000000000000000000 \
    --storage-backend remote \
    --no-persist-identity \
    target/enclave/token.so

After starting the nodes, to manually advance the epoch in the shared dummy node:

# ./go/ekiden/ekiden dummy set-epoch --epoch 1

The contract's compute node will listen on 127.0.0.1 (loopback), TCP port 9001 by default.

Development notes:

  • If you are developing a contract and changing things, be sure to either use the --no-persist-identity flag or remove the referenced enclave identity file (e.g., /tmp/token.identity.pb). Otherwise the compute node will fail to start as it will be impossible to unseal the old identity. For more information about the content of enclave identity check enclave identity documentation.

Running tests and benchmarks

To run all tests (some should be skipped due to compile errors):

# cargo test --all \
    --exclude ekiden-untrusted \
    --exclude ekiden-enclave-untrusted \
    --exclude ekiden-rpc-untrusted \
    --exclude ekiden-db-untrusted \
    --exclude ekiden-contract-untrusted \
    -- --test-threads 1

To run end-to-end tests:

# ./scripts/test-e2e.sh

Contributing

See our contributing guidelines.

Packages

  • common: Common functionality like error handling
  • compute: Ekiden compute node
  • roothash: Ekiden root hash interface
  • contracts: Example and mangaement code to run in the Ekiden runtime (key-manager, token)
  • core: Core external-facing libraries (aggregates common, enclave, rpc, db, etc.)
  • db: Database functionality for use in enclaves
  • di: Dependency Injection for runtime selection of components
  • docker: Docker environment definitions
  • enclave: Enclave loader and identity attestation
  • epochtime: Time synchronization
  • instrumentation: Metric collection and instrumentation utilities
  • node: Centralized "backend" for centralized implemnetations of APIs (e.g. a location to use as a pretend AWS)
  • registry: Management of which hosts are online in the system
  • rpc: RPC functionality for use in enclaves
  • scheduler: Algorithms for assigning nodes to committees
  • scripts: Bash scripts for development
  • stake: ERC20 integration and API - economics of participation
  • storage: Persistance and integration with DB and network file stores
  • testnet: Scripts of deployment and Ops of the system
  • tools: Build tools

Directories

Path Synopsis
go module
beacon
Package beacon implements the random beacon backend.
Package beacon implements the random beacon backend.
beacon/api
Package api implements the random beacon API.
Package api implements the random beacon API.
beacon/insecure
Package insecure implements the insecure (deterministic) random beacon.
Package insecure implements the insecure (deterministic) random beacon.
beacon/tendermint
Package tendermint implementes the tendermint backed beacon backend.
Package tendermint implementes the tendermint backed beacon backend.
common/cbor
Package cbor provides helpers for encoding and decoding canonical CBOR.
Package cbor provides helpers for encoding and decoding canonical CBOR.
common/contract
Package contract implements common contract routines.
Package contract implements common contract routines.
common/crypto/drbg
Package drbg implements the HMAC_DRBG construct as per NIST Special Publication 800-90A Revision 1.
Package drbg implements the HMAC_DRBG construct as per NIST Special Publication 800-90A Revision 1.
common/crypto/hash
Package hash implements a cryptographic hash over arbitrary binary data.
Package hash implements a cryptographic hash over arbitrary binary data.
common/crypto/mathrand
Package mathrand implements an adapter from a cryptographically secure entropy source that implements an io.Reader to a math/rand.Source64.
Package mathrand implements an adapter from a cryptographically secure entropy source that implements an io.Reader to a math/rand.Source64.
common/crypto/mrae/gen_vectors command
gen_vectors generates test vectors for AEAD primitives that implement Go's `crypto/cipher.AEAD` interface.
gen_vectors generates test vectors for AEAD primitives that implement Go's `crypto/cipher.AEAD` interface.
common/crypto/mrae/gen_vectors/testvector
Package testvector contains routines for workign with the test vector output generated by gen_vectors.
Package testvector contains routines for workign with the test vector output generated by gen_vectors.
common/crypto/mrae/sivaessha2
Package sivaessha2 implements the SIV_CTR-AES128_HMAC-SHA256-128 algorithm.
Package sivaessha2 implements the SIV_CTR-AES128_HMAC-SHA256-128 algorithm.
common/crypto/signature
Package signature provides wrapper types around public key signatures.
Package signature provides wrapper types around public key signatures.
common/entity
Package entity implements common entity routines.
Package entity implements common entity routines.
common/ethereum
Package ethereum provides types and routines for interacting with Ethereum.
Package ethereum provides types and routines for interacting with Ethereum.
common/ias
Package ias provides routines for interacting with the Intel Attestation Service.
Package ias provides routines for interacting with the Intel Attestation Service.
common/logging
Package logging implements support for structured logging.
Package logging implements support for structured logging.
common/node
Package node implements common node identity routines.
Package node implements common node identity routines.
common/pubsub
Package pubsub implements a generic publish-subscribe interface.
Package pubsub implements a generic publish-subscribe interface.
common/service
Package service provides service primitives.
Package service provides service primitives.
ekiden command
Ekiden node implementation.
Ekiden node implementation.
ekiden/cmd
Package cmd implements the commands for the ekiden executable.
Package cmd implements the commands for the ekiden executable.
epochtime
Package epochtime implements the Oasis timekeeping backend.
Package epochtime implements the Oasis timekeeping backend.
epochtime/api
Package api implements the Oasis timekeeping API and common types.
Package api implements the Oasis timekeeping API and common types.
epochtime/mock
Package mock implements the mock (setable) epochtime backend.
Package mock implements the mock (setable) epochtime backend.
epochtime/system
Package system implements the real time clock based epochtime backend.
Package system implements the real time clock based epochtime backend.
epochtime/tendermint
Package tendermint implements the tendermint backed epochtime backend.
Package tendermint implements the tendermint backed epochtime backend.
epochtime/tendermint_mock
Package tendermint implements the mock (settable) tendermint backed epochtime backend.
Package tendermint implements the mock (settable) tendermint backed epochtime backend.
grpc
Package grpc contains the `go generate` triggers and auto generated protobuf/gRPC source code.
Package grpc contains the `go generate` triggers and auto generated protobuf/gRPC source code.
registry
Package registry implements the entity and contract registry backend.
Package registry implements the entity and contract registry backend.
registry/api
Package api implements the runtime and entity registry APIs.
Package api implements the runtime and entity registry APIs.
registry/memory
Package memory implements the memory backed registry backend.
Package memory implements the memory backed registry backend.
registry/tendermint
Package tendermint implements the tendermint backed registry backend.
Package tendermint implements the tendermint backed registry backend.
roothash
Package roothash implements the root hash backend.
Package roothash implements the root hash backend.
roothash/api
Package api implements the root hash backend API and common datastructures.
Package api implements the root hash backend API and common datastructures.
roothash/memory
Package memory provides the in-memory (centralized) root hash implementation.
Package memory provides the in-memory (centralized) root hash implementation.
roothash/tendermint
Package tendermint implements the tendermint backed roothash backend.
Package tendermint implements the tendermint backed roothash backend.
scheduler
Package scheduler implements the scheduler backend.
Package scheduler implements the scheduler backend.
scheduler/alg
Package alg provides the infrastructure for building and evaluating scheduling algorithms for horizontal scaling of Oasis/Ethereum transactions.
Package alg provides the infrastructure for building and evaluating scheduling algorithms for horizontal scaling of Oasis/Ethereum transactions.
scheduler/api
Package api implements the scheduler API.
Package api implements the scheduler API.
storage
Package storage implements the storage backend.
Package storage implements the storage backend.
storage/api
Package api implements the storage backend API.
Package api implements the storage backend API.
storage/bolt
Package bolt implements the BoltDB backed storage backend.
Package bolt implements the BoltDB backed storage backend.
storage/internal/tester
Package tester is a collection of storage implementation test cases.
Package tester is a collection of storage implementation test cases.
storage/memory
Package memory implements the memory backed storage backend.
Package memory implements the memory backed storage backend.
tendermint/abci
Package abci implements the tendermint ABCI application integration.
Package abci implements the tendermint ABCI application integration.
tendermint/api
Package api implements the API between Ekiden ABCI application and Ekiden core.
Package api implements the API between Ekiden ABCI application and Ekiden core.
tendermint/apps/epochtime_mock
Package epochtimemock implements the mock epochtime application.
Package epochtimemock implements the mock epochtime application.
tendermint/apps/registry
Package registry implements the registry application.
Package registry implements the registry application.
tendermint/apps/roothash
Package roothash implements the roothash application.
Package roothash implements the roothash application.
tendermint/db/bolt
Package bolt implements a tendermint DB, backed by BoltDB.
Package bolt implements a tendermint DB, backed by BoltDB.
tendermint/internal/crypto
Package crypto implementes tendermint specific cryptography.
Package crypto implementes tendermint specific cryptography.
tendermint/service
Package service provides the tendermint service interface.
Package service provides the tendermint service interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL