mirror of
https://github.com/nostr-protocol/nips.git
synced 2025-01-18 20:21:35 +00:00
NIP-88: DLC oracle announcement/attestation event kinds
This commit is contained in:
parent
76fd221ff1
commit
c78872eec1
76
88.md
Normal file
76
88.md
Normal file
@ -0,0 +1,76 @@
|
||||
NIP-88
|
||||
======
|
||||
|
||||
Discreet Log Contract Oracles on Nostr
|
||||
-----------------
|
||||
|
||||
`draft` `optional`
|
||||
|
||||
This NIP describes two event kinds, `88` and `89`, for [Discreet Log Contract (DLC)](https://bitcoinops.org/en/topics/discreet-log-contracts/) oracles to publish their announcements and attestations over Nostr. Clients can consume these signed events to create conditional payment contracts which fulfill differently based on the oracles' attestations.
|
||||
|
||||
## Format
|
||||
|
||||
DLC protocol messages are binary-serialized messages described concretely in [this document](https://github.com/discreetlogcontracts/dlcspecs/blob/master/Messaging.md). Whenever embedding DLC messages inside Nostr events (which are encoded as JSON), we serialize those DLC messages in base64.
|
||||
|
||||
## DLC Oracle Gossip
|
||||
|
||||
DLCs require an oracle to attest to the outcome of real world events. This is done by the oracle signing a message containing the outcome of the event. Before they attest to the outcome, they must create an announcement where they publish the intent to sign the future event. This announcement is then used by the DLC participants to create the contract. Here we define two events, `kind:88` and `kind:89` that are used to publish the oracle's announcement and attestations respectively.
|
||||
|
||||
### `kind:88`
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"kind": 88,
|
||||
"content": "BA/cNhCpdD25j/MwDaa4F42QIq8NsOGmaW1MxyswZnipGWirwoxPhL1SmoHcp1JuCjYXF...",
|
||||
"tags": [
|
||||
[
|
||||
"relays", // the relays the oracle will publish attestations to
|
||||
"wss://nostr.mutinywallet.com",
|
||||
"wss://relay.damus.io"
|
||||
],
|
||||
[
|
||||
"title",
|
||||
"Optional Event Title"
|
||||
],
|
||||
[
|
||||
"description",
|
||||
"An optional human-readable description of the event which the oracle will attest to, in plain text."
|
||||
]
|
||||
],
|
||||
"pubkey": "97c70a44366a6535c145b333f973ea86dfdc2d7a99da618c40c64705ad98e322",
|
||||
"created_at": 1679673265,
|
||||
"id": "30efed56a035b2549fcaeec0bf2c1595f9a9b3bb4b1a38abaf8ee9041c4b7d93",
|
||||
"sig": "f2cb581a84ed10e4dc84937bd98e27acac71ab057255f6aa8dfa561808c981fe8870f4a03c1e3666784d82a9c802d3704e174371aa13d63e2aeaf24ff5374d9d"
|
||||
}
|
||||
```
|
||||
|
||||
The `content` field must be the base64-encoding of a binary-serialized [`oracle_annoucement` object](https://github.com/discreetlogcontracts/dlcspecs/blob/master/Messaging.md#the-oracle_annoucement-type).
|
||||
|
||||
The optional `title` tag gives observers a short human-readable title with which to display the announcement in cards, hyperlinks, etc. It _should_ be at most 100 characters of UTF-8 text. Clients _should_ ignore or truncate titles longer than 100 characters. This tag must NOT be parsed as markdown or HTML.
|
||||
|
||||
The optional `description` tag provides a human-readable summary of the real-world event which this announcement is for. The `description` should give observers context, so that they know how the real-world event in question will be reflected in the oracle's final attestation. This tag must NOT be parsed as markdown or HTML.
|
||||
|
||||
### `kind:89`
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"kind": 89,
|
||||
"content": "w7HSaUaPQn7Fa00PoUwTqkR2+wXHCPjD8Da5f4OcJ0EACsUw6uSdQgUDLLG9o/e9daS...",
|
||||
"tags": [
|
||||
[
|
||||
"e", // the Nostr event id of the announcement
|
||||
"30efed56a035b2549fcaeec0bf2c1595f9a9b3bb4b1a38abaf8ee9041c4b7d93",
|
||||
]
|
||||
],
|
||||
"pubkey": "97c70a44366a6535c145b333f973ea86dfdc2d7a99da618c40c64705ad98e322",
|
||||
"created_at": 1679673265,
|
||||
"id": "30efed56a035b2549fcaeec0bf2c1595f9a9b3bb4b1a38abaf8ee9041c4b7d93",
|
||||
"sig": "f2cb581a84ed10e4dc84937bd98e27acac71ab057255f6aa8dfa561808c981fe8870f4a03c1e3666784d82a9c802d3704e174371aa13d63e2aeaf24ff5374d9d"
|
||||
}
|
||||
```
|
||||
|
||||
The `content` field must be the base64-encoding of a binary-serialized [`oracle_attestation` object](https://github.com/discreetlogcontracts/dlcspecs/blob/master/Messaging.md#the-oracle_attestation-type).
|
||||
|
||||
Note that the `e` tag is the _Nostr event identifier_ for the `kind:88` announcement event, which is distinct from the identifier embedded [in the announcement](https://github.com/discreetlogcontracts/dlcspecs/blob/master/Messaging.md#oracle_event) or [in the attestation itself](https://github.com/discreetlogcontracts/dlcspecs/blob/master/Messaging.md#oracle_attestation). The `e` tag is intended to be used to look up the corresponding announcement event.
|
||||
|
||||
Upon receiving an attestation, clients _should_ validate that the `event_id` field inside the `oracle_announcement` object matches the `event_id` field in the `oracle_attestation` object.
|
Loading…
Reference in New Issue
Block a user