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 take-buy

commandorder.take-buy
KindWrite
NeedsMOSTRO_PUBKEY, RELAYS, an existing identity, a writable store, --yes in JSON mode
PublishesOne take-buy request signed with a fresh trade key
Local writeReserves the next trade index; saves the order row
Statusesok, error, uncertain
Schemasschemas/order.take-buy.input.json, schemas/order.take-buy.output.json

Takes a buy order: you become the seller of the sats. You will have to lock them by paying a hold invoice.

Invocation

mostro-cli --output json order take-buy --order UUID [--amount FIAT] --yes

Replaces takebuy -o .... There is no --invoice: the seller receives fiat, not sats.

Input

OptionRequiredRule
--orderyesUUID of a buy order, any case
--amountnoInteger > 0: the fiat amount you sell into a range order
--yesyes in JSON

Behavior

As order take-sell.

Success data: OrderTakeData

Same fields as take-sell with side: "buy".

next_stepMeaningDo
pay_hold_invoiceLock the sats: pay the hold invoice in payment_requestPay it with a Lightning wallet. It stays held (not settled) until you release or the trade is canceled
pay_bond_invoiceA bonded node wants a taker bond firstPay payment_request; a hold invoice follows (see message list)

Outcomes

As order new / take-sell.

Errors

Same set as order new.

Warnings

invalid_order_timestamp, invalid_event_timestamp, cleanup_incomplete.

Examples

A bonded node asks the taker for a bond before the hold invoice

order.take-buy/pay_bond_invoice · status ok · exit 0 · authored

mostro-cli --output json order take-buy --order 00000000-0000-0000-0000-000000000001 --yes
{
  "schema_version": "1",
  "command": "order.take-buy",
  "status": "ok",
  "data": {
    "node_pubkey": "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
    "order_id": "00000000-0000-0000-0000-000000000001",
    "side": "buy",
    "next_step": "pay_bond_invoice",
    "order": {
      "id": "00000000-0000-0000-0000-000000000001",
      "side": "buy",
      "status": "pending",
      "sats_amount": "15000",
      "fiat_currency": "USD",
      "fiat_amount": "15",
      "fiat_amount_min": null,
      "fiat_amount_max": null,
      "payment_method": "bank transfer",
      "premium_percent": "1",
      "buyer_trade_pubkey": null,
      "seller_trade_pubkey": null,
      "created_at": "2026-11-02T09:00:00Z",
      "created_at_unix": "1793610000",
      "expires_at": "2026-11-03T09:00:00Z",
      "expires_at_unix": "1793696400"
    },
    "payment_request": "lnbcrt1bondinvoice",
    "trade_index": "9",
    "trade_pubkey": "f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9"
  },
  "error": null,
  "warnings": [],
  "meta": {
    "publication": "published",
    "daemon_acceptance": "accepted",
    "persistence": "applied",
    "snapshot": null
  }
}

Took a buy order: as the seller, pay the hold invoice

order.take-buy/pay_hold_invoice · status ok · exit 0 · fixture

mostro-cli --output json order take-buy --order 00000000-0000-0000-0000-000000000001 --yes
{
  "schema_version": "1",
  "command": "order.take-buy",
  "status": "ok",
  "data": {
    "next_step": "pay_hold_invoice",
    "node_pubkey": "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
    "order": {
      "buyer_trade_pubkey": null,
      "created_at": "2026-10-16T00:00:00Z",
      "created_at_unix": "1792108800",
      "expires_at": "2026-10-17T00:00:00Z",
      "expires_at_unix": "1792195200",
      "fiat_amount": "15",
      "fiat_amount_max": null,
      "fiat_amount_min": null,
      "fiat_currency": "USD",
      "id": "00000000-0000-0000-0000-000000000001",
      "payment_method": "bank transfer",
      "premium_percent": "1",
      "sats_amount": "15000",
      "seller_trade_pubkey": null,
      "side": "sell",
      "status": "waiting-payment"
    },
    "order_id": "00000000-0000-0000-0000-000000000001",
    "payment_request": "lnbcrt1holdinvoice",
    "side": "buy",
    "trade_index": "3",
    "trade_pubkey": "c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5"
  },
  "error": null,
  "warnings": [],
  "meta": {
    "publication": "published",
    "daemon_acceptance": "accepted",
    "persistence": "applied",
    "snapshot": null
  }
}

