upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancisco Calderón <fjcalderon@gmail.com>2024-06-27 11:31:34 -0300
committerFrancisco Calderón <fjcalderon@gmail.com>2024-06-27 11:31:34 -0300
commitf57d559dc08bf4b59ddefe9416f7569f751f75dd (patch)
treeff0de71e068eca50e26a0afc54d34f46b29f0e99
parenta551c5b69337021f83f7886ecfd211915737a771 (diff)
Proposal of a very simple spec for p2p events
-rw-r--r--xx.md77
1 files changed, 77 insertions, 0 deletions
diff --git a/xx.md b/xx.md
new file mode 100644
index 0000000..2ab8fc4
--- /dev/null
+++ b/xx.md
@@ -0,0 +1,77 @@
1# NIP-XX
2
3## Peer-to-peer messages
4
5`draft` `optional`
6
7## Abstract
8
9Peer-to-peer (P2P) platforms have seen an upturn in recent years, while having more and more options is positive, in the specific case of p2p, having several options contributes to the liquidity split, meaning sometimes there's not enough assets available for trading. If we combine all these individual solutions into one big pool of orders, it will make them much more competitive compared to centralized systems, where a single authority controls the liquidity.
10
11This NIP defines a simple standard for peer-to-peer messages, which enables the creation of a big liquidity pool for all p2p platforms participating.
12
13## The event
14
15Events are [Parameterized Replaceable Events](https://github.com/nostr-protocol/nips/blob/master/01.md#kinds) and use `38383` as event kind, a p2p event look like this:
16
17```json
18[
19 "EVENT",
20 "RAND",
21 {
22 "id": "84fad0d29cb3529d789faeff2033e88fe157a48e071c6a5d1619928289420e31",
23 "pubkey": "dbe0b1be7aafd3cfba92d7463edbd4e33b2969f61bd554d37ac56f032e13355a",
24 "created_at": 1702548701,
25 "kind": 38383,
26 "tags": [
27 ["d", "ede61c96-4c13-4519-bf3a-dcf7f1e9d842"],
28 ["k", "sell"],
29 ["f", "VES"],
30 ["s", "pending"],
31 ["amt", "0"],
32 ["fa", "100"],
33 ["pm", "face to face"],
34 ["premium", "1"],
35 [
36 "rating",
37 "{\"total_reviews\":1,\"total_rating\":3.0,\"last_rating\":3,\"max_rate\":5,\"min_rate\":1}"
38 ],
39 ["network", "lightning"],
40 ["expiration", "1719391096"],
41 ["y", "mostrop2p"],
42 ["z", "order"]
43 ],
44 "content": "",
45 "sig": "7e8fe1eb644f33ff51d8805c02a0e1a6d034e6234eac50ef7a7e0dac68a0414f7910366204fa8217086f90eddaa37ded71e61f736d1838e37c0b73f6a16c4af2"
46 }
47]
48```
49
50## Tags
51
52- `d` Order ID: A unique identifier for the order.
53- `k` Order type: `sell` or `buy`.
54- `f` Currency: The asset being traded, using the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) standard.
55- `s` Status: `pending`, `canceled`, `in-progress`, `success`.
56- `amt` Amount: The amount of Bitcoin to be traded, the amount is defined in satoshis, if `0` means that the amount of satoshis will be obtained from a public API after the taker accepts the order.
57- `fa` Fiat amount: The fiat amount being traded, for range orders two values are expected, the minimum and maximum amount.
58- `pm` Payment method: The payment method used for the trade.
59- `premium` Premium: The percentage of the premium the maker is willing to pay.
60- `rating` Rating: The rating of the maker, this document does not define how the rating is calculated, it's up to the platform to define it.
61- `n` Network: The network used for the trade, it can be `lightning`, `liquid`, `onchain`, etc.
62- `expiration` Expiration: The expiration date of the order ([NIP-40](https://github.com/nostr-protocol/nips/blob/master/40.md)).
63- `y` Platform: The platform that created the order.
64- `z` Order type: `order`.
65
66## Implementations
67
68Currently implemented on the following platforms:
69
70- [Mostro](https://github.com/MostroP2P/mostro)
71- [@lnp2pBot](https://github.com/lnp2pBot/bot)
72
73## References
74
75- [Mostro messages specification](https://mostro.network/messages/)
76- [Messages specification for peer 2 peer NIP proposal](https://github.com/nostr-protocol/nips/blob/8250274a22f4882f621510df0054fd6167c10c9e/31001.md)
77- [n3xB](https://github.com/nobu-maeda/n3xb)