Skip to content
Merged

main #291

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
4 changes: 0 additions & 4 deletions docs/cli/commands/files/delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ The resource JSON file is created as a result of the [`files upload`](/cli/comma
[--help | -h]
```

Read about the Super Protocol [command syntax](/cli/commands#command-syntax).

## Arguments

| **Name** | **Description** |
Expand All @@ -34,8 +32,6 @@ Read about the Super Protocol [command syntax](/cli/commands#command-syntax).

## Example

The following command deletes a file in remote storage using the information in the `resource-old-data.json` file located in the SPCTL root directory:

```
./spctl files delete ./resource-old-data.json
```
4 changes: 0 additions & 4 deletions docs/cli/commands/files/download.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ The resource JSON file is created as a result of the [`files upload`](/cli/comma
[--help | -h]
```

Read about the Super Protocol [command syntax](/cli/commands#command-syntax).

## Arguments

| **Name** | **Description** |
Expand All @@ -35,8 +33,6 @@ Read about the Super Protocol [command syntax](/cli/commands#command-syntax).

## Example

The following command downloads and decrypts a file from remote storage using the information in the `resource-data.json` file located in the SPCTL root directory. The downloaded file will appear in the SPCTL root directory.

```
./spctl files download ./resource-data.json ./
```
4 changes: 2 additions & 2 deletions docs/cli/commands/files/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_position: 3

---

This command group contains commands to manage files in third-party storage such as Storj.
This group contains commands to manage files in third-party storage such as Storj.

Most of these commands require a Storj account and SPCTL configured to use it. Refer to the [Set up Storj](/cli/#set-up-storj-access-optional) section to create a bucket and access grants and set up SPCTL.

Expand All @@ -16,4 +16,4 @@ Most of these commands require a Storj account and SPCTL configured to use it. R
| :- | :- |
| [files delete](/cli/commands/files/delete) | Deletes a file in remote storage. |
| [files download](/cli/commands/files/download) | Downloads and decrypt a file from remote storage. |
| [files upload](/cli/commands/files/upload) | Uploads a file to remote storage or creates a storage order. |
| [files upload](/cli/commands/files/upload) | Uploads a file to remote storage. |
39 changes: 9 additions & 30 deletions docs/cli/commands/files/upload.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Uploads a file to remote storage such as Storj.

The primary purpose of this command is to make the uploading files available for download and execution. This is necessary in two cases:

- With the [`workflows create`](/cli/commands/workflows/create) command, **users** can add the uploaded solution or data to an order instead of a Marketplace offer. In this case, a short-term storage period is enough.
- With the [`workflows create`](/cli/commands/workflows/create) command, **users** can add the uploaded <a id="solution"><span className="dashed-underline">solution</span></a> or <a id="data"><span className="dashed-underline">data</span></a> to an <a id="order"><span className="dashed-underline">order</span></a> instead of an <a id="offer"><span className="dashed-underline">offer</span></a>. In this case, a short-term storage period is enough.
- Solution and data **providers** can store the contents of their offers to make them available for customers' orders. This requires a long-term storage period.

Depending on the options, the command provides two ways to upload and store the files. Choose one that suits you better:
Expand All @@ -36,8 +36,6 @@ The output of the command is a resource JSON file with the information for a com
[--help | -h]
```

Read about the Super Protocol [command syntax](/cli/commands#command-syntax).

## Arguments

| **Name** | **Description** |
Expand All @@ -51,49 +49,37 @@ Read about the Super Protocol [command syntax](/cli/commands#command-syntax).
| `--filename <string>` | Desired name of the resulting file in storage. The default is a random string. |
| `--output <path>` | Path to save the output resource JSON file. The default is `./resource.json`. |
| `--skip-encryption` | Flag to skip file encryption before uploading. The default is `false`. |
| `--metadata <path>` | Path to a metadata file for adding fields to the resource JSON file. This file is generated by the [solutions prepare](/cli/commands/solutions/prepare) command. |
| `--metadata <path>` | Path to a metadata file for adding fields to the resource JSON file. This file is generated by the [`solutions prepare`](/cli/commands/solutions/prepare) command. |
| `--max-concurrent <number>` | Maximum concurrent pieces to upload at once per transfer to limit the number of threads. Use only when dealing with a memory-constrained environment. |
| `--storage <offerId,slotId>` | Option to use a storage offer. State the storage offer ID and the requirement slot ID, separated by a comma. |
| `--storage <offerId,slotId>` | Option to use a storage offer. State the IDs of the offer and the <a id="requirements"><span className="dashed-underline">requirement slot</span></a>, separated by a comma. |
| `--min-rent-minutes <minutes>` | Storage lease period in minutes. Use this option together with `--storage`. The default is `60`. |
| `--config <path>` | Path to the SPCTL configuration file. The default is `./config.json`. |
| `--help`, `-h` | Help for the command. |

## Examples

The following are three examples of using the `workflows create` command:

- Uploading to remote storage
- Creating a storage order
- Using additional options.

### Example 1. Upload to remote storage directly

The following command uploads the `content.tar.gz` file located in the SPCTL root directory:
### Example 1. Upload to storage directly

```
./spctl files upload content.tar.gz
```

To execute this command successfully, you need a Storj account and SPCTL configured to use it. Refer to the [Set up Storj](/cli#set-up-storj-access-optional) section to create a bucket and access grants and set up SPCTL.

### Example 2. Upload by creating a storage order

The following command uploads the `content.tar.gz` located in the SPCTL root directory:
### Example 2. Upload and create a storage order

```
./spctl files upload content.tar.gz --storage 25,33 --min-rent-minutes 120
./spctl files upload content.tar.gz --storage 47,49 --min-rent-minutes 120
```

Where:

- `--storage 25,33`: create a storage order using the [Storj DCS Offer](https://marketplace.superprotocol.com/storage?offer=offerId%3D25&tab=pricing) (offer ID: 25) and the requirement slot with ID 33.
- `--min-rent-minutes 120`: set the lease period for 120 minutes.
- `--storage 47,49`: Create a storage order using the [Storj DCS Offer](https://marketplace.superprotocol.com/storage?offer=offerId%3D47&tab=pricing) (offer ID: 47) and the requirement slot with ID 49.
- `--min-rent-minutes 120`: Set the lease period for 120 minutes.

Since the `--storage` option is set, the command does not require a Storj account. However, when the lease period is over, the content will become unavailable unless you [replenish the order deposit](/cli/commands/orders/replenish-deposit).

### Example 3. Use additional options

The following command uploads the `content.tar.gz` file located in the `data` directory in the SPCTL root directory:
### Example 3. Upload using additional options

```
./spctl files upload ./data/content.tar.gz \
Expand All @@ -103,10 +89,3 @@ The following command uploads the `content.tar.gz` file located in the `data` di
--storage 25,33 \
--min-rent-minutes 120
```

Where:

- `--filename data.tar.gz`: name the uploaded file `data.tar.gz`
- `--output ./data-resource.json`: name the output resource JSON file `data-resource.json` and save it to the SPCTL root directory
- `--metadata ./meta.json`: add the `meta.json` metadata file to the resource file during the upload
- Other options are explained in the previous example.
31 changes: 15 additions & 16 deletions docs/cli/commands/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,19 @@ slug: "/commands"
sidebar_position: 2
---

This section contains the list of commands for the Super Protocol CLI tool SPCTL.

[Configure SPCTL](/cli) before using these commands. Also keep in mind [testnet limitations](/marketplace/limitations).
This section contains Super Protocol CLI commands. [Install and configure SPCTL](/cli) to access the CLI.

## Command groups

| **Group** | **Description** |
| :- | :- |
| [tokens](/cli/commands/tokens) | Receive SPPI and BNB test tokens; **testnet only**. |
| [solutions](/cli/commands/solutions) | Prepare a solution for deployment. |
| [solutions](/cli/commands/solutions) | Prepare a <a id="solution"><span className="dashed-underline">solution</span></a> for deployment. |
| [files](/cli/commands/files) | Manage files in decentralized storage. |
| [workflows](/cli/commands/workflows) | Create a new order. |
| [workflows](/cli/commands/workflows) | Create a new <a id="order"><span className="dashed-underline">order</span></a>. |
| [orders](/cli/commands/orders) | Manage your orders. |
| [offers](/cli/commands/offers) | View and manage Marketplace offers. |
| [providers](/cli/commands/providers) | View and manage offer providers. |
| [offers](/cli/commands/offers) | View and manage Marketplace <a id="offer"><span className="dashed-underline">offers</span></a>. |
| [providers](/cli/commands/providers) | View and manage providers. |
| [quotes](/cli/commands/quotes) | Verify the authenticity and integrity of a <a id="tee"><span className="dashed-underline">Trusted Execution Environment</span></a>. |

## Command syntax
Expand All @@ -35,14 +33,13 @@ _Command groups_ contain functionally related commands. Check the complete list
_Commands_ perform a specific function, like placing an order or showing the list of providers.

For example, the [`tokens`](/cli/commands/tokens) command group includes the following commands:
- [`balance`](/cli/commands/tokens/balance): checks the balance
- [`request`](/cli/commands/tokens/request): requests testnet tokens.

_Options_ modify the command behavior and are prefixed by double hyphen `--`. For example, `--help` is an option that displays help information for a command.
- [`balance`](/cli/commands/tokens/balance): Checks the balance.
- [`request`](/cli/commands/tokens/request): Requests testnet tokens.

_Arguments_ provide values for commands and options. Arguments that follow a command are always required by the command and mandatory to use. Arguments that follow an option can be mandatory—required by the option—or be optional. Angle brackets `< >` indicate argument placeholders in the command syntax. When executing a command, replace placeholders, including the brackets, with values. For example, replace `<offerId>` with `5` for [Python Base Image](https://marketplace.superprotocol.com/?offer=offerId%3D5) (offer ID: 5).
_Options_ modify the command behavior and are prefixed by double hyphen `--`; for example, `--help`. Options can be mandatory or optional.

Options, too, can be mandatory—required by the command—or be optional. Note that most options require at least one argument, although exceptions exist.
_Arguments_ provide values for commands and options. Angle brackets `< >` indicate argument placeholders in the command syntax. When executing a command, replace placeholders, including the brackets, with values. For example, replace `<offerId>` with `12` for [Python Base Image](https://marketplace.superprotocol.com/?offer=offerId%3D12).

Command syntax may also contain the following special characters:

Expand All @@ -61,13 +58,15 @@ The following is a mandatory option `--solution` of the [`workflows create`](/cl
--solution {<offerId>,[<slotId>] | <path>}
```

The format `{<offerId>,[<slotId>] | <path>}` requires you to choose either `<offerId>,[<slotId>]` or `<path>`:
- `<offerId>,[<slotId>]` are a mandatory argument `<offerId>` and an optional argument `<slotId>` (note the square brackets `[ ]`), separated by a comma.
- `<path>` is a mandatory argument.
The format `{<offerId>,[<slotId>] | <path>}` requires you to choose one of the following:

- `<offerId>,[<slotId>]`: a mandatory argument `<offerId>` and an optional argument `<slotId>`, separated by a comma.
- `<path>`: a mandatory argument.

So, the final format of this option must be one of the following:

- `--solution <offerId>`. For example, `--solution 13`.
- `--solution <offerId>,<slotId>`. For example, `--solution 13,15`.
- `--solution <path>`. For example, `--solution ./python-solution.json`.

Read the descriptions of arguments and options and refer to the examples for more information. If you have any issues or questions, contact Super Protocol on [Discord](https://discord.gg/superprotocol).
Read the descriptions of arguments and options and refer to the examples for more information. If you have any issues or questions, contact the Super Protocol team on [Discord](https://discord.gg/superprotocol) or via the [contact form](https://superprotocol.zendesk.com/hc/en-us/requests/new) for assistance.
108 changes: 49 additions & 59 deletions docs/cli/commands/offers/add-slot.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,92 +6,82 @@ sidebar_label: "add-slot"
sidebar_position: 8
---

Creates an additional [requirement slot](/fundamentals/slots#requirements) in an offer using the information in an offer slot JSON file.
Adds a <a id="slot"><span className="dashed-underline">slot</span></a> to an <a id="offer"><span className="dashed-underline">offer</span></a>.

Refer to the [Providers and Offers] guide to create the initial offer requirements.

**Important:** This command requires SPCTL with the [provider configuration file](/cli/#configure-spctl-for-providers).
**Important:** This command requires SPCTL with a [provider configuration file](/cli/#configure-spctl-for-providers).

## Syntax

```
./spctl offers add-slot <offerType>
--offer <offerId>
[--path <path>]
[--path <slotInfo>]
[--config <path>]
[--help | -h]
```

Read about the Super Protocol [command syntax](/cli/commands#command-syntax).

## Arguments

| **Name** | **Description** |
| **Name** | **Description** |
| :- | :- |
| `<offerType>` | Type of the offer: `tee` for a compute offer or `value` for a solution, data, or storage offer. |

## Options

| **Name** | **Description** |
| **Name** | **Description** |
| :- | :- |
| `--offer <offerId>` | ID of the offer. |
| `--path <path>` | Path to the offer slot JSON file. The default is `./offerSlot.json`. |
| `--config <path>` | Path to the SPCTL configuration file. The default is `./config.json`. |
| `--help`, `-h` | Help for the command. |

## Offer slot file

The offer slot JSON file must contain the following objects and strings:

- `info`: object with computing power configuration
+ `cpuCores`: number of CPU cores required, a float value
+ `gpuCores`: number of GPU cores required, a float value
+ `diskUsage`: bytes
+ `ram`: bytes
- `usage`: object with terms and conditions of usage
+ `maxTimeMinutes`: minutes; `0` for no limit
+ `minTimeMinutes`: minutes; `0` for no limit
+ `price`: denominations of SPPI token
+ `priceType`: `1` for fixed price, `0` for price per hour; learn more about [price types](/fundamentals/orders#cost-and-pricing)
- `option`: object with internet access configuration (only for <a id="value-offer"><span className="dashed-underline">value offers</span></a>)
+ `bandwidth`: bits per second
+ `traffic`: bytes
+ `externalPort`: `1` for yes, `0` for no

Offer slot JSON file template with example values:

```json title="offer-new-slot.json"
| `--offer <offerId>` | Offer ID. |
| `--path <slotInfo>` | Path to a slot-info JSON file. The default is `./slotInfo.json`. |
| `--config <path>` | Path to the SPCTL configuration file. The default is `./config.json`. |
| `--help`, `-h` | Help for the command. |

## Slot info

A slot-info JSON file must contain the following objects:

- `info`: An object with requirements:
- `cpuCores`: The number of virtual CPU cores, a float value.
- `gpuCores`: The number of virtual GPU cores, a float value.
- `diskUsage`: Disk space in bytes.
- `ram`: RAM in bytes.
- `vram`: Video RAM in bytes.
- `usage`: An object with terms and conditions of usage:
- `maxTimeMinutes`: Maximum lease duration limits in minutes; `0` for no limit.
- `minTimeMinutes`: Minimum lease duration limits in minutes; `0` for no limit.
- `price`: Lease price in denominations of SPPI token (10<sup>18</sup> = 1 SPPI).
- `priceType`: [Pricing type](/fundamentals/orders#cost-and-pricing): `1` for fixed price, `0` for price per hour.
- `option`: An object with internet access requirements (only for value offers):
- `bandwidth`: Data transfer rate in bits per second.
- `traffic`: Total required data transfer usage in bytes.
- `externalPort`: `1` for yes, `0` for no.

A template with example values:

```json title="slotInfo.json"
{
"info": {
"cpuCores": 3,
"gpuCores": 0,
"diskUsage": 536870912,
"ram": 34359738368
"info":{
"cpuCores":3,
"gpuCores":0,
"diskUsage":16106127360,
"ram":34359738368,
"vram":0
},
"usage": {
"maxTimeMinutes": 0,
"minTimeMinutes": 60,
"price": "400000000000000000",
"priceType": "1"
"usage":{
"maxTimeMinutes":0,
"minTimeMinutes":60,
"price":"400000000000000000",
"priceType":"1"
},
"option": {
"bandwidth": 0,
"traffic": 0,
"externalPort": 0
"option":{
"bandwidth":0,
"traffic":0,
"externalPort":0
}
}
```

Note that some of the data is represented differently in the Marketplace GUI:
- `diskUsage` and `ram` values are converted to gibibytes (GiB) by the formula `initialValue / (1024 ^ 3)`
- `price` value is converted to SPPI tokens by the formula `initialValue / (10 ^ 18)`
- `bandwidth` value is converted to megabits per second (Mbps) by the formula `initialValue / (10 ^ 6)`
- `traffic` value is converted to gigabytes (GB) by the formula `initialValue / (10 ^ 9)`

## Example

The following command adds a new requirement slot to a value offer with ID 39 using the `offer-new-slot.json` file located in the SPCTL directory:

```
./spctl offers add-slot value --offer 39 --path ./offer-new-slot.json
./spctl offers add-slot value --offer 39 --path ./new-slot.json
```
12 changes: 4 additions & 8 deletions docs/cli/commands/offers/delete-slot.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ sidebar_label: "delete-slot"
sidebar_position: 10
---

Deletes a [requirement slot](/fundamentals/slots#requirements) in an [offer](/fundamentals/offers).
Deletes a <a id="slot"><span className="dashed-underline">slot</span></a> in an <a id="offer"><span className="dashed-underline">offer</span></a>.

**Important:** This command requires SPCTL with the [provider configuration file](/cli/#configure-spctl-for-providers).
**Important:** This command requires SPCTL with a [provider configuration file](/cli/#configure-spctl-for-providers).

Use the [`offers get`](/cli/commands/offers/get) command to get the IDs of all slots in an offer. Use the [`offers get-slot`](/cli/commands/offers/get-slot) command to get additional information on a slot.

Expand All @@ -22,8 +22,6 @@ Use the [`offers get`](/cli/commands/offers/get) command to get the IDs of all s
[--help | -h]
```

Read about the Super Protocol [command syntax](/cli/commands#command-syntax).

## Arguments

| **Name** | **Description** |
Expand All @@ -34,15 +32,13 @@ Read about the Super Protocol [command syntax](/cli/commands#command-syntax).

| **Name** | **Description** |
| :- | :- |
| `--offer <offerId>` | ID of the offer. |
| `--slot <slotId>` | ID of the slot. |
| `--offer <offerId>` | Offer ID. |
| `--slot <slotId>` | Slot ID. |
| `--config <path>` | Path to the SPCTL configuration file. The default is `./config.json`. |
| `--help`, `-h` | Help for the command. |

## Example

The following command deletes a requirement slot with ID 47 in a <a id="value-offer"><span className="dashed-underline">value offer</span></a> with ID 39:

```
./spctl offers delete-slot value --offer 39 --slot 47
```
Loading
Loading