Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

order rate

commandorder.rate
KindWrite (node only)
WhoEither party of a finished trade
NeedsMOSTRO_PUBKEY, RELAYS, identity, the order’s local row, --yes in JSON mode
PublishesOne rate-user request with the rating, signed with the order’s trade key
Local writeNone; never spends a trade index
Statusesok, error, uncertain
Schemasschemas/order.rate.input.json, schemas/order.rate.output.json

Rates the counterparty of a finished trade from 1 to 5.

Invocation

mostro-cli --output json order rate --order UUID --rating 1-5 --yes

Replaces rate -o ... -r ... (no alias).

Input

OptionRequiredRule
--orderyesUUID of an order in the local store
--ratingyesAn integer from 1 to 5; anything else is invalid_arguments (exit 2) and nothing is sent
--yesyes in JSON

Behavior

Checks the rating, looks up the order’s trade key in the local orders table (order_unknown if missing; nothing sent), publishes rate-user and waits for the reply to that request. The node acknowledges with rate-received carrying the rating; the CLI checks that it is the rating it sent. Nothing is written locally (the store only has to be readable).

The node accepts a rating once the order is success, or settled-hold-invoice when the seller rates; otherwise it refuses (node_refused, reason invalid_order_status). Some cases get no answer at all: a side that already rated, a counterparty in full-privacy mode, a sender who is neither party. They end as uncertain with reply_timeout. The CLI never retries.

Success data: RateData

FieldTypeMeaning
node_pubkeyhex64The node
order_iduuidThe order
ratingintegerThe rating the node acknowledged, 1 to 5 (a JSON number, not a string)
trade_pubkeyhex64The order’s trade key

Outcomes

CasestatuscodeStages
Rating receivedokpublished / accepted / not_attempted
Rating outside 1-5, no --yes in JSONerrorinvalid_argumentsnot_attempted / unknown / not_attempted
Not in storeerrororder_unknownnot_attempted / unknown / not_attempted
Other local failureerrorits codenot_attempted / unknown / not_attempted
Refused (trade not finished…)errornode_refused + reasonpublished / rejected / not_attempted
No reply (already rated, full-privacy counterparty)uncertainreply_timeoutpublished / unknown / not_attempted
Unusable reply (another rating, another order, a cant-do naming another order or none)uncertainreply_malformedpublished / unknown / not_attempted
Relay dropped the wait, proof of workuncertainrelay_read_failed, pow_requiredpublished / unknown / not_attempted
Ambiguous relaysuncertainrequest_rejectedunknown / unknown / not_attempted

After uncertain, do not send the rating again: the node may have recorded it, and it answers a second one with silence. No command shows whether a rating was recorded.

Errors

As dispute open.

Warnings

invalid_event_timestamp, cleanup_incomplete. Never local_status_stale: nothing is written locally.

Examples

The node received the rating

order.rate/rating_received · status ok · exit 0 · fixture

mostro-cli --output json order rate --order 00000000-0000-0000-0000-000000000001 --rating 5 --yes
{
  "schema_version": "1",
  "command": "order.rate",
  "status": "ok",
  "data": {
    "node_pubkey": "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
    "order_id": "00000000-0000-0000-0000-000000000001",
    "rating": 5,
    "trade_pubkey": "c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5"
  },
  "error": null,
  "warnings": [],
  "meta": {
    "publication": "published",
    "daemon_acceptance": "accepted",
    "persistence": "not_attempted",
    "snapshot": null
  }
}

No answer: the rating may have been recorded. Do not send it again

order.rate/no_answer_uncertain · status uncertain · reply_timeout · exit 1 · fixture

mostro-cli --output json order rate --order 00000000-0000-0000-0000-000000000001 --rating 5 --yes
{
  "schema_version": "1",
  "command": "order.rate",
  "status": "uncertain",
  "data": null,
  "error": {
    "code": "reply_timeout",
    "message": "The node did not answer before the deadline."
  },
  "warnings": [],
  "meta": {
    "publication": "published",
    "daemon_acceptance": "unknown",
    "persistence": "not_attempted",
    "snapshot": null
  }
}

Refused with reason invalid_order_status (the trade is not finished)

order.rate/node_refused · status error · node_refused · exit 1 · fixture

mostro-cli --output json order rate --order 00000000-0000-0000-0000-000000000001 --rating 5 --yes
{
  "schema_version": "1",
  "command": "order.rate",
  "status": "error",
  "data": null,
  "error": {
    "code": "node_refused",
    "message": "The node refused the request.",
    "reason": "invalid_order_status"
  },
  "warnings": [],
  "meta": {
    "publication": "published",
    "daemon_acceptance": "rejected",
    "persistence": "not_attempted",
    "snapshot": null
  }
}

A rating outside 1 to 5 is rejected before anything is sent

order.rate/rating_out_of_range · status error · invalid_arguments · exit 2 · fixture

mostro-cli --output json order rate --order 00000000-0000-0000-0000-000000000001 --rating 6 --yes
{
  "schema_version": "1",
  "command": "order.rate",
  "status": "error",
  "data": null,
  "error": {
    "code": "invalid_arguments",
    "message": "The command arguments are invalid."
  },
  "warnings": [],
  "meta": {
    "publication": "not_attempted",
    "daemon_acceptance": "unknown",
    "persistence": "not_attempted",
    "snapshot": null
  }
}

Next

Nothing: the trade is over.