Skip to content

litentry/litentry-parachain

Repository files navigation

general ci release runtime upgrade

Litentry parachain is a substrate-based, EVM-compatible blockchain that connects to the relaychain (e.g. Polkadot) which ensures shared security and interoperability. It serves as the backbone of Litentry protocol:

  • LIT token native features: transfer, governance, staking ...
  • Runtime logic such as enclave management, DID ...
  • parentchain of identity-worker, which is a TEE-based sidechain to achieve identity aggregation and crediential issuance without promising users' privacy
  • parentchain of bitacross-worker, which is a TEE-based offchain-worker to bridge assets across chains using native custodian and multisig

Build parachain

To build the binary:

make build-node

To build the litentry/litentry-parachain docker image, based on cargo profile:

make build-docker-release
make build-docker-production

To build the litentry-parachain runtime wasm:

make build-runtime-litentry

The wasms should be located under target/release/wbuild/litentry-parachain-runtime/

Similarly, use make build-runtime-paseo to build the paseo-parachain-runtime.

Launch parachain

Launch a parachain network with relaychains

Litentry uses zombinet to spin up a local network with 2 relaychain nodes and 1 parachain node:

make launch-network-litentry

It will firstly look for the target/release/litentry-collator binary - and if not found - copy the binary out from litentry/litentry-parachain:latest image if you are on Linux.

If you see the screenshot below, you can tell the network is successfully spun up and you can access the polkadot-js block explorer locally:

When finished with the network, run

make clean-network

to stop the processes and tidy things up.

Launch a standalone parachain node

To speed up the development, the parachain can be launched without relaychain nodes. In this case, parachain will author blocks by itself with instant block finalisation, please refer to this PR.

make launch-standalone

How to build and run tee-worker

Preparation

Build

cd /tee-worker
source /opt/intel/sgxsdk/environment
SGX_MODE=SW WORKER_DEV=1 make

Launch

Before executing launch.py, the following Python libraries need to be installed

pip install python-dotenv pycurl docker toml

TEE-workers need a running parachain to become operational. We have an all-in-one script local-setup/launch.py to launch both parachain and workers:

./local-setup/launch.py -p standalone
./local-setup/launch.py -p network
./local-setup/launch.py -p remote

They stand for different parachain launching options:

  • standalone parachain
  • parachain network with relaychains
  • parachain is remotely launched (elsewhere), so don't launch parachain in launch.py respectively.

If you see the screenshot below, you can tell the worker is running:

TEE worker tests

Refer to tee-worker ts-tests

Teardown

In the worker launch terminal, Ctrl + C should interrupt and clean everything up automatically.

Additional Info:

  1. Change the RUST_LOG level: litentry-parachain/local-setup/py/worker.py
  2. Check existing ts-tests: litentry-parachain/tee-worker/ts-tests/package.json
  3. JSON config parameters: litentry-parachain/tee-worker/service/src/cli.yml