Edit this page

Getting started as a Consumer

Updated on 08-02-2018

Who is SONM Consumer

Consumer is a SONM's user, which buys and uses the computing resources of other users (Suppliers) through the system. The purpose of the Consumer is to perform a specific task in an optimal way (most quickly, most cheaply, by the price / speed criterion, most reliably, or others). Every Consumer should have his own Ethereum account, that is his unique identifier.

The main algorithm of using SONM for Consumer is:

  • Download and configure SONM components
  • Get SONM test tokens
  • Go to the Marketplace
  • Choose resources, place an order
  • Get the most suitable offer and make a deal
  • Start the task on the purchased resources
  • Get task results back

About application

In this MVP release SONM Consumer may use the following operation systems:

  • Linux;
  • MS Windows;
  • MacOS.

As a Consumer you will use the following SONM components:

NOTE: To start using SONM you need to have an account on Rinkeby blockchain. The keystore file to access your Rinkeby accout must be in UTC/JSON format. You may generate a new Ethereum key with SONM Wallet or CLI. Then you have to get test Ether on Rinkeby blockchain.

Install components

To install SONM Node and CLI follow the installation instructions.

To install SONM Wallet follow the SONM Wallet guide.

NOTE: You should use the same Ethereum key file for all SONM components.

After that you will be able to interact with the SONM platform through SONM CLI interface. See the SONM CLI Guide for command usage details.

Interact with Marketplace

  1. Get test Ether on Rinkeby blockchain.
  2. Get test tokens to your account using SONM Wallet.
  3. Make allowance for SONM smart contract to be able to pay for the resourses: sonmcli approve.
  4. Create a slot configuration file (slot.yaml) to search for orders in the Marketplace (see example in SONM GitHub).
  5. Search for BID, ASK, or ANY orders matched to your slot: sonmcli market search
  6. Create the BID order in the Marketplace using your slot configuration file (slot.yaml): sonmcli market create.
  7. Check status of your BID orders: sonmcli market processing.
  8. When it's nesessary you can remove the BID order: sonmcli market cancel.

After the BID order has been created SONM Client Node starts to search ASK orders that match your BID order. If several ASK orders are found Client node gets the cheapest one, and proposes a deal to the Hub (ASK order owner).

Manage deals

When the deal is opened, SONM smart contract transfers tokens from your account to contract account. Tokens remain there until the deal is closed.

  1. Check your deals list to see your current deals: sonmcli deals list.
  2. Check your balance using SONM Wallet and ensure tokens transferred.
  3. View you new deal details: sonmcli deals status.

You can start task execution when deal is accepted.

Eхecute tasks

  1. Prepare your task:

    • Choose task image you like to execute.

      NOTE: In this MVP release you should use Docker images included to SONM testnet whitelist. The only exception is to try both Consumer and Supplier roles (i.e. you must have the same Ethereum address for Consumer's Client node and Supplier's Hub to be able to run your own Docker images).

    • Create task specification file task.yaml for this task on your PC (see example in distribution archive). For whitelist tasks get file task.yaml from the whitelist "task" folder.

      NOTE: Set "name" as < [email protected]_hash >. Example from whitelist:

      {
      "hello-world" : {
      "allowed_hashes" :[
      "sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c"
      ]
      }
      task.yaml: 
      name: "[email protected]:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c".
  2. Push your task specification to the Hub: sonmcli tasks push.

    NOTE: Use <sonmcli tasks push> command if you want to use custom Docker image stored on your PC filesystem. This command uploads image specified onto the SONM worker node. If you use Docker image from whitelist, skip this step.

  3. Start task execution: sonmcli tasks start.

  4. View your active task list: sonmcli tasks list

  5. Check your task status: sonmcli tasks status.

  6. View task logs: sonmcli tasks logs.

  7. Stop task execution: sonmcli tasks stop.

  8. Get result task image file after execution: sonmcli tasks pull.

    NOTE: You can execute several tasks within the one deal.

Close deal

The deal may be closed in two ways.

  • Automatically, when the deal time is over. All tokens are tranfered to Supplier's address.
  • You can close deal manually before the deal time is over. Use sonmcli deals finish. Tokens are tranfered to Supplier's address in proportion to the deal duration. Rest of tokens are tranfered back to your address. 

Check your balance using SONM Wallet and ensure tokens transferred.