Creating a new sell order

To create a new sell order the user should send a NIP-44 direct message (kind 14) to Mostro, the decrypted content should look like this:

[
  {
    "order": {
      "version": 2,
      "action": "new-order",
      "trade_index": 1,
      "payload": {
        "order": {
          "kind": "sell",
          "status": "pending",
          "amount": 0,
          "fiat_code": "VES",
          "min_amount": null,
          "max_amount": null,
          "fiat_amount": 100,
          "payment_method": "face to face,bank transfer,mobile",
          "premium": 1,
          "created_at": 0
        }
      }
    }
  },
  "<index N signature of the sha256 hash of the serialized first element of content>",
  ["<index 0 pubkey (identity key)>", "<index 0 identity proof signature>"]
]

Let's explain some of the fields:

  • kind: sell or buy
  • status: Is always pending when creating a new order
  • amount: 0 for when we want to sell with at market price, otherwise the amount in satoshis
  • created_at: No need to send the correct unix timestamp, Mostro will replace it with the current time

The event to send to Mostro would look like this:

{
  "id": "<Event id>",
  "kind": 14,
  "pubkey": "<Seller's trade pubkey>",
  "content": "<NIP-44 ciphertext of the content array>",
  "tags": [
    ["p", "<Mostro's pubkey>"],
    ["expiration", "<unix timestamp>"]
  ],
  "created_at": 1234567890,
  "sig": "<Seller's trade key signature>"
}

Optional: anti-abuse maker bond

When the Mostro node has bonds enabled and apply_to is "make" or "both", the maker must lock a bond before the order is published. Instead of a new-order confirmation, Mostro first responds with a pay-bond-invoice message asking the maker to pay a small hold invoice (typically ~1% of the trade amount). The order is not visible on Nostr until the bond HTLC is accepted.

Only after the maker pays the bond does Mostro:

  1. Publish the order to Nostr with status pending.
  2. Send the new-order confirmation (shown below).

If the maker never pays, the bond invoice expires at the node's deadline, no order is published and Mostro sends the maker canceled. Before paying, the maker can also cancel the order. See Pay bond invoice — Maker bond for details.

Optional: Cashu escrow mint

On a node whose info event says escrow_mode = "cashu", the maker chooses the Cashu mint the escrow will be locked on, with a cashu_mint_url field in the order:

"order": {
  "kind": "sell",
  "status": "pending",
  "amount": 0,
  "fiat_code": "VES",
  "min_amount": null,
  "max_amount": null,
  "fiat_amount": 100,
  "payment_method": "face to face,bank transfer,mobile",
  "premium": 1,
  "created_at": 0,
  "cashu_mint_url": "https://mint.example.com"
}

Mostro decides whether to publish the order on that mint, using the cashu_mint_url tag of its info event:

  • Tag present: it lists every mint the node accepts. An order on any other mint is rejected with cant-do and reason invalid_mint_url, and nothing is published.
  • Tag absent: the node accepts any mint whose host is public. Mints on loopback, private or link-local addresses are rejected the same way.
  • No cashu_mint_url in the order: Mostro uses the node's mint when the info event lists exactly one. Otherwise it rejects the order with invalid_mint_url.

Mostro stores the mint in canonical form: lowercase host, no default port, no trailing /. It returns that form in the confirmation and publishes it in the order event's cashu_mint_url tag. A taker who takes the order accepts that mint, and the seller must lock the escrow on it and no other.

A Lightning node rejects an order that carries cashu_mint_url with invalid_mint_url. Lightning orders omit the field.

Confirmation message

Mostro will send back a kind 14 event as a confirmation message to the user like the following (decrypted content example):

[
  {
    "order": {
      "version": 2,
      "id": "<Order id>",
      "action": "new-order",
      "payload": {
        "order": {
          "id": "<Order id>",
          "kind": "sell",
          "status": "pending",
          "amount": 0,
          "fiat_code": "VES",
          "fiat_amount": 100,
          "payment_method": "face to face,bank transfer,mobile",
          "premium": 1,
          "created_at": 1698870173
        }
      }
    }
  },
  null,
  null
]

Mostro publishes this order as an event kind 38383 with status pending:

[
  "EVENT",
  "RAND",
  {
    "id": "<Event id>",
    "pubkey": "<Mostro's pubkey>",
    "created_at": 1702548701,
    "kind": 38383,
    "tags": [
      ["d", "<Order id>"],
      ["k", "sell"],
      ["f", "VES"],
      ["s", "pending"],
      ["amt", "0"],
      ["fa", "100"],
      ["pm", "face to face", "bank transfer", "mobile"],
      ["premium", "1"],
      ["rating", "[\"rating\",{\"since\":1701648000,\"days\":10,\"total_rating\":4.5,\"total_reviews\":7}]"],
      ["network", "mainnet"],
      ["layer", "lightning"],
      ["expiration", "1719391096"],
      ["y", "mostro", "[Mostro instance name]"],
      ["z", "order"]
    ],
    "content": "",
    "sig": "<Mostro's signature>"
  }
]