Mostro specification for clients
Overview
All messages broadcasted by Mostro daemon are Parameterized Replaceable Events and use 30078
as event kind
, a list of standard event kinds can be found here
Communication between users and Mostro
All messages from/to Mostro should be a Nostr event kind 4, the content
field of the event should be a base64-encoded, aes-256-cbc encrypted JSON-serialized string (with no white space or line breaks) of the following structure:
This is version 0 of the protocol, the version is specified in the version
field of the message, and will be replaced by a new version soon.
Creating a new order
To create a new sell order the user should send a Nostr event kind 4 to Mostro with the following content:
{
"version": "0",
"pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2",
"action": "Order",
"content": {
"Order": {
"kind": "Sell",
"status": "Pending",
"amount": 0,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"created_at": 0
}
}
}
Let's explain some of the fields:
- kind:
Sell
orBuy
- 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
- pubkey: Real user's pubkey, we use this when the message was sent from an ephemeral key
- created_at: No need to send the correct unix timestamp, Mostro will replace it with the current time
Confirmation message
Mostro will send back a confirmation message to the user like the following:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "Order",
"content": {
"Order": {
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"kind": "Sell",
"status": "Pending",
"amount": 0,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"created_at": 1698870173
}
}
}
Taking a sell order
If the order amount is 0
the buyer don't know the exact amount to create the invoice, buyer will send a message in a Nostr event kind 4 to Mostro with the following content:
{
"version": "0",
"pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"action": "TakeSell",
"content": null
}
Mostro response
In order to continue the buyer needs to send a lightning network invoice to Mostro, in this case the amount of the order is 0
, so Mostro will need to calculate the amount of sats for this order, then Mostro will send back a message asking for a LN invoice indicating the correct amount of sats that the invoice should have:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "AddInvoice",
"content": {
"SmallOrder": {
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"buyer_pubkey": null,
"seller_pubkey": null
}
}
}
Buyer sends LN invoice
Here is how the buyer send the LN invoice to Mostro, in case the order has a fixed sats amount, the buyer can we skip the previous step:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "TakeSell",
"content": {
"PaymentRequest": [
null,
"lnbcrt32680n1pj59wmepp50677g8tffdqa2p8882y0x6newny5vtz0hjuyngdwv226nanv4uzsdqqcqzzsxqyz5vqsp5skn973360gp4yhlpmefwvul5hs58lkkl3u3ujvt57elmp4zugp4q9qyyssqw4nzlr72w28k4waycf27qvgzc9sp79sqlw83j56txltz4va44j7jda23ydcujj9y5k6k0rn5ms84w8wmcmcyk5g3mhpqepf7envhdccp72nz6e"
]
}
}
Mostro response
Mostro send the following message to the buyer:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "WaitingSellerToPay",
"content": null
}
Taking a buy order
To take an order the seller will send to Mostro a message with the following content:
{
"version": "0",
"pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"action": "TakeBuy",
"content": {
"Peer": {
"pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2"
}
}
}
Mostro response
Mostro respond to the seller with a message with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "PayInvoice",
"content": {
"PaymentRequest": [
{
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"kind": "Buy",
"status": "WaitingPayment",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"created_at": 1698957793
},
"lnbcrt32680n1pj59wmepp50677g8tffdqa2p8882y0x6newny5vtz0hjuyngdwv226nanv4uzsdqqcqzzsxqyz5vqsp5skn973360gp4yhlpmefwvul5hs58lkkl3u3ujvt57elmp4zugp4q9qyyssqw4nzlr72w28k4waycf27qvgzc9sp79sqlw83j56txltz4va44j7jda23ydcujj9y5k6k0rn5ms84w8wmcmcyk5g3mhpqepf7envhdccp72nz6e"
]
}
}
And send a message to the buyer with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "WaitingSellerToPay",
"content": null
}
Seller pays LN invoice
After seller pays the hold invoice Mostro send a message to the seller with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "WaitingBuyerInvoice",
"content": null
}
And sends a message to the buyer with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "AddInvoice",
"content": {
"SmallOrder": {
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"buyer_pubkey": null,
"seller_pubkey": null
}
}
}
Buyer sends LN invoice
Buyer sends the LN invoice to Mostro.
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "AddInvoice",
"content": {
"PaymentRequest": [
null,
"lnbcrt32680n1pj59wmepp50677g8tffdqa2p8882y0x6newny5vtz0hjuyngdwv226nanv4uzsdqqcqzzsxqyz5vqsp5skn973360gp4yhlpmefwvul5hs58lkkl3u3ujvt57elmp4zugp4q9qyyssqw4nzlr72w28k4waycf27qvgzc9sp79sqlw83j56txltz4va44j7jda23ydcujj9y5k6k0rn5ms84w8wmcmcyk5g3mhpqepf7envhdccp72nz6e"
]
}
}
Seller pays hold invoice
When the seller is the maker and the order was taken by a buyer, Mostro will send to the seller a message asking to pay the hold invoice, the message will look like this:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "PayInvoice",
"content": {
"PaymentRequest": [
{
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"kind": "Sell",
"status": "WaitingBuyerInvoice",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"created_at": 1698937797
},
"lnbcrt78510n1pj59wmepp50677g8tffdqa2p8882y0x6newny5vtz0hjuyngdwv226nanv4uzsdqqcqzzsxqyz5vqsp5skn973360gp4yhlpmefwvul5hs58lkkl3u3ujvt57elmp4zugp4q9qyyssqw4nzlr72w28k4waycf27qvgzc9sp79sqlw83j56txltz4va44j7jda23ydcujj9y5k6k0rn5ms84w8wmcmcyk5g3mhpqepf7envhdccp72nz6e"
]
}
}
After the hold invoice is paid Mostro will send a new message to seller with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "BuyerTookOrder",
"content": {
"SmallOrder": {
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"buyer_pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"seller_pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2"
}
}
}
Mostro also send a message to the buyer, this way they can both to to each other in private, this message would look like this:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "HoldInvoicePaymentAccepted",
"content": {
"SmallOrder": {
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"buyer_pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"seller_pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2"
}
}
}
Ephemeral keys
Mostro clients should use ephemeral keys to communicate with Mostro, indicating the pubkey where they want to be contacted in the pubkey
field of the message, this way orders and users can't be easily linked, buyer_pubkey
and seller_pubkey
fields are the real pubkeys of the users.
Fiat sent
After the buyer sends the fiat money to the seller, the buyer should send a message to Mostro indicating that the fiat money was sent, the message will look like this:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"action": "FiatSent",
"content": null
}
Mostro response
Mostro send a messages to both parties confirming FiatSent
action and sending again the counterpart pubkey, here an example of the message to the buyer:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"action": "FiatSent",
"content": {
"Peer": {
"pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2"
}
}
}
And here an example of the message to the seller:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2",
"action": "FiatSent",
"content": {
"Peer": {
"pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj"
}
}
}
Release
After confirming the buyer sent the fiat money, the seller should send a message to Mostro indicating that sats should be delivered to the buyer, the message will look like this:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2",
"action": "Release",
"content": null
}
Mostro response
Here an example of the Mostro response to the seller:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "HoldInvoicePaymentSettled",
"content": null
}
And a message to the buyer to let him know that the sats were released:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "Release",
"content": null
}
Buyer receives sats
Right after seller release sats Mostro will try to pay the buyer's lightning invoice, if the payment is successful Mostro will send a message to the buyer indicating that the purchase was completed:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "PurchaseCompleted",
"content": null
}
User rating
After a successful trade Mostro send a nip04 event to both parties to let them know they can rate each other, here an example how the message look like:
{
"version": "0",
"order_id": "7e44aa5d-855a-4b17-865e-8ca3834a91a3",
"pubkey": null,
"action": "RateUser",
"content": null
}
After a Mostro client receive this message, the user can rate the other party, the rating is a number between 1 and 5, to rate the client must receive user's input and create a new nip04 event to send to Mostro with this content:
{
"version": "0",
"order_id": "7e44aa5d-855a-4b17-865e-8ca3834a91a3",
"pubkey": null,
"action": "RateUser",
"content": {
"RatingUser": 5 // User input
}
}
Confirmation message
If Mostro received the message correct it will send back a last confirmation message to the user with Action: Received
:
{
"version": "0",
"order_id": "7e44aa5d-855a-4b17-865e-8ca3834a91a3",
"pubkey": null,
"action": "Received",
"content": null
}
Cancel Order
A use can cancel an Order created by himself and with status Pending
sending action Cancel
, the message will look like this:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"action": "Cancel",
"content": null
}
Mostro response
Mostro will send a message with action Cancel
confirming the order was canceled, here an example of the message:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "Cancel",
"content": null
}
Cancel cooperatively
A user can cancel an Active
order, but will need the counterparty to agree, let's look at an example where the seller initiates a cooperative cancellation:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "Cancel",
"content": null
}
Mostro will send this message to the seller:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "CooperativeCancelInitiatedByYou",
"content": null
}
And this message to the buyer:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "CooperativeCancelInitiatedByPeer",
"content": null
}
The buyer can accept the cooperative cancellation sending this message:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "Cancel",
"content": null
}
Dispute
A use can start a dispute in an order with status Pending
or FiatSent
sending action Dispute
, here is an example where the seller initiates a dispute:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"action": "Dispute",
"content": null
}
Mostro response
Mostro will send this message to the seller:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "DisputeInitiatedByYou,",
"content": null
}
And here is the message to the buyer:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "DisputeInitiatedByPeer",
"content": null
}
Actions
Creating a new order
To create a new sell order the user should send a Nostr event kind 4 to Mostro with the following content:
{
"version": "0",
"pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2",
"action": "Order",
"content": {
"Order": {
"kind": "Sell",
"status": "Pending",
"amount": 0,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"created_at": 0
}
}
}
Let's explain some of the fields:
- kind:
Sell
orBuy
- 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
- pubkey: Real user's pubkey, we use this when the message was sent from an ephemeral key
- created_at: No need to send the correct unix timestamp, Mostro will replace it with the current time
Confirmation message
Mostro will send back a confirmation message to the user like the following:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "Order",
"content": {
"Order": {
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"kind": "Sell",
"status": "Pending",
"amount": 0,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"created_at": 1698870173
}
}
}
Taking a sell order
If the order amount is 0
the buyer don't know the exact amount to create the invoice, buyer will send a message in a Nostr event kind 4 to Mostro with the following content:
{
"version": "0",
"pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"action": "TakeSell",
"content": null
}
Mostro response
In order to continue the buyer needs to send a lightning network invoice to Mostro, in this case the amount of the order is 0
, so Mostro will need to calculate the amount of sats for this order, then Mostro will send back a message asking for a LN invoice indicating the correct amount of sats that the invoice should have:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "AddInvoice",
"content": {
"SmallOrder": {
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"buyer_pubkey": null,
"seller_pubkey": null
}
}
}
Buyer sends LN invoice
Here is how the buyer send the LN invoice to Mostro, in case the order has a fixed sats amount, the buyer can we skip the previous step:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "TakeSell",
"content": {
"PaymentRequest": [
null,
"lnbcrt32680n1pj59wmepp50677g8tffdqa2p8882y0x6newny5vtz0hjuyngdwv226nanv4uzsdqqcqzzsxqyz5vqsp5skn973360gp4yhlpmefwvul5hs58lkkl3u3ujvt57elmp4zugp4q9qyyssqw4nzlr72w28k4waycf27qvgzc9sp79sqlw83j56txltz4va44j7jda23ydcujj9y5k6k0rn5ms84w8wmcmcyk5g3mhpqepf7envhdccp72nz6e"
]
}
}
Mostro response
Mostro send the following message to the buyer:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "WaitingSellerToPay",
"content": null
}
Taking a sell order
If the order amount is 0
the buyer don't know the exact amount to create the invoice, buyer will send a message in a Nostr event kind 4 to Mostro with the following content:
{
"version": "0",
"pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"action": "TakeSell",
"content": null
}
Mostro response
In order to continue the buyer needs to send a lightning network invoice to Mostro, in this case the amount of the order is 0
, so Mostro will need to calculate the amount of sats for this order, then Mostro will send back a message asking for a LN invoice indicating the correct amount of sats that the invoice should have:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "AddInvoice",
"content": {
"SmallOrder": {
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"buyer_pubkey": null,
"seller_pubkey": null
}
}
}
Buyer sends LN invoice
Here is how the buyer send the LN invoice to Mostro, in case the order has a fixed sats amount, the buyer can we skip the previous step:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "TakeSell",
"content": {
"PaymentRequest": [
null,
"lnbcrt32680n1pj59wmepp50677g8tffdqa2p8882y0x6newny5vtz0hjuyngdwv226nanv4uzsdqqcqzzsxqyz5vqsp5skn973360gp4yhlpmefwvul5hs58lkkl3u3ujvt57elmp4zugp4q9qyyssqw4nzlr72w28k4waycf27qvgzc9sp79sqlw83j56txltz4va44j7jda23ydcujj9y5k6k0rn5ms84w8wmcmcyk5g3mhpqepf7envhdccp72nz6e"
]
}
}
Mostro response
Mostro send the following message to the buyer:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "WaitingSellerToPay",
"content": null
}
Taking a sell order
If the order amount is 0
the buyer don't know the exact amount to create the invoice, buyer will send a message in a Nostr event kind 4 to Mostro with the following content:
{
"version": "0",
"pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"action": "TakeSell",
"content": null
}
Mostro response
In order to continue the buyer needs to send a lightning network invoice to Mostro, in this case the amount of the order is 0
, so Mostro will need to calculate the amount of sats for this order, then Mostro will send back a message asking for a LN invoice indicating the correct amount of sats that the invoice should have:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "AddInvoice",
"content": {
"SmallOrder": {
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"buyer_pubkey": null,
"seller_pubkey": null
}
}
}
Buyer sends LN invoice
Here is how the buyer send the LN invoice to Mostro, in case the order has a fixed sats amount, the buyer can we skip the previous step:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "TakeSell",
"content": {
"PaymentRequest": [
null,
"lnbcrt32680n1pj59wmepp50677g8tffdqa2p8882y0x6newny5vtz0hjuyngdwv226nanv4uzsdqqcqzzsxqyz5vqsp5skn973360gp4yhlpmefwvul5hs58lkkl3u3ujvt57elmp4zugp4q9qyyssqw4nzlr72w28k4waycf27qvgzc9sp79sqlw83j56txltz4va44j7jda23ydcujj9y5k6k0rn5ms84w8wmcmcyk5g3mhpqepf7envhdccp72nz6e"
]
}
}
Mostro response
Mostro send the following message to the buyer:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "WaitingSellerToPay",
"content": null
}
Taking a buy order
To take an order the seller will send to Mostro a message with the following content:
{
"version": "0",
"pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"action": "TakeBuy",
"content": {
"Peer": {
"pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2"
}
}
}
Mostro response
Mostro respond to the seller with a message with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "PayInvoice",
"content": {
"PaymentRequest": [
{
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"kind": "Buy",
"status": "WaitingPayment",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"created_at": 1698957793
},
"lnbcrt32680n1pj59wmepp50677g8tffdqa2p8882y0x6newny5vtz0hjuyngdwv226nanv4uzsdqqcqzzsxqyz5vqsp5skn973360gp4yhlpmefwvul5hs58lkkl3u3ujvt57elmp4zugp4q9qyyssqw4nzlr72w28k4waycf27qvgzc9sp79sqlw83j56txltz4va44j7jda23ydcujj9y5k6k0rn5ms84w8wmcmcyk5g3mhpqepf7envhdccp72nz6e"
]
}
}
And send a message to the buyer with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "WaitingSellerToPay",
"content": null
}
Seller pays LN invoice
After seller pays the hold invoice Mostro send a message to the seller with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "WaitingBuyerInvoice",
"content": null
}
And sends a message to the buyer with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "AddInvoice",
"content": {
"SmallOrder": {
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"buyer_pubkey": null,
"seller_pubkey": null
}
}
}
Buyer sends LN invoice
Buyer sends the LN invoice to Mostro.
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "AddInvoice",
"content": {
"PaymentRequest": [
null,
"lnbcrt32680n1pj59wmepp50677g8tffdqa2p8882y0x6newny5vtz0hjuyngdwv226nanv4uzsdqqcqzzsxqyz5vqsp5skn973360gp4yhlpmefwvul5hs58lkkl3u3ujvt57elmp4zugp4q9qyyssqw4nzlr72w28k4waycf27qvgzc9sp79sqlw83j56txltz4va44j7jda23ydcujj9y5k6k0rn5ms84w8wmcmcyk5g3mhpqepf7envhdccp72nz6e"
]
}
}
Taking a buy order
To take an order the seller will send to Mostro a message with the following content:
{
"version": "0",
"pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"action": "TakeBuy",
"content": {
"Peer": {
"pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2"
}
}
}
Mostro response
Mostro respond to the seller with a message with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "PayInvoice",
"content": {
"PaymentRequest": [
{
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"kind": "Buy",
"status": "WaitingPayment",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"created_at": 1698957793
},
"lnbcrt32680n1pj59wmepp50677g8tffdqa2p8882y0x6newny5vtz0hjuyngdwv226nanv4uzsdqqcqzzsxqyz5vqsp5skn973360gp4yhlpmefwvul5hs58lkkl3u3ujvt57elmp4zugp4q9qyyssqw4nzlr72w28k4waycf27qvgzc9sp79sqlw83j56txltz4va44j7jda23ydcujj9y5k6k0rn5ms84w8wmcmcyk5g3mhpqepf7envhdccp72nz6e"
]
}
}
And send a message to the buyer with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "WaitingSellerToPay",
"content": null
}
Seller pays LN invoice
After seller pays the hold invoice Mostro send a message to the seller with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "WaitingBuyerInvoice",
"content": null
}
And sends a message to the buyer with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "AddInvoice",
"content": {
"SmallOrder": {
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"buyer_pubkey": null,
"seller_pubkey": null
}
}
}
Buyer sends LN invoice
Buyer sends the LN invoice to Mostro.
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "AddInvoice",
"content": {
"PaymentRequest": [
null,
"lnbcrt32680n1pj59wmepp50677g8tffdqa2p8882y0x6newny5vtz0hjuyngdwv226nanv4uzsdqqcqzzsxqyz5vqsp5skn973360gp4yhlpmefwvul5hs58lkkl3u3ujvt57elmp4zugp4q9qyyssqw4nzlr72w28k4waycf27qvgzc9sp79sqlw83j56txltz4va44j7jda23ydcujj9y5k6k0rn5ms84w8wmcmcyk5g3mhpqepf7envhdccp72nz6e"
]
}
}
Taking a buy order
To take an order the seller will send to Mostro a message with the following content:
{
"version": "0",
"pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"action": "TakeBuy",
"content": {
"Peer": {
"pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2"
}
}
}
Mostro response
Mostro respond to the seller with a message with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "PayInvoice",
"content": {
"PaymentRequest": [
{
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"kind": "Buy",
"status": "WaitingPayment",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"created_at": 1698957793
},
"lnbcrt32680n1pj59wmepp50677g8tffdqa2p8882y0x6newny5vtz0hjuyngdwv226nanv4uzsdqqcqzzsxqyz5vqsp5skn973360gp4yhlpmefwvul5hs58lkkl3u3ujvt57elmp4zugp4q9qyyssqw4nzlr72w28k4waycf27qvgzc9sp79sqlw83j56txltz4va44j7jda23ydcujj9y5k6k0rn5ms84w8wmcmcyk5g3mhpqepf7envhdccp72nz6e"
]
}
}
And send a message to the buyer with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "WaitingSellerToPay",
"content": null
}
Seller pays LN invoice
After seller pays the hold invoice Mostro send a message to the seller with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "WaitingBuyerInvoice",
"content": null
}
And sends a message to the buyer with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "AddInvoice",
"content": {
"SmallOrder": {
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"buyer_pubkey": null,
"seller_pubkey": null
}
}
}
Buyer sends LN invoice
Buyer sends the LN invoice to Mostro.
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "AddInvoice",
"content": {
"PaymentRequest": [
null,
"lnbcrt32680n1pj59wmepp50677g8tffdqa2p8882y0x6newny5vtz0hjuyngdwv226nanv4uzsdqqcqzzsxqyz5vqsp5skn973360gp4yhlpmefwvul5hs58lkkl3u3ujvt57elmp4zugp4q9qyyssqw4nzlr72w28k4waycf27qvgzc9sp79sqlw83j56txltz4va44j7jda23ydcujj9y5k6k0rn5ms84w8wmcmcyk5g3mhpqepf7envhdccp72nz6e"
]
}
}
Taking a buy order
To take an order the seller will send to Mostro a message with the following content:
{
"version": "0",
"pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"action": "TakeBuy",
"content": {
"Peer": {
"pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2"
}
}
}
Mostro response
Mostro respond to the seller with a message with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "PayInvoice",
"content": {
"PaymentRequest": [
{
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"kind": "Buy",
"status": "WaitingPayment",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"created_at": 1698957793
},
"lnbcrt32680n1pj59wmepp50677g8tffdqa2p8882y0x6newny5vtz0hjuyngdwv226nanv4uzsdqqcqzzsxqyz5vqsp5skn973360gp4yhlpmefwvul5hs58lkkl3u3ujvt57elmp4zugp4q9qyyssqw4nzlr72w28k4waycf27qvgzc9sp79sqlw83j56txltz4va44j7jda23ydcujj9y5k6k0rn5ms84w8wmcmcyk5g3mhpqepf7envhdccp72nz6e"
]
}
}
And send a message to the buyer with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "WaitingSellerToPay",
"content": null
}
Seller pays LN invoice
After seller pays the hold invoice Mostro send a message to the seller with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "WaitingBuyerInvoice",
"content": null
}
And sends a message to the buyer with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "AddInvoice",
"content": {
"SmallOrder": {
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"buyer_pubkey": null,
"seller_pubkey": null
}
}
}
Buyer sends LN invoice
Buyer sends the LN invoice to Mostro.
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "AddInvoice",
"content": {
"PaymentRequest": [
null,
"lnbcrt32680n1pj59wmepp50677g8tffdqa2p8882y0x6newny5vtz0hjuyngdwv226nanv4uzsdqqcqzzsxqyz5vqsp5skn973360gp4yhlpmefwvul5hs58lkkl3u3ujvt57elmp4zugp4q9qyyssqw4nzlr72w28k4waycf27qvgzc9sp79sqlw83j56txltz4va44j7jda23ydcujj9y5k6k0rn5ms84w8wmcmcyk5g3mhpqepf7envhdccp72nz6e"
]
}
}
Taking a buy order
To take an order the seller will send to Mostro a message with the following content:
{
"version": "0",
"pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"action": "TakeBuy",
"content": {
"Peer": {
"pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2"
}
}
}
Mostro response
Mostro respond to the seller with a message with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "PayInvoice",
"content": {
"PaymentRequest": [
{
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"kind": "Buy",
"status": "WaitingPayment",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"created_at": 1698957793
},
"lnbcrt32680n1pj59wmepp50677g8tffdqa2p8882y0x6newny5vtz0hjuyngdwv226nanv4uzsdqqcqzzsxqyz5vqsp5skn973360gp4yhlpmefwvul5hs58lkkl3u3ujvt57elmp4zugp4q9qyyssqw4nzlr72w28k4waycf27qvgzc9sp79sqlw83j56txltz4va44j7jda23ydcujj9y5k6k0rn5ms84w8wmcmcyk5g3mhpqepf7envhdccp72nz6e"
]
}
}
And send a message to the buyer with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "WaitingSellerToPay",
"content": null
}
Seller pays LN invoice
After seller pays the hold invoice Mostro send a message to the seller with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "WaitingBuyerInvoice",
"content": null
}
And sends a message to the buyer with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "AddInvoice",
"content": {
"SmallOrder": {
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"buyer_pubkey": null,
"seller_pubkey": null
}
}
}
Buyer sends LN invoice
Buyer sends the LN invoice to Mostro.
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "AddInvoice",
"content": {
"PaymentRequest": [
null,
"lnbcrt32680n1pj59wmepp50677g8tffdqa2p8882y0x6newny5vtz0hjuyngdwv226nanv4uzsdqqcqzzsxqyz5vqsp5skn973360gp4yhlpmefwvul5hs58lkkl3u3ujvt57elmp4zugp4q9qyyssqw4nzlr72w28k4waycf27qvgzc9sp79sqlw83j56txltz4va44j7jda23ydcujj9y5k6k0rn5ms84w8wmcmcyk5g3mhpqepf7envhdccp72nz6e"
]
}
}
Seller pays hold invoice
When the seller is the maker and the order was taken by a buyer, Mostro will send to the seller a message asking to pay the hold invoice, the message will look like this:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "PayInvoice",
"content": {
"PaymentRequest": [
{
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"kind": "Sell",
"status": "WaitingBuyerInvoice",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"created_at": 1698937797
},
"lnbcrt78510n1pj59wmepp50677g8tffdqa2p8882y0x6newny5vtz0hjuyngdwv226nanv4uzsdqqcqzzsxqyz5vqsp5skn973360gp4yhlpmefwvul5hs58lkkl3u3ujvt57elmp4zugp4q9qyyssqw4nzlr72w28k4waycf27qvgzc9sp79sqlw83j56txltz4va44j7jda23ydcujj9y5k6k0rn5ms84w8wmcmcyk5g3mhpqepf7envhdccp72nz6e"
]
}
}
After the hold invoice is paid Mostro will send a new message to seller with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "BuyerTookOrder",
"content": {
"SmallOrder": {
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"buyer_pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"seller_pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2"
}
}
}
Mostro also send a message to the buyer, this way they can both to to each other in private, this message would look like this:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "HoldInvoicePaymentAccepted",
"content": {
"SmallOrder": {
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"buyer_pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"seller_pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2"
}
}
}
Ephemeral keys
Mostro clients should use ephemeral keys to communicate with Mostro, indicating the pubkey where they want to be contacted in the pubkey
field of the message, this way orders and users can't be easily linked, buyer_pubkey
and seller_pubkey
fields are the real pubkeys of the users.
Seller pays hold invoice
When the seller is the maker and the order was taken by a buyer, Mostro will send to the seller a message asking to pay the hold invoice, the message will look like this:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "PayInvoice",
"content": {
"PaymentRequest": [
{
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"kind": "Sell",
"status": "WaitingBuyerInvoice",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"created_at": 1698937797
},
"lnbcrt78510n1pj59wmepp50677g8tffdqa2p8882y0x6newny5vtz0hjuyngdwv226nanv4uzsdqqcqzzsxqyz5vqsp5skn973360gp4yhlpmefwvul5hs58lkkl3u3ujvt57elmp4zugp4q9qyyssqw4nzlr72w28k4waycf27qvgzc9sp79sqlw83j56txltz4va44j7jda23ydcujj9y5k6k0rn5ms84w8wmcmcyk5g3mhpqepf7envhdccp72nz6e"
]
}
}
After the hold invoice is paid Mostro will send a new message to seller with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "BuyerTookOrder",
"content": {
"SmallOrder": {
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"buyer_pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"seller_pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2"
}
}
}
Mostro also send a message to the buyer, this way they can both to to each other in private, this message would look like this:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "HoldInvoicePaymentAccepted",
"content": {
"SmallOrder": {
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"buyer_pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"seller_pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2"
}
}
}
Ephemeral keys
Mostro clients should use ephemeral keys to communicate with Mostro, indicating the pubkey where they want to be contacted in the pubkey
field of the message, this way orders and users can't be easily linked, buyer_pubkey
and seller_pubkey
fields are the real pubkeys of the users.
Seller pays hold invoice
When the seller is the maker and the order was taken by a buyer, Mostro will send to the seller a message asking to pay the hold invoice, the message will look like this:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "PayInvoice",
"content": {
"PaymentRequest": [
{
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"kind": "Sell",
"status": "WaitingBuyerInvoice",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"created_at": 1698937797
},
"lnbcrt78510n1pj59wmepp50677g8tffdqa2p8882y0x6newny5vtz0hjuyngdwv226nanv4uzsdqqcqzzsxqyz5vqsp5skn973360gp4yhlpmefwvul5hs58lkkl3u3ujvt57elmp4zugp4q9qyyssqw4nzlr72w28k4waycf27qvgzc9sp79sqlw83j56txltz4va44j7jda23ydcujj9y5k6k0rn5ms84w8wmcmcyk5g3mhpqepf7envhdccp72nz6e"
]
}
}
After the hold invoice is paid Mostro will send a new message to seller with the following content:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "BuyerTookOrder",
"content": {
"SmallOrder": {
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"buyer_pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"seller_pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2"
}
}
}
Mostro also send a message to the buyer, this way they can both to to each other in private, this message would look like this:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "HoldInvoicePaymentAccepted",
"content": {
"SmallOrder": {
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
"premium": 1,
"buyer_pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"seller_pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2"
}
}
}
Ephemeral keys
Mostro clients should use ephemeral keys to communicate with Mostro, indicating the pubkey where they want to be contacted in the pubkey
field of the message, this way orders and users can't be easily linked, buyer_pubkey
and seller_pubkey
fields are the real pubkeys of the users.
FiatSent
Release
After confirming the buyer sent the fiat money, the seller should send a message to Mostro indicating that sats should be delivered to the buyer, the message will look like this:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2",
"action": "Release",
"content": null
}
Mostro response
Here an example of the Mostro response to the seller:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "HoldInvoicePaymentSettled",
"content": null
}
And a message to the buyer to let him know that the sats were released:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "Release",
"content": null
}
Buyer receives sats
Right after seller release sats Mostro will try to pay the buyer's lightning invoice, if the payment is successful Mostro will send a message to the buyer indicating that the purchase was completed:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "PurchaseCompleted",
"content": null
}
Release
After confirming the buyer sent the fiat money, the seller should send a message to Mostro indicating that sats should be delivered to the buyer, the message will look like this:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2",
"action": "Release",
"content": null
}
Mostro response
Here an example of the Mostro response to the seller:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "HoldInvoicePaymentSettled",
"content": null
}
And a message to the buyer to let him know that the sats were released:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "Release",
"content": null
}
Buyer receives sats
Right after seller release sats Mostro will try to pay the buyer's lightning invoice, if the payment is successful Mostro will send a message to the buyer indicating that the purchase was completed:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "PurchaseCompleted",
"content": null
}
Release
After confirming the buyer sent the fiat money, the seller should send a message to Mostro indicating that sats should be delivered to the buyer, the message will look like this:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2",
"action": "Release",
"content": null
}
Mostro response
Here an example of the Mostro response to the seller:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "HoldInvoicePaymentSettled",
"content": null
}
And a message to the buyer to let him know that the sats were released:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "Release",
"content": null
}
Buyer receives sats
Right after seller release sats Mostro will try to pay the buyer's lightning invoice, if the payment is successful Mostro will send a message to the buyer indicating that the purchase was completed:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "PurchaseCompleted",
"content": null
}
User rating
After a successful trade Mostro send a nip04 event to both parties to let them know they can rate each other, here an example how the message look like:
{
"version": "0",
"order_id": "7e44aa5d-855a-4b17-865e-8ca3834a91a3",
"pubkey": null,
"action": "RateUser",
"content": null
}
After a Mostro client receive this message, the user can rate the other party, the rating is a number between 1 and 5, to rate the client must receive user's input and create a new nip04 event to send to Mostro with this content:
{
"version": "0",
"order_id": "7e44aa5d-855a-4b17-865e-8ca3834a91a3",
"pubkey": null,
"action": "RateUser",
"content": {
"RatingUser": 5 // User input
}
}
Confirmation message
If Mostro received the message correct it will send back a last confirmation message to the user with Action: Received
:
{
"version": "0",
"order_id": "7e44aa5d-855a-4b17-865e-8ca3834a91a3",
"pubkey": null,
"action": "Received",
"content": null
}
User rating
After a successful trade Mostro send a nip04 event to both parties to let them know they can rate each other, here an example how the message look like:
{
"version": "0",
"order_id": "7e44aa5d-855a-4b17-865e-8ca3834a91a3",
"pubkey": null,
"action": "RateUser",
"content": null
}
After a Mostro client receive this message, the user can rate the other party, the rating is a number between 1 and 5, to rate the client must receive user's input and create a new nip04 event to send to Mostro with this content:
{
"version": "0",
"order_id": "7e44aa5d-855a-4b17-865e-8ca3834a91a3",
"pubkey": null,
"action": "RateUser",
"content": {
"RatingUser": 5 // User input
}
}
Confirmation message
If Mostro received the message correct it will send back a last confirmation message to the user with Action: Received
:
{
"version": "0",
"order_id": "7e44aa5d-855a-4b17-865e-8ca3834a91a3",
"pubkey": null,
"action": "Received",
"content": null
}
Cancel Order
A use can cancel an Order created by himself and with status Pending
sending action Cancel
, the message will look like this:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"action": "Cancel",
"content": null
}
Mostro response
Mostro will send a message with action Cancel
confirming the order was canceled, here an example of the message:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "Cancel",
"content": null
}
Cancel cooperatively
A user can cancel an Active
order, but will need the counterparty to agree, let's look at an example where the seller initiates a cooperative cancellation:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "Cancel",
"content": null
}
Mostro will send this message to the seller:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "CooperativeCancelInitiatedByYou",
"content": null
}
And this message to the buyer:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "CooperativeCancelInitiatedByPeer",
"content": null
}
The buyer can accept the cooperative cancellation sending this message:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "Cancel",
"content": null
}
Cancel Order
A use can cancel an Order created by himself and with status Pending
sending action Cancel
, the message will look like this:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"action": "Cancel",
"content": null
}
Mostro response
Mostro will send a message with action Cancel
confirming the order was canceled, here an example of the message:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "Cancel",
"content": null
}
Cancel cooperatively
A user can cancel an Active
order, but will need the counterparty to agree, let's look at an example where the seller initiates a cooperative cancellation:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "Cancel",
"content": null
}
Mostro will send this message to the seller:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "CooperativeCancelInitiatedByYou",
"content": null
}
And this message to the buyer:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "CooperativeCancelInitiatedByPeer",
"content": null
}
The buyer can accept the cooperative cancellation sending this message:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "Cancel",
"content": null
}
Cancel Order
A use can cancel an Order created by himself and with status Pending
sending action Cancel
, the message will look like this:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"action": "Cancel",
"content": null
}
Mostro response
Mostro will send a message with action Cancel
confirming the order was canceled, here an example of the message:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "Cancel",
"content": null
}
Cancel cooperatively
A user can cancel an Active
order, but will need the counterparty to agree, let's look at an example where the seller initiates a cooperative cancellation:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "Cancel",
"content": null
}
Mostro will send this message to the seller:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "CooperativeCancelInitiatedByYou",
"content": null
}
And this message to the buyer:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "CooperativeCancelInitiatedByPeer",
"content": null
}
The buyer can accept the cooperative cancellation sending this message:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "Cancel",
"content": null
}
Dispute
A use can start a dispute in an order with status Pending
or FiatSent
sending action Dispute
, here is an example where the seller initiates a dispute:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"action": "Dispute",
"content": null
}
Mostro response
Mostro will send this message to the seller:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "DisputeInitiatedByYou,",
"content": null
}
And here is the message to the buyer:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "DisputeInitiatedByPeer",
"content": null
}
Dispute
A use can start a dispute in an order with status Pending
or FiatSent
sending action Dispute
, here is an example where the seller initiates a dispute:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"action": "Dispute",
"content": null
}
Mostro response
Mostro will send this message to the seller:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "DisputeInitiatedByYou,",
"content": null
}
And here is the message to the buyer:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "DisputeInitiatedByPeer",
"content": null
}
Dispute
A use can start a dispute in an order with status Pending
or FiatSent
sending action Dispute
, here is an example where the seller initiates a dispute:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"action": "Dispute",
"content": null
}
Mostro response
Mostro will send this message to the seller:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "DisputeInitiatedByYou,",
"content": null
}
And here is the message to the buyer:
{
"version": "0",
"order_id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"action": "DisputeInitiatedByPeer",
"content": null
}