diff --git a/book/src/admin_add_solver.md b/book/src/admin_add_solver.md index 75e552b..00d95ca 100644 --- a/book/src/admin_add_solver.md +++ b/book/src/admin_add_solver.md @@ -12,7 +12,6 @@ To add a solver the admin will need to send an `order` message to Mostro with ac { "order": { "version": 1, - "pubkey": null, "action": "admin-add-solver", "content": { "text_message": "npub1qqq884wtp2jn96lqhqlnarl4kk3rmvrc9z2nmrvqujx3m4l2ea5qd5d0fq" @@ -29,7 +28,6 @@ Mostro will send this message to the admin: { "order": { "version": 1, - "pubkey": null, "action": "admin-add-solver", "content": null } diff --git a/book/src/admin_cancel_order.md b/book/src/admin_cancel_order.md index 08d672c..3d08de4 100644 --- a/book/src/admin_cancel_order.md +++ b/book/src/admin_cancel_order.md @@ -1,13 +1,12 @@ # Cancel order -An admin can cancel an order, most of the time this is done when admin is solving a dispute, for this the admin will need to send an `order` message to Mostro with action `admin-cancel` with the `Id` of the order like this: +An admin can cancel an order, most of the time this is done when admin is solving a dispute, for this the admin will need to send an `order` message to Mostro with action `admin-cancel` with the `id` of the order like this: ```json { "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": null, "action": "admin-cancel", "content": null } @@ -23,7 +22,6 @@ Mostro will send this message to the both parties buyer/seller and to the admin: "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": null, "action": "admin-canceled", "content": null } diff --git a/book/src/admin_settle_order.md b/book/src/admin_settle_order.md index 467cef2..93e2e24 100644 --- a/book/src/admin_settle_order.md +++ b/book/src/admin_settle_order.md @@ -1,13 +1,12 @@ # Settle order -An admin can settle an order, most of the time this is done when admin is solving a dispute, for this the admin will need to send an `order` message to Mostro with action `admin-settle` with the `Id` of the order like this: +An admin can settle an order, most of the time this is done when admin is solving a dispute, for this the admin will need to send an `order` message to Mostro with action `admin-settle` with the `id` of the order like this: ```json { "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": null, "action": "admin-settle", "content": null } @@ -23,7 +22,6 @@ Mostro will send this message to the both parties buyer/seller and to the admin: "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": null, "action": "admin-settled", "content": null } diff --git a/book/src/cancel.md b/book/src/cancel.md index 572523b..f88622f 100644 --- a/book/src/cancel.md +++ b/book/src/cancel.md @@ -1,13 +1,12 @@ # Cancel Order -A user can cancel an Order created by himself and with status `pending` sending action `cancel`, the message content will look like this: +A user can cancel an order created by himself and with status `pending` sending action `cancel`, the rumor's content of the message will look like this: ```json { "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": "00000ba40c5795451705bb9c165b3af93c846894d3062a9cd7fcba090eb3bf78", "action": "cancel", "content": null } @@ -16,14 +15,13 @@ A user can cancel an Order created by himself and with status `pending` sending ## Mostro response -Mostro will send a message with action `cancel` confirming the order was canceled, here an example of the message: +Mostro will send a message with action `cancel` confirming the order was canceled, here an example of rumor's content of the message: ```json { "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": null, "action": "canceled", "content": null } @@ -71,7 +69,6 @@ A user can cancel an `active` order, but will need the counterparty to agree, le "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": null, "action": "cancel", "content": null } @@ -85,7 +82,6 @@ Mostro will send this message to the seller: "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": null, "action": "cooperative-cancel-initiated-by-you", "content": null } @@ -99,7 +95,6 @@ And this message to the buyer: "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": null, "action": "cooperative-cancel-initiated-by-peer", "content": null } @@ -142,7 +137,6 @@ The buyer can accept the cooperative cancellation sending this message: "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": null, "action": "cancel", "content": null } @@ -156,7 +150,6 @@ And Mostro will send this message to both parties: "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": null, "action": "cooperative-cancel-accepted", "content": null } diff --git a/book/src/dispute.md b/book/src/dispute.md index 687ad5b..8312a41 100644 --- a/book/src/dispute.md +++ b/book/src/dispute.md @@ -7,7 +7,6 @@ A use can start a dispute in an order with status `active` or `fiat-sent` sendin "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": "00000ba40c5795451705bb9c165b3af93c846894d3062a9cd7fcba090eb3bf78", "action": "dispute", "content": null } @@ -23,7 +22,6 @@ Mostro will send this message to the seller: "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": null, "action": "dispute-initiated-by-you", "content": { "dispute": "efc75871-2568-40b9-a6ee-c382d4d6de01" @@ -39,7 +37,6 @@ And here is the message to the buyer: "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": null, "action": "dispute-initiated-by-peer", "content": { "dispute": "efc75871-2568-40b9-a6ee-c382d4d6de01" @@ -82,21 +79,19 @@ Mostro admin will see the dispute and can take it using the dispute `Id` from `d "dispute": { "version": 1, "id": "efc75871-2568-40b9-a6ee-c382d4d6de01", - "pubkey": null, "action": "admin-take-dispute", "content": null } } ``` -Mostro will send a confirmation message to the admin with the Order details: +Mostro will send a confirmation message to the admin with the order details: ```json { "dispute": { "version": 1, "id": "efc75871-2568-40b9-a6ee-c382d4d6de01", - "pubkey": null, "action": "admin-took-dispute", "content": { "order": { @@ -118,7 +113,7 @@ Mostro will send a confirmation message to the admin with the Order details: } ``` -Also Mostro will broadcast a new parameterized replaceable dispute event to update the Dispute `status` to `in-progress`: +Also Mostro will broadcast a new parameterized replaceable dispute event to update the dispute `status` to `in-progress`: ```json [ diff --git a/book/src/fiatsent.md b/book/src/fiatsent.md index ddf50d0..26b4d1e 100644 --- a/book/src/fiatsent.md +++ b/book/src/fiatsent.md @@ -1,13 +1,12 @@ # 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: +After the buyer sends the fiat money to the seller, the buyer should send a message in a Gift wrap Nostr event to Mostro indicating that the fiat money was sent, the rumor's content would look like this: ```json { "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": "0000147e939bef2b81c27af4c1b702c90c3843f7212a34934bff1e049b7f1427", "action": "fiat-sent", "content": null } @@ -19,9 +18,9 @@ The event to send to Mostro would look like this: ```json { "id": "cade205b849a872d74ba4d2a978135dbc05b4e5f483bb4403c42627dfd24f67d", - "kind": 4, + "kind": 1059, "pubkey": "9a42ac72d6466a6dbe5b4b07a8717ee13e55abb6bdd810ea9c321c9a32ee837b", - "content": "base64-encoded-aes-256-cbc-encrypted-JSON-serialized-string", + "content": "sealed-rumor-content", "tags": [ ["p", "dbe0b1be7aafd3cfba92d7463edbd4e33b2969f61bd554d37ac56f032e13355a"] ], @@ -32,14 +31,13 @@ The event to send to Mostro would look like this: ## Mostro response -Mostro send a messages to both parties confirming `fiat-sent` action and sending again the counterpart pubkey, here an example of the message to the buyer: +Mostro send messages to both parties confirming `fiat-sent` action and sending again the counterpart pubkey, here an example of the message to the buyer: ```json { "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": "0000147e939bef2b81c27af4c1b702c90c3843f7212a34934bff1e049b7f1427", "action": "fiat-sent-ok", "content": { "Peer": { diff --git a/book/src/new_buy_order.md b/book/src/new_buy_order.md index eb33df0..1696e77 100644 --- a/book/src/new_buy_order.md +++ b/book/src/new_buy_order.md @@ -1,12 +1,11 @@ # Creating a new buy order -To create a new buy order the user should send a Nostr event kind 4 (an encrypted message) to Mostro with the following content: +To create a new buy order the user should send a Gift wrap Nostr event to Mostro with the following rumor's content: ```json { "order": { "version": 1, - "pubkey": "0000147e939bef2b81c27af4c1b702c90c3843f7212a34934bff1e049b7f1427", // Buyer's real pubkey "action": "new-order", "content": { "order": { @@ -29,9 +28,9 @@ The nostr event will look like this: ```json { "id": "cade205b849a872d74ba4d2a978135dbc05b4e5f483bb4403c42627dfd24f67d", - "kind": 4, + "kind": 1059, "pubkey": "9a42ac72d6466a6dbe5b4b07a8717ee13e55abb6bdd810ea9c321c9a32ee837b", // Buyer's ephemeral pubkey - "content": "base64-encoded-aes-256-cbc-encrypted-JSON-serialized-string", + "content": "sealed-rumor-content", "tags": [ ["p", "dbe0b1be7aafd3cfba92d7463edbd4e33b2969f61bd554d37ac56f032e13355a"] // Mostro's pubkey ], @@ -42,18 +41,17 @@ The nostr event will look like this: ## Confirmation message -Mostro will send back a nip04 event as a confirmation message to the user like the following: +Mostro will send back a nip59 event as a confirmation message to the user like the following: ```json { "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": "0000147e939bef2b81c27af4c1b702c90c3843f7212a34934bff1e049b7f1427", "content": { "order": { "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "kind": "sell", + "kind": "buy", "status": "pending", "amount": 0, "fiat_code": "VES", @@ -83,7 +81,7 @@ Mostro publishes this order as an event kind `38383` with status `pending`: "kind": 38383, "tags": [ ["d", "ede61c96-4c13-4519-bf3a-dcf7f1e9d842"], - ["k", "sell"], + ["k", "buy"], ["f", "VES"], ["s", "pending"], ["amt", "0"], diff --git a/book/src/new_buy_order_ln_address.md b/book/src/new_buy_order_ln_address.md index 09155cd..aa4936c 100644 --- a/book/src/new_buy_order_ln_address.md +++ b/book/src/new_buy_order_ln_address.md @@ -1,12 +1,11 @@ # Creating a new order -Creating buy order with a [lightning address](https://github.com/andrerfneves/lightning-address) would make the process way faster and easy going, to acomplish the buyer should send a Nostr event kind 4 (an encrypted message) to Mostro with the following content: +Creating buy order with a [lightning address](https://github.com/andrerfneves/lightning-address) would make the process way faster and easy going, to acomplish the buyer should send a Gift wrap Nostr event to Mostro with the following rumor's content: ```json { "order": { "version": 1, - "pubkey": "0000147e939bef2b81c27af4c1b702c90c3843f7212a34934bff1e049b7f1427", // Buyer's real pubkey "action": "new-order", "content": { "order": { @@ -30,9 +29,9 @@ The nostr event will look like this: ```json { "id": "cade205b849a872d74ba4d2a978135dbc05b4e5f483bb4403c42627dfd24f67d", - "kind": 4, + "kind": 1059, "pubkey": "9a42ac72d6466a6dbe5b4b07a8717ee13e55abb6bdd810ea9c321c9a32ee837b", // Buyer's ephemeral pubkey - "content": "base64-encoded-aes-256-cbc-encrypted-JSON-serialized-string", + "content": "sealed-rumor-content", "tags": [ ["p", "dbe0b1be7aafd3cfba92d7463edbd4e33b2969f61bd554d37ac56f032e13355a"] // Mostro's pubkey ], @@ -43,18 +42,17 @@ The nostr event will look like this: ## Confirmation message -Mostro will send back a nip04 event as a confirmation message to the user like the following: +Mostro will send back a nip59 event as a confirmation message to the user like the following: ```json { "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": "0000147e939bef2b81c27af4c1b702c90c3843f7212a34934bff1e049b7f1427", "content": { "order": { "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "kind": "sell", + "kind": "buy", "status": "pending", "amount": 0, "fiat_code": "VES", @@ -84,7 +82,7 @@ Mostro publishes this order as an event kind `38383` with status `pending`: "kind": 38383, "tags": [ ["d", "ede61c96-4c13-4519-bf3a-dcf7f1e9d842"], - ["k", "sell"], + ["k", "buy"], ["f", "VES"], ["s", "pending"], ["amt", "0"], diff --git a/book/src/new_sell_order.md b/book/src/new_sell_order.md index ad497c1..17968a2 100644 --- a/book/src/new_sell_order.md +++ b/book/src/new_sell_order.md @@ -1,12 +1,11 @@ # Creating a new sell order -To create a new sell order the user should send a Nostr event kind 4 (an encrypted message) to Mostro with the following content: +To create a new sell order the user should send a Gift wrap Nostr event to Mostro, the rumor event should have the following rumor's content: ```json { "order": { "version": 1, - "pubkey": "00000ba40c5795451705bb9c165b3af93c846894d3062a9cd7fcba090eb3bf78", // Seller's real pubkey "action": "new-order", "content": { "order": { @@ -31,7 +30,6 @@ 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 -- pubkey: Real user's npub, 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 The event to send to Mostro would look like this: @@ -39,9 +37,9 @@ The event to send to Mostro would look like this: ```json { "id": "cade205b849a872d74ba4d2a978135dbc05b4e5f483bb4403c42627dfd24f67d", - "kind": 4, + "kind": 1059, "pubkey": "1f5bb148a25bca31506594722e746b10acf2641a12725b12072dcbc46ade544d", // Seller's ephemeral pubkey - "content": "base64-encoded-aes-256-cbc-encrypted-JSON-serialized-string", + "content": "sealed-rumor-content", "tags": [ ["p", "dbe0b1be7aafd3cfba92d7463edbd4e33b2969f61bd554d37ac56f032e13355a"] // Mostro's pubkey ], @@ -52,7 +50,7 @@ The event to send to Mostro would look like this: ## Confirmation message -Mostro will send back a nip04 event as a confirmation message to the user like the following: +Mostro will send back a nip59 event as a confirmation message to the user like the following (unencrypted rumor's content example): ```json { diff --git a/book/src/new_sell_range_order.md b/book/src/new_sell_range_order.md index efdc011..d645ef0 100644 --- a/book/src/new_sell_range_order.md +++ b/book/src/new_sell_range_order.md @@ -1,12 +1,11 @@ # Creating a new sell range order -To create a new range order the user should send a Nostr event kind 4 (an encrypted message) to Mostro with the following content: +To create a new range order the user should send a Gift wrap Nostr event to Mostro with the following rumor's content: ```json { "order": { "version": 1, - "pubkey": "00000ba40c5795451705bb9c165b3af93c846894d3062a9cd7fcba090eb3bf78", // Seller's real pubkey "action": "new-order", "content": { "order": { @@ -26,20 +25,19 @@ To create a new range order the user should send a Nostr event kind 4 (an encryp } ``` -We two new fields, `min_amount` and `max_amount`, to define the range of the order. The `fiat_amount` field is set to 0 to indicate that the order is for a range of amounts. +Here we have two new fields, `min_amount` and `max_amount`, to define the range of the order. The `fiat_amount` field is set to 0 to indicate that the order is for a range of amounts. When a taker takes the order, the amount will be set on the message. ## Confirmation message -Mostro will send back a nip04 event as a confirmation message to the user like the following: +Mostro will send back a nip59 event as a confirmation message to the user like the following: ```json { "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": "00000ba40c5795451705bb9c165b3af93c846894d3062a9cd7fcba090eb3bf78", "content": { "order": { "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", diff --git a/book/src/overview.md b/book/src/overview.md index ab1619c..91d4353 100644 --- a/book/src/overview.md +++ b/book/src/overview.md @@ -6,10 +6,9 @@ In order to have a shared order's book, Mostro daemon send [Parameterized Replac ## Communication between users and Mostro -All messages from/to Mostro should be a Nostr event [kind 4](https://github.com/nostr-protocol/nips/blob/master/04.md), 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: +All messages from/to Mostro should be [Gift wrap Nostr events](https://github.com/nostr-protocol/nips/blob/master/59.md), the `content` of the `rumor` event should be a nip44 encrypted JSON-serialized string (with no white space or line breaks) of the following structure: - `version`: Version of the protocol, currently `1` -- `pubkey` (optional): Real pubkey of the user, if present the message is signed with the real pubkey, this is used when users are sending messages from ephemeral keys - [action](https://docs.rs/mostro-core/latest/mostro_core/message/enum.Action.html): Action to be performed by Mostro daemon - [content](https://docs.rs/mostro-core/latest/mostro_core/message/enum.Content.html) (optional): Content of the message, this field is optional and depends on the action @@ -20,7 +19,6 @@ These fields are relative to the wrapper, here an example of a `fiat-sent` Order "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": "0001be6bd50247846a28cce439a10470a39b1b6c81d5c3be2475156a413e1e3a", "action": "fiat-sent", "content": null } @@ -32,11 +30,9 @@ These fields are relative to the wrapper, here an example of a `fiat-sent` Order For all examples the participants will use this keys: - Mostro's pubkey `dbe0b1be7aafd3cfba92d7463edbd4e33b2969f61bd554d37ac56f032e13355a` -- Seller's real pubkey `00000ba40c5795451705bb9c165b3af93c846894d3062a9cd7fcba090eb3bf78` -- Seller's ephemeral pubkey `1f5bb148a25bca31506594722e746b10acf2641a12725b12072dcbc46ade544d` -- Buyer's real pubkey `0000147e939bef2b81c27af4c1b702c90c3843f7212a34934bff1e049b7f1427` -- Buyer's ephemeral pubkey `9a42ac72d6466a6dbe5b4b07a8717ee13e55abb6bdd810ea9c321c9a32ee837b` +- Seller's ephemeral pubkey `00000ba40c5795451705bb9c165b3af93c846894d3062a9cd7fcba090eb3bf78` +- Buyer's ephemeral pubkey `0000147e939bef2b81c27af4c1b702c90c3843f7212a34934bff1e049b7f1427` ## Ephemeral keys -Mostro clients should use newly fresh keys to communicate with Mostro, indicating the pubkey where they want to be contacted by the counterpart in the `pubkey` field of the message, this way orders and users can't be easily linked, `buyer_pubkey` and `seller_pubkey` fields are each party real pubkeys. +Mostro clients should implement nip59 which creates newly fresh keys on each message to Mostro, the client will also creates newly keys for each order and is used to sign the seal, this pubkey will be linked to the order and discarded after the trade is done, this pubkey also will be used in case of a dispute. diff --git a/book/src/release.md b/book/src/release.md index 724bd1d..9563937 100644 --- a/book/src/release.md +++ b/book/src/release.md @@ -1,13 +1,12 @@ # 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: +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 rumor's content of the message will look like this: ```json { "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": "00000ba40c5795451705bb9c165b3af93c846894d3062a9cd7fcba090eb3bf78", "action": "release", "content": null } @@ -23,7 +22,6 @@ Here an example of the Mostro response to the seller: "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": null, "action": "hold-invoice-payment-settled", "content": null } @@ -37,7 +35,6 @@ And a message to the buyer to let him know that the sats were released: "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": null, "action": "released", "content": null } @@ -53,7 +50,6 @@ Right after seller release sats Mostro will try to pay the buyer's lightning inv "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": null, "action": "purchase-completed", "content": null } @@ -89,7 +85,7 @@ Mostro updates the parameterized replaceable event with `d` tag `ede61c96-4c13-4 ] ``` -Seconds later Mostro will try to pay the buyer's invoice, if the payment is successful Mostro updates the parameterized replaceable event with `d` tag `ede61c96-4c13-4519-bf3a-dcf7f1e9d842` to change the status to `success`: +Mostro will then attempt to pay the buyer's invoice, if the payment successds Mostro updates the parameterized replaceable event with `d` tag `ede61c96-4c13-4519-bf3a-dcf7f1e9d842` to change the status to `success`: ```json [ diff --git a/book/src/seller_pay_hold_invoice.md b/book/src/seller_pay_hold_invoice.md index 8df7383..fe6b722 100644 --- a/book/src/seller_pay_hold_invoice.md +++ b/book/src/seller_pay_hold_invoice.md @@ -1,13 +1,12 @@ # 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 content of the message will look like this: +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 rumor's content of the message will look like this: ```json { "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": null, "action": "pay-invoice", "content": { "payment_request": [ @@ -29,14 +28,13 @@ When the seller is the maker and the order was taken by a buyer, Mostro will sen } ``` -After the hold invoice is paid and the buyer already sent the invoice to receive the sats, Mostro will send a new message to seller with the following content: +After the hold invoice is paid and the buyer already sent the invoice to receive the sats, Mostro will send a new message to seller with the following rumor's content: ```json { "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": null, "action": "buyer-took-order", "content": { "order": { @@ -125,7 +123,6 @@ Mostro send this message to the seller: "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": "0000147e939bef2b81c27af4c1b702c90c3843f7212a34934bff1e049b7f1427", "action": "waiting-buyer-invoice", "content": null } @@ -139,7 +136,6 @@ And this message to the buyer: "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": null, "action": "add-invoice", "content": { "order": { diff --git a/book/src/take_buy.md b/book/src/take_buy.md index 81e510e..198b17b 100644 --- a/book/src/take_buy.md +++ b/book/src/take_buy.md @@ -1,12 +1,11 @@ # Taking a buy order -To take an order the seller will send to Mostro a message with the following content: +To take an order the seller will send to Mostro a message with the following rumor's content: ```json { "order": { "version": 1, - "pubkey": "00000ba40c5795451705bb9c165b3af93c846894d3062a9cd7fcba090eb3bf78", "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", "action": "take-buy", "content": null @@ -21,7 +20,7 @@ The event to send to Mostro would look like this: "id": "cade205b849a872d74ba4d2a978135dbc05b4e5f483bb4403c42627dfd24f67d", "kind": 4, "pubkey": "1f5bb148a25bca31506594722e746b10acf2641a12725b12072dcbc46ade544d", // Seller's ephemeral pubkey - "content": "base64-encoded-aes-256-cbc-encrypted-JSON-serialized-string", + "content": "sealed-rumor-content", "tags": [ ["p", "dbe0b1be7aafd3cfba92d7463edbd4e33b2969f61bd554d37ac56f032e13355a"] // Mostro's pubkey ], diff --git a/book/src/take_buy_range_order.md b/book/src/take_buy_range_order.md index b0e4b4b..e9ad29b 100644 --- a/book/src/take_buy_range_order.md +++ b/book/src/take_buy_range_order.md @@ -1,13 +1,12 @@ # Taking a buy range order -If the order fiat amount is a range like `10-20` the seller must indicate a fiat amount to take the order, seller will send a message in a Nostr event kind 4 to Mostro with the following content: +If the order fiat amount is a range like `10-20` the seller must indicate a fiat amount to take the order, seller will send a message in a Gift wrap Nostr event to Mostro with the following rumor's content: ```json { "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": "0000147e939bef2b81c27af4c1b702c90c3843f7212a34934bff1e049b7f1427", "action": "take-buy", "content": { "amount": 15 diff --git a/book/src/take_sell.md b/book/src/take_sell.md index 33bfaed..bb9e719 100644 --- a/book/src/take_sell.md +++ b/book/src/take_sell.md @@ -1,13 +1,12 @@ # 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: +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 Gift wrap Nostr event to Mostro with the following rumor's content: ```json { "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": "0000147e939bef2b81c27af4c1b702c90c3843f7212a34934bff1e049b7f1427", "action": "take-sell", "content": null } @@ -19,9 +18,9 @@ The event to send to Mostro would look like this: ```json { "id": "cade205b849a872d74ba4d2a978135dbc05b4e5f483bb4403c42627dfd24f67d", - "kind": 4, + "kind": 1059, "pubkey": "9a42ac72d6466a6dbe5b4b07a8717ee13e55abb6bdd810ea9c321c9a32ee837b", - "content": "base64-encoded-aes-256-cbc-encrypted-JSON-serialized-string", + "content": "sealed-rumor-content", "tags": [ ["p", "dbe0b1be7aafd3cfba92d7463edbd4e33b2969f61bd554d37ac56f032e13355a"] ], @@ -32,14 +31,13 @@ The event to send to Mostro would look like this: ## 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, here the unencrypted content of the message: +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, here the rumor's content of the message: ```json { "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": null, "action": "add-invoice", "content": { "order": { @@ -91,14 +89,13 @@ Mostro updates the parameterized replaceable event with `d` tag `ede61c96-4c13-4 ## Buyer sends LN invoice -The buyer sends a nip 04 event to Mostro with the lightning invoice, the action should be the same the buyer just received in the last message from Mostro (`add-invoice`), here the unencrypted content of the event for an invoice with no amount: +The buyer sends a Gift wrap Nostr event to Mostro with the lightning invoice, the action should be the same the buyer just received in the last message from Mostro (`add-invoice`), here the rumor's content of the event for an invoice with no amount: ```json { "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": null, "action": "add-invoice", "content": { "payment_request": [ @@ -115,21 +112,20 @@ If the invoice includes an amount, the last element of the `payment_request` arr ## Mostro response -Mostro send a nip 04 event to the buyer with a wrapped `order` in the content, it would look like this: +Mostro send a Gift wrap Nostr event to the buyer with a wrapped `order` in the rumor's content, it would look like this: ```json { "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": null, "action": "waiting-seller-to-pay", "content": null } } ``` -Mostro updates the parameterized replaceable event with `d` tag `ede61c96-4c13-4519-bf3a-dcf7f1e9d842` to change the status to `WaitingPayment`: +Mostro updates the parameterized replaceable event with `d` tag `ede61c96-4c13-4519-bf3a-dcf7f1e9d842` to change the status to `waiting-payment`: ```json [ diff --git a/book/src/take_sell_ln_address.md b/book/src/take_sell_ln_address.md index 85ceb0c..337d9c5 100644 --- a/book/src/take_sell_ln_address.md +++ b/book/src/take_sell_ln_address.md @@ -1,13 +1,12 @@ # Taking a sell order with a lightning address -The buyer can use a [lightning address](https://github.com/andrerfneves/lightning-address) to receive funds and avoid to create and send lightning invoices on each trade, to acomplish this the buyer will send a message in a Nostr event kind 4 to Mostro with the following content: +The buyer can use a [lightning address](https://github.com/andrerfneves/lightning-address) to receive funds and avoid to manually create and send lightning invoices on each trade, to acomplish this the buyer will send a message in a Gift wrap Nostr event to Mostro with the following rumor's content: ```json { "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": "0000147e939bef2b81c27af4c1b702c90c3843f7212a34934bff1e049b7f1427", "action": "take-sell", "content": { "payment_request": [null, "mostro_p2p@ln.tips"] @@ -21,9 +20,9 @@ The event to send to Mostro would look like this: ```json { "id": "cade205b849a872d74ba4d2a978135dbc05b4e5f483bb4403c42627dfd24f67d", - "kind": 4, + "kind": 1059, "pubkey": "9a42ac72d6466a6dbe5b4b07a8717ee13e55abb6bdd810ea9c321c9a32ee837b", - "content": "base64-encoded-aes-256-cbc-encrypted-JSON-serialized-string", + "content": "sealed-rumor-content", "tags": [ ["p", "dbe0b1be7aafd3cfba92d7463edbd4e33b2969f61bd554d37ac56f032e13355a"] ], @@ -41,14 +40,13 @@ Mostro send a nip 04 event to the buyer with a wrapped `order` in the content, i "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": null, "action": "waiting-seller-to-pay", "content": null } } ``` -Mostro updates the parameterized replaceable event with `d` tag `ede61c96-4c13-4519-bf3a-dcf7f1e9d842` to change the status to `WaitingPayment`: +Mostro updates the parameterized replaceable event with `d` tag `ede61c96-4c13-4519-bf3a-dcf7f1e9d842` to change the status to `waiting-payment`: ```json [ diff --git a/book/src/take_sell_range_order.md b/book/src/take_sell_range_order.md index 94df251..a891f78 100644 --- a/book/src/take_sell_range_order.md +++ b/book/src/take_sell_range_order.md @@ -1,13 +1,12 @@ # Taking a sell range order -If the order fiat amount is a range like `10-20` the buyer must indicate a fiat amount to take the order, buyer will send a message in a Nostr event kind 4 to Mostro with the following content: +If the order fiat amount is a range like `10-20` the buyer must indicate a fiat amount to take the order, buyer will send a message in a Gift wrap Nostr event to Mostro with the following rumor's content: ```json { "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": "0000147e939bef2b81c27af4c1b702c90c3843f7212a34934bff1e049b7f1427", "action": "take-sell", "content": { "amount": 15 @@ -18,14 +17,13 @@ If the order fiat amount is a range like `10-20` the buyer must indicate a fiat ## 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, here the unencrypted content of the message: +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, here the rumor's content of the message: ```json { "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": null, "action": "add-invoice", "content": { "order": { @@ -82,14 +80,13 @@ Mostro updates the parameterized replaceable event with `d` tag `ede61c96-4c13-4 ## Using a lightning address -The buyer can use a [lightning address](https://github.com/andrerfneves/lightning-address) to receive funds and avoid to create and send lightning invoices on each trade, with a range order we set the fiat amount as the third element of the `payment_request` array, to acomplish this the buyer will send a message in a Nostr event kind 4 to Mostro with the following content: +The buyer can use a [lightning address](https://github.com/andrerfneves/lightning-address) to receive funds and avoid to create and send lightning invoices on each trade, with a range order we set the fiat amount as the third element of the `payment_request` array, to acomplish this the buyer will send a message in a Gift wrap Nostr event to Mostro with the following rumor's content: ```json { "order": { "version": 1, "id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842", - "pubkey": "0000147e939bef2b81c27af4c1b702c90c3843f7212a34934bff1e049b7f1427", "action": "take-sell", "content": { "payment_request": [null, "mostro_p2p@ln.tips", 15] diff --git a/book/src/user_rating.md b/book/src/user_rating.md index 6ec9f6c..b444679 100644 --- a/book/src/user_rating.md +++ b/book/src/user_rating.md @@ -1,27 +1,25 @@ # 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: +After a successful trade Mostro send a Gift wrap Nostr event to both parties to let them know they can rate each other, here an example how the message look like: ```json { "order": { "version": 1, "id": "7e44aa5d-855a-4b17-865e-8ca3834a91a3", - "pubkey": null, "action": "rate", "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: +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 Gift wrap Nostr event to send to Mostro with this content: ```json { "order": { "version": 1, "id": "7e44aa5d-855a-4b17-865e-8ca3834a91a3", - "pubkey": null, "action": "rate-user", "content": { "rating_user": 5 // User input @@ -32,7 +30,7 @@ After a Mostro client receive this message, the user can rate the other party, t ## Confirmation message -If Mostro received the correct message, it will send back a confirmation message to the user with `Action: rate-received`: +If Mostro received the correct message, it will send back a confirmation message to the user with the action `rate-received`: ```json {