Compare commits

...

8 Commits

Author SHA1 Message Date
Pablo Fernandez
7ad40d5159 Recurring Subscriptions 2023-11-05 13:14:43 +02:00
fiatjaf
08d3eff350 52: fix kinds (as ints). 2023-11-04 16:55:28 -03:00
fiatjaf
b14b9d2120 nip-01: clarify that whitespace is allowed inside the strings.
closes https://github.com/nostr-protocol/nips/pull/861
2023-11-02 19:46:37 -03:00
Ryan Breen
cee6977347 Adding Nostore to NIP-07 extension list. 2023-11-01 12:53:43 -03:00
Ioan Bizău
a328831a07 Unlimited quantity possible in NIP-15. 2023-10-31 15:54:25 -03:00
Semisol
4b9f13d983 NIP-90: consistency changes 2023-10-31 00:21:53 +03:00
Akiomi Kamakura
ad019ee067 DVM kinds change on README (#850) 2023-10-29 23:00:57 -03:00
Pablo Fernandez
7a2de8ab25 Merge pull request #682 from nostr-protocol/vending-machine
NIP-90: Data Vending Machines
2023-10-29 12:48:57 +02:00
7 changed files with 92 additions and 11 deletions

4
01.md
View File

@@ -29,9 +29,9 @@ The only object type that exists is the `event`, which has the following format
}
```
To obtain the `event.id`, we `sha256` the serialized event. The serialization is done over the UTF-8 JSON-serialized string (with no white space or line breaks) of the following structure:
To obtain the `event.id`, we `sha256` the serialized event. The serialization is done over the UTF-8 JSON-serialized string (with no white space or line breaks between the fields) of the following structure:
```json
```
[
0,
<pubkey, as a lowercase hex string>,

1
07.md
View File

@@ -35,3 +35,4 @@ async window.nostr.nip04.decrypt(pubkey, ciphertext): string // takes ciphertext
- [Nostrmo](https://github.com/haorendashu/nostrmo_faq#download) (Android, IOS)
- [Spring Browser](https://spring.site) (Android)
- [nodestr](https://github.com/lightning-digital-entertainment/nodestr) (NodeJS polyfill)
- [Nostore](https://apps.apple.com/us/app/nostore/id1666553677) (Safari on iOS/MacOS)

3
15.md
View File

@@ -88,7 +88,7 @@ Fields that are not self-explanatory:
"images": <[String], array of image URLs, optional>,
"currency": <String, currency used>,
"price": <float, cost of product>,
"quantity": <int, available items>,
"quantity": <int or null, available items>,
"specs": [
[<String, spec key>, <String, spec value>]
],
@@ -102,6 +102,7 @@ Fields that are not self-explanatory:
```
Fields that are not self-explanatory:
- `quantity` can be null in the case of items with unlimited abailability, like digital items, or services
- `specs`:
- an optional array of key pair values. It allows for the Customer UI to present product specifications in a structure mode. It also allows comparison between products
- eg: `[["operating_system", "Android 12.0"], ["screen_size", "6.4 inches"], ["connector_type", "USB Type C"]]`

6
52.md
View File

