You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To publish an order a user needs to send an encrypted message to Mostro with the order details, then Mostro will create a new replaceable event that could be taken by another user that wants to trade.
The seller wants to exchange 100 sats and get 1000 of XXX currency, to publish an offer the seller send an encrypted event to Mostro's pubkey, the content of this event should be a JSON-serialized string (with no white space or line breaks) of the following structure:
The buyer wants to buy sats and take the order, for this the buyer have two options:
1. Buyer own hold invoice
This is theoretical and probably not feasible, for this option to work, the buyer needs to have a wallet or node that allows to create hold invoices making the process slow and probably and difficult for newbies.
Send an encrypted event to Mostro requesting a payment hash to create a hold invoice
Now the buyer can create a hold invoice without knowing the secret, just with the hash, the new invoice can be created without amount or with the exact amount of 100 sats, then the buyer encrypt, encode the invoice and then send it to Mostro in a new event:
Mostro sends an encrypted event to seller with a hold invoice, after the seller pays the invoice mostro put the parties in contact and update the order sending a replaceable event kind 11000 with the same id, a newer timestamp and status ACTIVE:
Mostro send an encrypted message to seller indicating that buyer says that fiat was sent and request to check if fiat was received please release funds, if everything went well, seller respond with a new encrypted message to Mostro with this content to release funds:
{
"release": true
}
Settle seller's invoice
Mostro settle the invoice and send a replaceable event kind 11000 with the same id, a newer timestamp and status PAID_HOLD_INVOICE, right after tries to pay the buyer's invoice, after the invoice is paid Mostro send a replaceable event kind 11000 with the same id, a newer timestamp and status SUCCESS
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Mostro
This document explains how works the
order flow
on Mostro, this is work in progress.Overview
All mostro messages are replaceable events and use
11000
as eventkind
, a list of standard event kinds can be found hereKeys
For this example the participants will use this keys:
7590450f6b4d2c6793cacc8c0894e2c6bd2e8a83894912e79335f8f98436d2d8
1f5bb148a25bca31506594722e746b10acf2641a12725b12072dcbc46ade544d
f6c63403def1642b0980c42221f1649cdc33d01ce4156c93f6e1607f3e854c92
Order event
To publish an order a user needs to send an encrypted message to Mostro with the order details, then Mostro will create a new
replaceable event
that could be taken by another user that wants to trade.Contents of an order event have this properties:
version
kind
(buy/sell)status
(this will be handle by Mostro)amount
fiat_code
fiat_amount
payment_method
prime
invoice
(optional)This format is subject to change!
Example:
Seller creates an order
The seller wants to exchange
100
sats and get1000
ofXXX
currency, to publish an offer the seller send an encrypted event to Mostro's pubkey, the content of this event should be a JSON-serialized string (with no white space or line breaks) of the following structure:Event example:
Mostro publishes this order as an event kind
11000
with statusPENDING
:Buyer takes an order
The buyer wants to buy sats and take the order, for this the buyer have two options:
1. Buyer own hold invoice
This is theoretical and probably not feasible, for this option to work, the buyer needs to have a wallet or node that allows to create hold invoices making the process slow and probably and difficult for newbies.
Send an encrypted event to Mostro requesting a payment hash to create a hold invoice
content:
Mostro creates a secret, hash it and send it to the buyer in an encrypted event.
Now the buyer can create a hold invoice without knowing the secret, just with the hash, the new invoice can be created without amount or with the exact amount of 100 sats, then the buyer encrypt, encode the invoice and then send it to Mostro in a new event:
2. Buyer send a regular invoice
Buyer sends an encrypted message to mostro's pubkey with a lightning invoice, this invoice can have an amount of 100 sats or be amountless:
Mostro put them in contact
Mostro sends an encrypted event to seller with a hold invoice, after the seller pays the invoice mostro put the parties in contact and update the order sending a replaceable event kind
11000
with the same id, a newer timestamp and statusACTIVE
:Mostro talks to seller
The buyer sends the seller fiat money, after that, the buyer sends an encrypted message to Mostro indicating that the fiat was sent, example:
Event example:
Now Mostro send a replaceable event kind
11000
with the same id, a newer timestamp and statusFIAT_SENT
:Mostro request release of funds
Mostro send an encrypted message to seller indicating that buyer says that fiat was sent and request to check if fiat was received please release funds, if everything went well, seller respond with a new encrypted message to Mostro with this content to release funds:
Settle seller's invoice
Mostro settle the invoice and send a replaceable event kind
11000
with the same id, a newer timestamp and statusPAID_HOLD_INVOICE
, right after tries to pay the buyer's invoice, after the invoice is paid Mostro send a replaceable event kind11000
with the same id, a newer timestamp and statusSUCCESS
Beta Was this translation helpful? Give feedback.
All reactions