Accepted by the node, local row not written; data still carries the hold invoice

order.take-buy/order_not_saved_uncertain · status uncertain · order_not_saved · exit 1 · fixture

mostro-cli --output json order take-buy --order 00000000-0000-0000-0000-000000000001 --yes
{
  "schema_version": "1",
  "command": "order.take-buy",
  "status": "uncertain",
  "data": {
    "next_step": "pay_hold_invoice",
    "node_pubkey": "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
    "order": {
      "buyer_trade_pubkey": null,
      "created_at": "2026-10-16T00:00:00Z",
      "created_at_unix": "1792108800",
      "expires_at": "2026-10-17T00:00:00Z",
      "expires_at_unix": "1792195200",
      "fiat_amount": "15",
      "fiat_amount_max": null,
      "fiat_amount_min": null,
      "fiat_currency": "USD",
      "id": "00000000-0000-0000-0000-000000000001",
      "payment_method": "bank transfer",
      "premium_percent": "1",
      "sats_amount": "15000",
      "seller_trade_pubkey": null,
      "side": "sell",
      "status": "waiting-payment"
    },
    "order_id": "00000000-0000-0000-0000-000000000001",
    "payment_request": "lnbcrt1holdinvoice",
    "side": "buy",
    "trade_index": "3",
    "trade_pubkey": "c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5"
  },
  "error": {
    "code": "order_not_saved",
    "message": "The node created the order but it could not be saved locally."
  },
  "warnings": [],
  "meta": {
    "publication": "published",
    "daemon_acceptance": "accepted",
    "persistence": "failed",
    "snapshot": null
  }
}

Published, no answer: the take may have happened

order.take-buy/reply_timeout_uncertain · status uncertain · reply_timeout · exit 1 · fixture

mostro-cli --output json order take-buy --order 00000000-0000-0000-0000-000000000001 --yes
{
  "schema_version": "1",
  "command": "order.take-buy",
  "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": "applied",
    "snapshot": null
  }
}

Ambiguous relay answers; recording the spent index failed too

order.take-buy/request_rejected_uncertain · status uncertain · request_rejected · exit 1 · authored

mostro-cli --output json order take-buy --order 00000000-0000-0000-0000-000000000001 --yes
{
  "schema_version": "1",
  "command": "order.take-buy",
  "status": "uncertain",
  "data": null,
  "error": {
    "code": "request_rejected",
    "message": "No relay confirmed accepting the request."
  },
  "warnings": [],
  "meta": {
    "publication": "unknown",
    "daemon_acceptance": "unknown",
    "persistence": "failed",
    "snapshot": null
  }
}

No local identity

order.take-buy/identity_missing · status error · identity_missing · exit 1 · fixture

mostro-cli --output json order take-buy --order 00000000-0000-0000-0000-000000000001 --yes
{
  "schema_version": "1",
  "command": "order.take-buy",
  "status": "error",
  "data": null,
  "error": {
    "code": "identity_missing",
    "message": "No local identity exists."
  },
  "warnings": [],
  "meta": {
    "publication": "not_attempted",
    "daemon_acceptance": "unknown",
    "persistence": "not_attempted",
    "snapshot": null
  }
}

–order is not a UUID

order.take-buy/invalid_uuid · status error · invalid_arguments · exit 2 · captured

mostro-cli --output json order take-buy --order not-a-uuid --yes
{
  "schema_version": "1",
  "command": "order.take-buy",
  "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

Selling as a taker