How to launch and manage task in SONM network


To launch task in SONM network you must conclude deal first. You can place order on market via SONM CLI or you also can buy out sell order from Market (visit SONM GUI guide for further instructions)

Order management via SONM CLI

First of all, you need to create buy order configuration file bid.yaml. You can get one from GitHub or here - this is more detailed example.

wget - this command will download bid.yaml example from GitHub

You need to configure it to suit your application needs. You can read more about orders types and orders configuration here

To place orders on market you should have SNM tokens on SONM-blockchain. For Forward deal you should have enough tokens to pay for first day/all deal duration time in case it lasts less than 24h. For Spot deal you should have enough tokens to pay at least for 1 hour. Make sure you have enough SNM on account used for node management. Tokens should be deposited in SONM blockchain.

Check your balance before placing orders: sonmcli token balance

Order management commands:

Create new orders: sonmcli order create <bid.yaml>. You should specify path to your bid.yaml here.

List all your orders - sonmcli order list

Check your current order status: sonmcli order status

In case you want to remove your order from market: sonmcli order cancel <orderId>. Order cancel takes some time, so it might be visible in orders list for a few seconds.

You can also remove ALL your orders by executing sonmcli order purge

Note, that order will be automatically removed from Market after deal conclusion. If you want to make another deal - you should create order again.

Deal management via SONM CLI

Matcher will pick up suitable sell orders and then it will open a deal, removing active buy order. Note that this process may take about 1-2 minutes, if suitable sell order exists. Otherwise, it will remain active until suitable sell order appears.

Deal management commands:

If you know a suitable sell order and want to quickly buy it out and open a deal: sonmcli deal quick-buy <ask_id> [duration]. It will instantly open deal with provided ask order id and optional duration (should be less or equal comparing to ask order)

If you want to list all your deals: sonmcli deal list

Check deal parameters and status: sonmcli deal status <deal_id>

As Customer, you can close any deal at any time: `sonmcli deal close . You will pay for actual Deal duration.

Task management

If you wish to run a task you need to make task configuration file first. You can see examples for whitelisted tasks on GitHub. Configure your task.yaml before the start.

You may launch several tasks for one deal - if there are enough resources left for this. Note that anonymous users can only launch whitelisted tasks. Check our whitelist on GitHub.

Task management commands:

Start the task from task.yaml for specified deal sonmcli task start <deal_id> <task.yaml>

List all tasks launched [for specified deal]: sonmcli task list [deal id]

Show task status: sonmcli task status <deal_id> <task_id>

Retrieve logs from your cointainer: sonmcli task logs <deal_id> <task_id>

Note You can stop your task in case of malfunction and restart it after task.yaml or Docker image correction:

sonmcli task stop <deal_id> <task_id>

Task management example video


I had 4.430139786364233 SNM tokens on my account before making a deal 1703. On video only 1.181503053564623 shown by sonmcli token balance. Notice that freezed tokens amount enough for 1h of > work (3,248636733) since it's spot deal.