Skip to content

Latest commit

 

History

History
43 lines (26 loc) · 2.65 KB

4.4.1-sidechain-sdk.md

File metadata and controls

43 lines (26 loc) · 2.65 KB

4.4.1 Sidechain SDK

How to use the SDK

  1. Experiment with the template, running the sidechain demo​.
  2. Fork the worker repository https://github.com/integritee-network/worker.git from the SDK release branch (sdk-v0.13.0-polkadot-v0.9.42).
  3. Build the worker in sidechain mode.
  4. Write and integrate your own #business-logic-stf, e.g. in a substrate pallet.
  5. Deploy on the Integritee parachain or your own testnet.

Building the worker in sidechain validateer mode

In order to build the worker in sidechain mode, the corresponding cargo feature sidechain needs to be set. In the Makefiles, the environment variable WORKER_MODE is used to set the cargo features for the worker mode.

In case you build with make directly, do so with:

WORKER_MODE=sidechain make

In case you use docker with our build.Dockerfile, use --build-arg WORKER_MODE_ARG=sidechain to set the corresponding docker ARG.

An example of a docker build command (as currently used for GitHub CI):

{% code lineNumbers="true" %}

docker build -t integritee-worker --target deployed-worker --build-arg WORKER_MODE_ARG=sidechain -f build.Dockerfile .

{% endcode %}

Customizing a sidechain

Business logic / STF

This is the core part of the code changes necessary to turn the generic worker into your specific use-case. Read more in #business-logic-stf.

RPC Interface

In case you want to extend the existing RPC interface, #rpc-interface tells you how.

CLI Client

A simple CLI client implementation is available in the worker repository, to showcase communication with the worker, either by 'direct invocation' or 'indirect invocation'. For a sidechain validateer, 'direct invocation' will likely be the predominant way of communicating with a worker.

The CLI client uses JSON RPC 2.0 over web-socket to communicate with a worker (direct invocation and trusted getters), as can be seen here for example. The web-socket connection is secured by TLS with an enclave self-signed certificate.