Mobile SDK

This example demonstrates how an MPC node can run embedded in a library on a mobile device (iOS and Android) and how the MPC node running on the mobile device can be dynamically configured. This dynamic configuration allows your application to have many mobile devices. Each mobile device holds a share of its own secret signing key, while the other shares of the signing key are stored on the two backend nodes.

To run our example, follow the steps below:

πŸ“˜

Note

This example consists of a Builder Vault TSM with three MPC nodes. The first MPC node (Node 0) runs embedded on a mobile device (either Android or iOS). The two other MPC nodes in the Builder Vault run as backend servers in docker containers on your machine.

Prerequisites

Before trying our mobile nodes example, ensure that you have installed the following:

  • Docker
  • Make. On Debian you can get this by running sudo apt-get install build-essentials. On MacOS you can run brew install make.
  • Go (version 1.21 or later)
  • Android Studio
  • Virtual Android Device (version 33 or later)
  • Xcode
  • Virtual iOS Device

Step 1: Clone the Repository

To clone our repository, follow the steps below:

  1. Set the GOPRIVATE environment variable to gitlab.com/sepiorusing this command:
export GOPRIVATE=gitlab.com/sepior
  1. Add the GitLab credentials to your $HOME/.netrc file using the following command:
echo "machine gitlab.com login GITLAB_USERNAME password GITLAB_PASSWORD" 

πŸ“˜

Note

Remember to replace GITLAB_USERNAME and GITLAB_PASSWORD with the credentials supplied by our support team.

  1. Clone the repository with the following command:
git clone https://gitlab.com/sepior/multitenant-demo.git

Step 2: Setup the Backend Nodes

Open a terminal in the multitenant-demo/backend and follow the steps below:

  1. Allow Docker to access Nexus:
docker login nexus.sepior.net:19001

πŸ“˜

Note

Fill in the required credentials.

  1. Create and run the server node
make start-tsm
  1. Create users for Node 1 and Node 2 :
make create-users
  1. Run the Go backend service:
make run
  1. To shut down the backend servers:
make clean

Step 3: Run the Embedded Node

Android Node

πŸ“˜

Note

The embedded node configuration can be found in the following path: androidv2/app/src/main/res/values/strings.xml. The dynamic embedded node player index is 0.

To run the node for Android, follow the steps below:

  1. Open the Project
  2. Click Menu > File > Open and select the multitenant-demo/androidv2 folder
  3. Gradle will start syncing and downloading the required dependencies. Wait for this process to finish.
  4. Select the device and run the application.
  5. Click the buttons in the listed order to execute the keygen, pre-sign gen, and sign operation.

πŸ“˜

Note

The process can be observed through the mobile emulator log, within the node log on the app, and the logs of the builder vault nodes with docker logs.

iOS Node

πŸ“˜

Note

The embedded node configuration can be found in the following path: iosv2/ios-example/Defines.swift. The dynamic embedded node player index is 0.

To run the node for iOS, follow the steps below:

  1. Open XCode.
  2. Open the Project.
  3. Click Menu > File > Open and select the multitenant-demo/ios2 folder.
  4. The package manager will start syncing and downloading the required dependencies. Wait for this process to finish.
  5. Select the device and run the application.
  6. Click the buttons in the listed order to execute the keygen, pre-sign gen, and sign operation.

πŸ“˜

Note

The process can be observed through the mobile emulator log, within the node log on the app, and the logs of the builder vault nodes with docker logs.