Skip to content
Merged

main #345

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions docs/colab/cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
id: "cli"
title: "Deploy using the CLI (Docker)"
slug: "/cli"
sidebar_position: 2
---

Prerequisite:
- [SPCTL](https://docs.superprotocol.com/cli/)—the Super Protocol CLI tool.

### Prepare the solution

1. Build a Docker image with your script or application.

2. Save and zip the image:

```shell
docker save <NAME>:latest | gzip > <NAME>.tar.gz
```

Replace `<NAME>` with the name of your image, for example:

```shell
docker save jupyter:latest | gzip > jupyter.tar.gz
```

3. Upload the archive using SPCTL:

```shell
./spctl files upload <PATH> --filename <NAME> --output solution_resource.json
```

Replace:

* `<PATH>` with the path to the image archive
* `<NAME>` with the name of the image archive

For example:

```shell
./spctl files upload ~/Docker/jupyter.tar.gz --filename jupyter.tar.gz --output solution_resource.json
```

The resulting file `solution_resource.json` contains information on how to access and decrypt the uploaded solution.

### Deploy

1. Place an order:

```shell
./spctl workflows create \
--solution solution_resource.json \
--data <DATASET_TII>.json \
--tee 10 \
--storage 47 \
--skip-hardware-check \
--orders-limit 100
```

Replace `<DATASET_TII>` with the path and name of a TII.JSON file. You can use the `--data` option multiple times. For example:

```shell
./spctl workflows create \
--solution solution_resource.json \
--data superprotocol-file-pack-2025-08-14T13-51-26.tii.json \
--data superprotocol-file-pack-2025-08-14T13-56-42.tii.json \
--tee 10 \
--storage 47 \
--skip-hardware-check \
--orders-limit 100
```

The output will contain the order ID.

2. Wait 15-20 minutes and check the order status:

```shell
./spctl orders get <ORDER_ID>
```

For example:

```shell
./spctl orders get 244835
```

3. If the order is complete, download the result:

```shell
./spctl orders download-result <ORDER_ID>
```

For example:

```shell
./spctl orders download-result 244835
```

4. Unzip the downloaded archive:

```shell
tar -xvzf result.tar.gz
```

The execution result is located in the `output` folder.
8 changes: 0 additions & 8 deletions docs/colab/docker.md

This file was deleted.

89 changes: 43 additions & 46 deletions docs/colab/Jupyter.md → docs/colab/gui.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,63 @@
---
id: "jupyter"
title: "Jupyter Notebook"
slug: "/"
sidebar_position: 0
id: "gui"
title: "Deploy using the UI (Jupyter)"
slug: "/gui"
sidebar_position: 1
---

## Log in
## Log in and get tokens

1. Open the [Marketplace](https://marketplace.superprotocol.com).
1. Open the [Marketplace](https://marketplace.superprotocol.com).

2. Click **Enter Marketplace** in the upper-right corner and log in using your preferred method.

## Get SPPI tokens
3. Click on your account name in the upper-right corner and select Account.

1. Click on your account name in the upper-right corner and select Account.

<img src={require('./images/1.png').default} width="auto" height="auto" border="1"/>
<br/>
<br/>
2. In the Account window, copy your Super Wallet address and share it with your contact in Super Protocol to receive SPPI tokens.

4. In the Account window, copy your Super Wallet address and share it with your contact in Super Protocol to receive SPPI tokens.

<img src={require('./images/2.png').default} width="auto" height="auto" border="1"/>
<br/>
<br/>

## Upload an IPYNB script or dataset

1. Open the [Marketplace Colab page](https://marketplace.superprotocol.com/order-create-colab).
2. Press **Upload Content**, select a file or folder, and click **Upload**. The uploaded content will be automatically encrypted and placed in a decentralized file storage (Storj).
3. Save the resulting TII.JSON file; it can be opened in any text editor. Inside:
- Encrypted data describing how to download and decrypt the uploaded content (objects `"encryptedResource"` and `"encryptedTRI"`).
- Hash of the uploaded content, calculated before the encryption.
- Restrictions on the computing device and the solution offer (i.e., Jupyter Notebook).
1. Open the [Marketplace Colab page](https://marketplace.superprotocol.com/order-create-colab).

2. Press **Upload Content**, select a file or folder, and click **Upload**. The uploaded content will be automatically encrypted and placed in a decentralized file storage (Storj).

3. Save the resulting TII.JSON file; it can be opened in any text editor. Inside:

- Encrypted data describing how to download and decrypt the uploaded content (objects `"encryptedResource"` and `"encryptedTRI"`).
- Hash of the uploaded content, calculated before the encryption.
- Restrictions on the computing device and the solution offer (i.e., Jupyter Notebook).

TII.JSON files are safe to share. The information about the uploaded content is encrypted with the public key of the specified confidential virtual machine (`"offerId": "10"`). Only this machine can decrypt it and then download and decrypt the content itself. The machine runs inside a Trusted Execution Environment with no external access.

## Deploy

1. Open the [Marketplace Colab page](https://marketplace.superprotocol.com/order-create-colab).
2. Press **Run Colab**.
3. Add the application and dataset TII.JSON files generated during the upload process.
4. Press **Run**. When the order is created, you will be redirected to the order page. Write down the order ID; you may need it later for verification.
5. Wait until the order is complete. For small files, it typically takes around 20 minutes, but the time can be significantly longer for large files. Use the **Extend Lease** button to add tokens to the order balance if the lease time is running out.
6. When the order is complete (Status: Done), press **Get Result** and download the TAR.GZ archive containing the order result.
## Place an order

1. Open the [Marketplace Colab page](https://marketplace.superprotocol.com/order-create-colab).

2. Press **Run Colab**.

3. Add the application and dataset TII.JSON files generated during the upload process.

4. Press **Run**. When the order is created, you will be redirected to the order page. Write down the order ID; you may need it later for verification.

5. Wait until the order is complete. For small files, it typically takes around 20 minutes, but the time can be significantly longer for large files. Use the **Extend Lease** button to add tokens to the order balance if the lease time is running out.

6. When the order is complete (Status: Done), press **Get Result** and download the TAR.GZ archive containing the order result.

7. Unzip the downloaded archive. The execution result is located in the `output` folder.

## Verify

1. [Download and set up SPCTL](/cli/) – the Super Protocol CLI tool.

2. Get the order report:

1. [Download and set up SPCTL](/cli/)—the Super Protocol CLI tool.

2. Get the order report:

```shell
./spctl orders get-report <ORDER_ID> --save-to report.json
Expand All @@ -74,18 +71,18 @@ Replace `<ORDER_ID>` with your order ID, for example:

The command will display and save the order report to the `report.json` file in the SPCTL directory. This report includes the certificate chain, order metadata, and validation result.

3. Ensure you see `Order report validation successful!` in the output.
3. Ensure you see `Order report validation successful!` in the output.

4. Open `report.json` in a text editor and find two entries in the `“runtimeInfo”` array that start with `"type": "Data"`. For example:

```json
{
"type": "Data",
"size": 12901,
"hash": {
"algo": "sha256",
"hash": "8598805cd2136a4beff17559a7228854f6a8cc0b027856ea5c196fb8d0602501",
"encoding": "hex"
"algo": "sha256",
"hash": "8598805cd2136a4beff17559a7228854f6a8cc0b027856ea5c196fb8d0602501",
"encoding": "hex"
}
},
```
Expand Down
86 changes: 86 additions & 0 deletions docs/colab/jupyter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
id: "jupyter"
title: "Prepare a Jupyter Notebook script"
slug: "/"
sidebar_position: 0
---

## Super Protocol TEE file system

Inside the TEE, you have a special file structure:

| Location | Purpose | Access |
| :---- | :---- | :---- |
| `/sp/inputs/input-0001` | Possible data location 1 | Read-only |
| `/sp/inputs/input-0002` | Possible data location 2 | Read-only |
| `/sp/outputs` | Output folder for your results | Write; you can also read own files |

:::important

Always use absolute paths, such as `/sp/...`.

:::

## 1. Prepare your script

In the Jupyter Notebook:

1. Locate your input file in `/sp/inputs`.

2. Load the data; for example, from a CSV file.

3. Process the data as needed.

4. Write the results to `/sp/outputs` so they are saved and returned after execution.

## 2. Find the input file

In the TEE, locate your input file, for example `input.csv`, using the `find_input_file()` function. This function checks both input folders and returns the absolute path:

```py
from pathlib import Path

# Helper function to find the input file
def find_input_file(filename):
locations = [
Path(f"/sp/inputs/input-0002/{filename}"),
Path(f"/sp/inputs/input-0001/{filename}")
]
for path in locations:
if path.exists():
print(f"Using input file: {path}")
return path
raise FileNotFoundError(f"{filename} not found in input-0002 or input-0001")

# Specify the input file (replace "input.csv" with the name of your file)
input_path = find_input_file("input.csv")
```

## 3. Read the input file

You can load the input file using any library or method suitable for your data format. For example, with pandas:

```py
import pandas as pd

df = pd.read_csv(input_path)
print(df.head())
```

Use `input_path` as the file location if you use another method, such as the csv module, a JSON parser, or any other library.

## 4. Process and save the data

After loading your data, process it in memory and save the results to `/sp/outputs`. Ensure your processed data, whether a DataFrame, list, dictionary, or other format, is ready before saving. For example:

```py
from pathlib import Path
import pandas as pd

# Create the output directory if it doesn't exist
output_path = Path("/sp/outputs")
output_path.mkdir(parents=True, exist_ok=True)
# Specify the output file (replace "output.csv" with the name of your file)
output_file = output_path / "output.csv"
df.to_csv(output_file, index=False)
```
Loading