Usage
Prerequisites
There are few steps that need to be done before using the CLI:
Python version
Python 3 is the minimum version. But we recomend v3.8 to make sure that all features work.
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...
anddfs-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.
Obtain Yagna, the dispatching engine of the Golem
curl -sSf https://join.golem.network/as-requestor | bash -
Make sure you have installed Yagna
yagna --version gftp --version
Run the Yagna daemon
yagna service run
Open a new terminal tab/window, and create a new wallet named requestor
yagna app-key create requestor
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.
Fund your wallet with testnet tokens
yagna payment fund yagna payment status
Enable the Yagna daemon as a requestor
yagna payment init --sender
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.
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] [--init] [--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
--init Walks you through a wizard to initialize a new pod or
task.
--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