@@ -40,7 +40,7 @@ The list of tags are as follows:
"id": <32-bytes lowercase hex-encoded SHA-256 of the the serialized event data>,
"pubkey": <32-bytes lowercase hex-encoded public key of the event creator>,
"created_at": <Unix timestamp in seconds>,
"kind": "31922",
"kind": 31922,
"content": "<description of calendar event>",
"tags": [
["d", "<UUID>"],
@@ -98,7 +98,7 @@ The list of tags are as follows:
"id": <32-bytes lowercase hex-encoded SHA-256 of the the serialized event data>,
"pubkey": <32-bytes lowercase hex-encoded public key of the event creator>,
"created_at": <Unix timestamp in seconds>,
"kind": "31923",
"kind": 31923,
"content": "<description of calendar event>",
"tags": [
["d", "<UUID>"],
@@ -183,7 +183,7 @@ The list of tags are as follows:
"id": <32-bytes lowercase hex-encoded SHA-256 of the the serialized event data>,
"pubkey": <32-bytes lowercase hex-encoded public key of the event creator>,
"created_at": <Unix timestamp in seconds>,
"kind": "31925",
"kind": 31925,
"content": "<note>",
"tags": [
["a", "<31922 or 31923>:<calendar event author pubkey>:<d-identifier of calendar event>", "<optional relay url>"],

79
88.md Normal file
View File

@@ -0,0 +1,79 @@
NIP-88
======
Recurring Subscriptions
-----------------------
`draft` `optional` `author:pablof7z`
This NIP defines a way for a pubkey to create recurring subscription payments to another pubkey.
## Tier Event
A pubkey can create "tiers". These tiers might provide certain benefits to the supporters who subscribe to these.
```json
{
"kind": 7002,
"content": "<description of the tier>",
"tags": [
[ "title", "..." ],
[ "amount", "<amount-in-base-unit>", "currency", "<cadence>" ]
]
}
```
This event is generated by a pubkey who wants to allow users to support with different tiers.
`.content` SHOULD be a description of what users who subscribe can expect.
Tag `title` is an optional title for the tier.
Tag `amount` MUST specify the payment required for this tier and its cadence.
* The first argument should be the stringified amount and the second argument the currency
* The third argument SHOULD be one of `daily`, `monthly`, `yearly`
One or more `amount` tags MUST exist.
#### Examples
* `[ "amount", "100", "usd", "daily" ]`, $1.00 a day.
* `[ "amount", "1000000", "btc", "daily" ]`, 1000000 millisats a day.
## Subscribe Event
```json
{
"kind": 7001,
"content": "<optional-message>",
"tags": [
[ "p", "<recipient-pubkey>" ],
[ "e", "<supporting-tier-id>" ],
[ "amount", "<amount-in-base-unit>", "currency", "<cadence>" ]
]
}
```
When a user wants to subscribe to subscribe to support a user they create a `kind:7001` event.
* `.content` is an optional message the supporter can write.
* The `p` tag MUST tag the pubkey being supported.
* The `e` tag is optional, and should point to a `kind:7001` support tier event. There MUST be exactly 0 or 1 `e` tags.
* The `amount` tag specifies what the supporters is committing to pay to the supported pubkey and the candence.
The `kind:7001` event can be created without an `e` tag so that users can create recurring support events without the pubkey receiving the support having explicitly created a support tier.
## Paying
The supporting user should create a zap p-tagging the receiver and e-tagging the `kind:7001`. There MUST be a single `p` and a single `e` tag in the zap request.
```json
{
"kind": 9734,
"content": "",
"tags": [
[ "p", "<recipient-pubkey>" ],
[ "e", "<kind-7001-event-id>" ]
]
```
Clients supporting this NIP can check for zaps e-tagging the `kind:7001` event to find the pubkeys that have a valid, paid subscriptions at each different period.
The same `kind:7001` is re-zapped on a regular basis per the cadence specified in the event.
## Stopping a subscription
A user who wants to stop a subscription by publishing a `kind:5` deletion request of the `kind:7001` event.

6
90.md
View File

@@ -43,7 +43,7 @@ A request to process data, published by a customer. This event signals that an c
"tags": [
[ "i", "<data>", "<input-type>", "<relay>", "<marker>" ],
[ "output", "<mime-type>" ],
[ "relays", "wss://..."],
[ "relays", "wss://..." ],
[ "bid", "<msat-amount>" ],
[ "t", "bitcoin" ]
]
@@ -162,10 +162,10 @@ Service Providers MAY use NIP-89 announcements to advertise their support for jo
\"about\": \"I'm a DVM specialized in translating Bitcoin content.\"
}",
"tags": [
[ "k", 5005 ], // e.g. translation
[ "k", "5005" ], // e.g. translation
[ "t", "bitcoin" ] // e.g. optionally advertises it specializes in bitcoin audio transcription that won't confuse "Drivechains" with "Ridechains"
]
}
```
Customers can use NIP-89 to see what service providers their follows use.
Customers can use NIP-89 to see what service providers their follows use.

View File

@@ -98,6 +98,8 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
| `1985` | Label | [32](32.md) |
| `4550` | Community Post Approval | [72](72.md) |
| `7000` | Job Feedback | [90](90.md) |
| `7001` | Recurring Subscription | [88](88.md) |
| `7002` | Recurring Subscription Tier| [88](88.md) |
| `9041` | Zap Goal | [75](75.md) |
| `9734` | Zap Request | [57](57.md) |
| `9735` | Zap | [57](57.md) |
@@ -130,8 +132,6 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
| `31989` | Handler recommendation | [89](89.md) |
| `31990` | Handler information | [89](89.md) |
| `34550` | Community Definition | [72](72.md) |
| `65000` | Job Feedback | [90](90.md) |
| `65001` | Job Result | [90](90.md) |
## Message types