How to Setup and Test the SONM MVP

SONM – Supercomputer Organized by Mining – is one of three main projects competing for a piece of the pie of the distributed cloud computing market, iExec and Golem being the other two. When the team released their MVP it was still unclear what features are exactly available and what the Minimum Viable Product is capable of doing. In this article I will walk through building and utilizing the MVP and will showcase what it is capable of.

Before we get started I would like to give big thanks to Alexander Sigaev from the SONM beta-test telegram, without him this tutorial probably wouldn’t have come along, he provided great support and answers to my questions. If you feel stuck in any way make sure to visit SONM’s beta test telegram linked below as the admins are very helpful.

Without further ado let’s get right to it. We will use an Ubuntu 16.04 digital ocean droplet to run the MVP. I used the $20 / month one but even the cheapest option will do. We will be using Putty to connect to our droplet and set everything up. Let’s begin:

Step 1: Login to your droplet

This should be self explanatory, simply type in the IP of your droplet from digitalocean, set the new password, and you should be all set.

Step 2: update the droplet and download some basic tools (unzip, nginx, docker)

We will need unzip in order to extract our downloaded files and we will need nginx for our SONM wallet. We will also need docker as it is an integral part of SONM and is needed to run tasks. Last but not least, the opencl library is needed for the miner. Run the following commands:

$ sudo apt-get update && apt-get upgrade
$ sudo apt-get install nginx unzip
$ sudo apt install ocl-icd-opencl-dev

Verify that your nginx installation is working by navigating to http://droplet_ip_address. You should see the default nginx page.

Step 2: Download the SONM wallet and set it up.

$ wget ""
$ unzip
$ cd ./sonm-wallet-v0.1.6

After extracting the wallet you should have 2 files: app.bundled.js and index.html. Move both to the /var/www/html directory which is where the default nginx server is pointing

$ cp ./app.bundled.js /var/www/html
$ cp ./index.html /var/www/html

Navigating to http://droplet_ip_address you should see this:

I used the wallet name “test”, password “123”. After clicking add wallet it will move you to the next page, we will get back to this later.

Step 3: Download and extract the MVP

$ cd ~
$ wget ""
$ unzip
$ cd sonm_v0.3.0_linux64

You should see the following directories: cli, hub, node, worker.

From here on, this tutorial will mimic the guides on the official SONM website which you can find here, and here.

Step 4: Set up an ethereum account and get some tokens from the Rinkeby Ethereum testnet

Navigate to the cli folder inside our sonm mvp and run the sonm cli.

$ cd ~/sonm_v0.3.0_linux64/cli
$ ./sonmcli_linux64 login

Since you do not have a keystore file, it will ask you to create one. Set a password for it and the keystore will be automatically generated, you should see your eth address as a response.

Cli also creates a .sonm folder in the home directory, which is where it stores the keystore file that was just created.

For simplicity’s sake I shared the contents of my keystore file, but you should never do that.

Now that we have an eth address we need to fund it with some testnet eth. Specifically we need the Rinkeby testned coins and the easiest way to get some is by using the below dispenser. Simply send a tweet with your eth address, copy paste the tweet url to their website and they will automatically fund it:

To make sure you have testnet eth on the rinkeby chain, check etherscan. Make sure you go to rinkbey etherscan subdomain: Type in your address and you should see some ether. If you see your account funded proceed to the next step.

Step 5: Set up your SONM wallet

Now that we have the keystore file we can go back to our web based wallet and add an account. This will help us keep track of our Ether and SNMT tokens.

In order to import a new account you will need a keystore file. Open a text editor on your main machine and copy paste the contents of the file inside ~/.sonm/keystore. Then import that file into the web based wallet.

The password needs to match the same password you used when you ran the sonm cli and generated your eth address. In our case we used the password “123”. After all is done you should see the following page and the eth address should match the one generated earlier.

As you can see we have 3 Ether but no SNMT, we need to fix that. Go back to the terminal and navigate to the cli folder. Use the following command to get more tokens:

$ ./sonmcli_linux64 get

It should return the following:

Navigate back to our SONM wallet and you should see that you now have 100 SNMT and a bit less Ether:

Now that we have both ether and SNMT we are ready to configure the MVP.

Step 6: Configuring and running the Node

We are going to start with the node. A SONM client node interacts with the marketplace, it handles automatic processes such as setting bids, matching deals, and running tasks. The node is the first part that should be configured.

Navigate to the node folder and open the node.yaml file (the configuration file).

$ cd ~/sonm_v0.3.0_linux64/node
$ vim node.yaml

The only fields you need to edit are key_store and pass_phrase, which are under the ethereum block.

Since the default key_store value is /home/sonm/keys, let’s just create the same directory path and put our keystore file in there.

$ cd /home
$ mkdir -p sonm/keys
$ cp ./UTC--2018-01-28T08-10-54.752110802Z--40a1b4fcdf4afc182c0b63820fba3789d17414ab /home/sonm/keys

NOTE: Keep in mind the name of your keystore file will be different.

Go back to the node folder and edit the node.yaml file once again, for the pass_phrase field just edit in the password you used to create your eth wallet, in our case “123”

Node that our node.yaml file is correctly configured, start up the node.

$ ./sonmnode_linux64

If everything goes right you should see the below output:

Step 7: Configuring and running the CLI

Next we are going to configure the CLI. Make sure to leave the node running, start up a new instance of putty, log into the droplet once more, and navigate to the cli folder:

Similar to the previous step we are going to edit the cli.yaml file and add in our passphrase (123). The key_store value stays the same as we have already made the correct path to the keystore file.

Slight change in this step is we are going to move the cli.yaml file to our hidden sonm directory that was created for us the first time we rean sonmcli. Assuming you are in the ~/sonm_v0.3.0_linux64/cli directory:

$ cp cli.yaml ~/.sonm/
$ rm cli.yaml

Finally, test the command line interface by typing in the login command:

$ ./sonmcli_linux64 login

The response should be the following:

While we are here, we are also going to set an allowance cap for the client to pay for resources:

$ ./sonmcli_linux64 approve 1000000000000000000000000000000

We are done with the cli for now. At this point you should have 2 putty instances running, one of them should be running the node, and the other is the one we are working with. Start up yet another instance of putty because this time we will be editing the hub.

Step 8: Configuring the Hub

Setting up the hub node is very similar to the previous two. Simply navigate to the hub directory and edit the hub.yaml file.

$ cd ~/sonm_v0.3.0_linux64/hub
$ vim hub.yaml

Edit in the pass_phrase and save the file.

Start the hub:


If everything goes well you should get the following response:

Leave the hub running. As of now you should have 3 terminals open. The node, the hub, and the cli.

Step 9: Configuring the Worker

Open a new putty instance and navigate to the worker directory. Same as in the previous steps, edit the worker.yaml file.

$ cd ~/sonm_v0.3.0_linux64/worker
$ vim worker.yaml

Modify the endpoint value. Where it shows <HubEthAddr> replace it with the ethereum address you first generated and funded. Also don’t forget to edit the pass_phrase towards the bottom of the file.

Save the file and run the worker.

$ ./sonmworker_linux64

If you get the following response you are on the right track:

You are now done setting up the MVP. You should have the hub, the node, and the worker running.

To verify you have a worker running use the cli to get a list of workers.

$ cd ~/sonm_v0.3.0_linux64/cli
$ ./sonmcli_linux64 hub worker list

If you have a worker available it should be showing as Idle.

check worker

Interacting with the market

At this point you are officially done with the setting up and configuration part of the SONM MVP. We will not show you how to interact with the market.

The way SONM works, is you can place a BID and an ASK order just like on an exchange. The bid order is a request for a certain amount of computer resources, and it has a price associated with it in the form of SNMT. An ask order comes from the supplier’s side and offers a certain amount of resources for a price.

The consumer’s node will automatically execute any bid and ask orders if the price and the resources match as long as both the supplier’s and the client’s hubs are online.

Let’s create a market bid order. First, we need to create a file specifying the resource requirements. Create a file called bid_slot.yaml in the cli directory.

$ vim bid_order.yaml

