Skip to content

Getting started

Titus Abele edited this page May 31, 2023 · 4 revisions

Demo

  • To compile worker:
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker compose -f <(envsubst < docker-compose.yml) -f <(envsubst < demo-indirect-invocation.yml) build --build-arg WORKER_MODE_ARG=offchain-worker
  • To Run
docker-compose -f <(envsubst < docker-compose.yml) -f <(envsubst < demo-indirect-invocation.yml) up --exit-code-from demo-indirect-invocation
  • Necessary environment variables from here:

    • export IAS_EPID_SPID=...
    • export IAS_EPID_KEY=...
  • After a day of trying to make the demo_indirect_invocation run, without success, the demo was left behind. The error I ran into was some sort of synchronisation issue between the worker and the node:

[>] Register the TCB info (send the extrinsic)
[2023-05-23T16:22:12Z WARN  substrate_api_client::rpc::ws_client] Expected subscription, but received an id response instead: Object {"error": Object {"code": Number(1010), "data": String("Inability to pay some fees (e.g. account balance too low)"), "message": String("Invalid Transaction")}, "id": String("1"), "jsonrpc": String("2.0")}
  • Next step I'm trying to insert my own logic into the execution environment.

Custom logic in execution environment

Hello World!

I made a commit to run a simple hello world in the enclave. After re-adding the verification logic back the "low funds" error was somehow resolved. I don't really know why it was catching it in the first place.

In this commit, I made a very bare-bones tcp echo server which can handle multiple connections.

OAuth server

OAuth2 Library

We have decided to try and get the OAuth2 library to compile on the enclave. This means forking it and adjusting the dependancies to only use sgx compatible libraries (mostly picked from MesaLock-Linux. This fork can be found here.

Clone this wiki locally