Skip to content

Commit 9157321

Browse files
authored
Merge pull request #1 from conduition/dlcs
additional clarity around message content and tags
2 parents ceaf163 + 7089bf7 commit 9157321

1 file changed

Lines changed: 30 additions & 7 deletions

File tree

88.md

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,15 @@ a unique opportunity to use a different transport layer for DLCs. This NIP propo
1919
acts like a mailbox for DLC messages. The DLC messages are sent over nostr and available for the user the next time
2020
they open their wallet. This allows for a more mobile-friendly DLC experience.
2121

22+
DLC protocol messages are binary-serialized messages described concretely in
23+
[this document](https://github.com/discreetlogcontracts/dlcspecs/blob/master/Messaging.md).
24+
Whenever embedding DLC messages inside Nostr events (which are encoded as JSON), we serialize those DLC messages in base64.
25+
2226
### `kind:8_888`
2327

24-
Kind 8_888 is a simple message that contains a [NIP04](04.md) encrypted DLC message and it tagged with the recipient's
25-
public key with a `p` tag and if it is in reply to another event, that event should be tagged with an `e` tag.
28+
Kind 8_888 is a simple message that contains a [NIP04](04.md) encrypted DLC message and is tagged with the recipient's
29+
public key with a `p` tag and if it is in reply to another event, that event should be tagged with an `e` tag. The DLC
30+
message is first serialized in binary, and then encrypted with [NIP04](04.md).
2631

2732
A DLC wallet should only process messages that are tagged with their public key and that are in reply to a message they
2833
sent unless it is an offer. This is to prevent spam and to prevent a malicious actor from sending a message to a user
@@ -58,14 +63,18 @@ offer.
5863

5964
A parameterized replaceable event is used to allow the offerer to update the offer or remove it from the market. The `d`
6065
tag should be the Offer's id to allow replacement of the offer. If the user wishes to remove the offer from the market,
61-
they can replace the event with an expires tag that is in the past.
66+
they can replace the event with an `expires` tag that is in the past. The `relays` tag indicates the relays on which to
67+
contact the offerer.
68+
69+
The `content` field must be the base64-encoding of a binary-serialized
70+
[`contract_info` object](https://github.com/discreetlogcontracts/dlcspecs/blob/master/Messaging.md#the-contract_info-type).
6271

6372
### `kind:30_088`
6473

6574
```jsonc
6675
{
6776
"kind": 30088,
68-
"content": "base64 contract details",
77+
"content": "base64 contract_info",
6978
"tags": [
7079
[
7180
"relays",
@@ -101,7 +110,7 @@ attestations respectively.
101110
```jsonc
102111
{
103112
"kind": 88,
104-
"content": "base64 oracle annoucement",
113+
"content": "base64 oracle_annoucement",
105114
"tags": [
106115
[
107116
"relays", // the relays the oracle will publish attestations to
@@ -116,15 +125,18 @@ attestations respectively.
116125
}
117126
```
118127

128+
The `content` field must be the base64-encoding of a binary-serialized
129+
[`oracle_annoucement` object](https://github.com/discreetlogcontracts/dlcspecs/blob/master/Messaging.md#the-oracle_annoucement-type).
130+
119131
### `kind:89`
120132

121133
```jsonc
122134
{
123135
"kind": 89,
124-
"content": "base64 oracle attestation",
136+
"content": "base64 oracle_attestation",
125137
"tags": [
126138
[
127-
"e", // the event id of the announcement
139+
"e", // the Nostr event id of the announcement
128140
"30efed56a035b2549fcaeec0bf2c1595f9a9b3bb4b1a38abaf8ee9041c4b7d93",
129141
],
130142
],
@@ -135,6 +147,17 @@ attestations respectively.
135147
}
136148
```
137149

150+
The `content` field must be the base64-encoding of a binary-serialized
151+
[`oracle_attestation` object](https://github.com/discreetlogcontracts/dlcspecs/blob/master/Messaging.md#the-oracle_attestation-type).
152+
153+
Note that the `e` tag is the _Nostr event identifier_ for the `kind:88` announcement event, which is distinct from the identifier
154+
embedded [in the announcement](https://github.com/discreetlogcontracts/dlcspecs/blob/master/Messaging.md#oracle_event) or
155+
[in the attestation itself](https://github.com/discreetlogcontracts/dlcspecs/blob/master/Messaging.md#oracle_attestation). The `e`
156+
tag is intended to be used to look up the corresponding announcement event.
157+
158+
Upon receiving an attestation, clients _should_ validate that the `event_id` field inside the `oracle_announcement` object matches
159+
the `event_id` field in the `oracle_attestation` object.
160+
138161
## DLC Receipts
139162

140163
DLCs can be fun, social events. This NIP proposes a `kind:90` event that can be used to publish the result of a DLC

0 commit comments

Comments
 (0)