Copy and paste the following configuration:

price: 100
order_type: BID
  duration: 1h

    cpu_cores: 1
    ram_bytes: 512mb
    gpu_count: NO_GPU
    storage: 1Gb

      in: 100Mb
      out: 100Mb
      type: INCOMING

      foo: 1101
      cycles: 42

The file contains the price in SNMT, the type of order, and the duration that the contract is needed for. There are other fields that can be modified but for this test we will leave those alone.

To create a bid order use the market create command.

$ ./sonmcli_linux64 market create

creating market order

To check the order on the market use the market processing command

$./sonmcli_linux64 market processing

viewing market orders

At this point no hub has accepted our bid order, so let’s buy from ourselves. Since we have the worker idling we can use our own computer resources to run a task.

To create an ask order we need to make the configuration file. Call it slot.yaml

duration: 1h

  cpu_cores: 1
  ram_bytes: 512mb
  gpu_count: NO_GPU
  storage: 1Gb

    in: 100Mb
    out: 100Mb
    type: INCOMING

    foo: 1101
    cycles: 42

Save it to the cli directory. We are going to use the hub to create the ask order.  In your cli folder:

$ ./sonmcli_linux64 hub ask-plan create 1 slot.yaml

You should get an ID in return:

ask order id

If you keep refreshing with the market processing command, eventually you will see the contract will change from processing to dealing to done. Congratulations, you just purchase 1 hour of 512mb ram, 1gb storage, 100mb network traffic and a cpu core. You can now view the accepted deal ID under the deals command.

$ ./sonmcli_linx64 deals list

accepted deals

To assign tasks to these rented resources, we need another configuration file. Call this one task.yaml

    # image name to start, requried
    name: nginx:latest
      # number of CPU cores required by task, required param
      CPU: 1
      # amount of memory required by task, required param
      # You may use Kb, Mb and Gb suffixes
      RAM: 20Mb

Save it in the cli folder.

Run the task by assigning it to the contract by the deal ID, in my case it was 1146.

$ ./sonmcli_linux64 tasks start 1146 task.yaml

It should return the following:

docker nginx

You can test it by going to the first endpoint. shows the nginx welcome page.

nginx welcome

We are currently using our own resources but through the SONM platform. If there is nobody else on the testnet it is unlikely your bid orders will execute. For this example I’ve set up two droplets so we can try using another supplier’s resources.

I’ve created an ask order on the second droplet for the price of 14. We can check for active orders using the market search command

$ ./sonmcli_linux64 market search slot.yaml --type ASK --limit 1000

We set the limit to the amount of orders to view to a high number so we can see all the ask orders with our parameters, at the time of writing there were only 268 orders on the market. Since we set the price of 14, you should see the order in the list.

To become the consumer for the order we need to create a bid order. We will also specify the other node’s hub eth address so the orders can be matched up manually instead of waiting for the locator to match them.

$ ./sonmcli_linux64 market create bid_order.yaml 0x61Abb428766847B3a7bd6Cd11A4033AB14EA4089

In return you should see the deal start executing and dealing. Once the deal is done you can verify the supplier and consumer addresses are different using the deals list command.

Here we can see the deal ID is 1147, it has the price of 14 and the consumer and supplier’s addresses are different. At this point we have successfully rented another node’s resources for an hour, and now we are ready to run some tasks.

In the previous example we ran a simple nginx server, this time we will try to run a wordpress application. Edit the taks.yaml file and change the image name to wordpress:latest.

Save the file, we are now ready to start the task on our 1 hour rented deal.

$ ./sonmcli_linux64 tasks start 1147 task.yaml

If we navigate to one of the endpoints we will see the wordpress welcome page. Go through the set up and fill in the fields for the database that we set up.

What you will notice, is the endpoint’s IP address belongs to the supplier and not the consumer. This clearly shows that we are rendering the page using our supplier’s resources.

If you made it this far make sure to check out this video where I show off how to run DOOM on SONM:

This is it for the first part of the tutorial. In the second part I will go over another use case for the SONM MVP. If you have any questions make sure to ask them and I will do my best to get back to you.