Usage

Prerequisites

There are few steps that need to be done before using the CLI:

  • Swarm

    To setup the Swarm node, you need to consult https://docs.ethswarm.org/docs. Once your node is up, fund your wallet(you can request funds from the Swarm discord), deploy a chequebook, and bingo!

  • FairOS-DFS

    To setup the FairOS-DFS tools, You need two files: dfs-linux... and dfs-cli-linux... which can be downloaded from https://github.com/fairDataSociety/fairOS-dfs. Please consult https://docs.fairos.fairdatasociety.org/docs/fairOS-dfs/introduction for further information on customizing FairOS-DFS. FairOS-DFS provides abstractions that facilitate the storage of fairly complex objects on Swarm so it depends on a running Swarm node.

  • Golem

    Golem is needed to run compute pods, so please consult https://handbook.golem.network/requestor-tutorials/flash-tutorial-of-requestor-development for an in-depth setup. The following provides a compressed version of the official documentation.

    1. Obtain Yagna, the dispatching engine of the Golem

    curl -sSf https://join.golem.network/as-requestor | bash -
    
    1. Make sure you have installed Yagna

    yagna --version
    gftp --version
    
    1. Run the Yagna daemon

    yagna service run
    
    1. Open a new terminal tab/window, and create a new wallet named requestor

    yagna app-key create requestor
    
    1. Get to know your wallet/keys with

    yagna app-key list
    

    Which outputs something similar to the following table

    ┌─────────────┬────────────────────────────────────┬──────────────────────────────────────────────┬───────────┬─────────────────────────────────┐
    │  name       │  key                               │  id                                          │  role     │  created                        │
    ├─────────────┼────────────────────────────────────┼──────────────────────────────────────────────┼───────────┼─────────────────────────────────┤
    │  requestor  │  1c8c96a66950905baeb48014d7369ac6  │  0xb2e10dacce97f932f1d03757ff33b443f17a1c5f  │  manager  │  2022-10-06T13:45:04.897349774  │
    └─────────────┴────────────────────────────────────┴──────────────────────────────────────────────┴───────────┴─────────────────────────────────┘
    

    Copy the key column’s value.

    1. Fund your wallet with testnet tokens

    yagna payment fund
    yagna payment status
    
    1. Enable the Yagna daemon as a requestor

    yagna payment init --sender
    
    1. Export the key for the requestor wallet as an environment variable

    export YAGNA_APPKEY=1c8c96a66950905baeb48014d7369ac6
    

    Just remember that you need to redo this step every time you start the Yagna server.

    1. Initialize a virtual environment for python 3 and install necessary libraries.

    python3 -m venv ~/.envs/venv
    source ~/.envs/venv/bin/activate
    
    pip install -U pip
    pip install yapapi requests-toolbelt
    

    And done!

Now that you have a working environment for Swarm, FairOS-DFS, and Golem, it is time to start using the Sovr CLI.

CLI

Before use Sovr CLI, you need to have a virtual environment set up and activated with required libraries, make sure requests-toolbelts and yapapi are installed. To get the Sovr CLI, fork it from Github:

git clone https://github.com/rezahsnz/sovr.git

If you needed any help, just invoke Sovr CLI with --help argument:

usage: cli.py [-h] [--recipe RECIPE] [--persist-self]
            [--persist | --fork FORK | --run | --import-pod IMPORT_POD | --list-pods | --generate-pod-registry]

Sovr command line interface

optional arguments:
-h, --help

show this help message and exit

--recipe RECIPE

specify a recipe file

--persist-self

Persist the CLI itself and make it public. Caution: remove any credentials(password files, …) before proceeding.

--persist

Persist pod to dfs

--fork FORK

Fork a public pod, a reference key is expected

--run

Run the pod/task

--import-pod IMPORT_POD

Imports a pod to local filesystem, a pod name is expected

--list-pods

List all pods

--generate-pod-registry

Generate a new pod registry by looking into all pods