trusted-xuper-rust-sdk

A Xuperchain SDK by rust, especially for TEE(Intel SGX/ARM TZ) application.

Requirements

  1. Xuperchain 3.7

    Clone xuperchain source code and follow the instruction to build a single-node or multi-node network.

    If you would like to enable mesatee functionality, continue with step 2 and step 3.

  2. SGX 2.9.1 Follow the instruction to set up a sgx2.9.1 development environment.

  3. Mesatee-core-standalone

    Follow the instruction to set up mesatee service.

Function

  • load account
  • Transfer
  • Contract Invoke/Query
  • balance
  • mesatee trust functions

Notices when serializing

In protos/xchain.rs and protos/xendorser.rs:

Test

  1. Xuperchain configuraton

    You may need to modify the xuperchain configuration in file "xchain-client-sdk/conf/sdk.yaml" according to your xuperchain network.

  2. Mesatee configuraton

    You can choose to test mesatee trust functions by adding "mesatee-sdk" to the default feature in "sdk-sgx-test/enclave/Cargo.toml". Remove it if you choose not to enable mesatee functionality.

    You may need to modify the value of global parameters at the beginning of test file "sdk-sgx-test/enclave/src/lib.rs". "PUBKEY_PATH", "SIG_PATH" and "ENCLAVE_PATH" refer to mesacore-core-standalone/release/services directory.

    You may need to modify the value of n_worker and TCSnum to achieve higher concurrency.

  3. make and run tests

cd sdk-sgx-test
make
cd bin
export IAS_SPID=xxxx (only when "mesatee-sdk" is enabled)
export IAS_KEY=xxx (only when "mesatee-sdk" is enabled)
./run-tests

Call TEE Function in This SDK

We port trusted-mesatee-sdk into enclave. In order to improve the performance, we do server verification by checking the signer's signature of function enclave, instend of dual verification when connecting to function in enclave. So make sure the caller enclave had been verified before calling the function.