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

bond add-invoice

commandbond.add-invoice
KindWrite
NeedsMOSTRO_PUBKEY, RELAYS, identity, the order’s local row, --yes in JSON mode
PublishesOne request with the payout invoice, signed with the order’s trade key
Local writeNone (persistence is not_attempted on success)
Statusesok, error, uncertain
Schemasschemas/bond.add-invoice.input.json, schemas/bond.add-invoice.output.json

On a bonded node, when the counterparty’s bond was slashed, part of it is owed to you. The node asks for an invoice (message list shows next_step: add_bond_invoice with a bond_payout_request payload); this command sends it.

Invocation

mostro-cli --output json bond add-invoice --order UUID --invoice BOLT11 --yes

Replaces addbondinvoice.

Input

OptionRequiredRule
--orderyesUUID of the order whose bond was slashed
--invoiceyesA BOLT-11 invoice for exactly your share of the slashed bond
--yesyes in JSON

Success data: BondInvoiceData

FieldTypeMeaning
node_pubkeyhex64The node
order_iduuidThe order
result"invoice_accepted"The node accepted the invoice and pays it from its wallet
counterparty_share_satsdecimal string or nullThe share amount the node reported; null when it reported none
trade_pubkeyhex64The order’s trade key

Outcomes

CasestatuscodeStages
Acceptedokpublished / accepted / not_attempted
Local failure, order_unknownerrorits codenot_attempted / unknown / not_attempted
Refused (wrong amount…)errornode_refused + reasonpublished / rejected / not_attempted
No / unusable replyuncertainreply_timeout, reply_malformed, relay_read_failed, pow_requiredpublished / unknown / not_attempted
Ambiguous relaysuncertainrequest_rejectedunknown / unknown / not_attempted

After uncertain, wait for the payout (or a new request in message list) before sending another invoice.

Errors

invalid_arguments, configuration_*, relay_connection_failed, relay_read_failed, internal_error, identity_*, protocol_unsupported, pow_required, request_rejected, node_refused, order_declined, order_unknown; uncertain: reply_timeout, reply_malformed, request_rejected, relay_read_failed, pow_required.

Warnings

invalid_event_timestamp, cleanup_incomplete.

Examples

Payout invoice for a slashed bond accepted

bond.add-invoice/invoice_accepted · status ok · exit 0 · fixture

mostro-cli --output json bond add-invoice --order 00000000-0000-0000-0000-000000000001 --invoice lnbcrt50u1p... --yes
{
  "schema_version": "1",
  "command": "bond.add-invoice",
  "status": "ok",
  "data": {
    "counterparty_share_sats": "5000",
    "node_pubkey": "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
    "order_id": "00000000-0000-0000-0000-000000000001",
    "result": "invoice_accepted",
    "trade_pubkey": "c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5"
  },
  "error": null,
  "warnings": [],
  "meta": {
    "publication": "published",
    "daemon_acceptance": "accepted",
    "persistence": "not_attempted",
    "snapshot": null
  }
}

Accepted; the node did not report the share amount

bond.add-invoice/no_share_reported · status ok · exit 0 · authored

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

No answer: wait for the payout before sending again

bond.add-invoice/reply_timeout_uncertain · status uncertain · reply_timeout · exit 1 · fixture

mostro-cli --output json bond add-invoice --order 00000000-0000-0000-0000-000000000001 --invoice lnbcrt50u1p... --yes
{
  "schema_version": "1",
  "command": "bond.add-invoice",
  "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_invoice

bond.add-invoice/node_refused · status error · node_refused · exit 1 · fixture

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

No local row for this order

bond.add-invoice/order_unknown · status error · order_unknown · exit 1 · fixture

mostro-cli --output json bond add-invoice --order 00000000-0000-0000-0000-000000000009 --invoice lnbcrt50u1p... --yes
{
  "schema_version": "1",
  "command": "bond.add-invoice",
  "status": "error",
  "data": null,
  "error": {
    "code": "order_unknown",
    "message": "No local order has this id, so nothing was sent."
  },
  "warnings": [],
  "meta": {
    "publication": "not_attempted",
    "daemon_acceptance": "unknown",
    "persistence": "not_attempted",
    "snapshot": null
  }
}

Next

Bonds