nips/85.md

82 lines
4.6 KiB
Markdown
Raw Normal View History

2024-10-11 09:08:21 -04:00
NIP-85
======
Trusted Assertions
------------------
`draft` `optional`
2024-10-14 10:13:21 -04:00
Certain calculations in Nostr require access to a large volume of events, making it impractical to perform them directly on clients. This NIP allows service providers to handle such computations in real time and generate signed events with the results. Each calculation type is assigned a distinct event kind and tag. Users can specify which service providers they trust, enabling clients to load and display the results based on those trusted sources.
2024-10-11 09:08:21 -04:00
2024-10-11 09:43:07 -04:00
Assertions are always addressable events with the `d` tag pointing to the subject of the assertion. The following kinds and tags have been specified:
2024-10-11 09:08:21 -04:00
| name | kind | `d` tag value | result tags |
| ----------------------- | ----- | ------------- | ----------------------------------- |
| Follower Count | 30382 | pubkey | `"followers"` (int) |
2024-10-14 10:13:21 -04:00
| User Rank | 30382 | pubkey | `"rank"` (int, normalized 0-100) |
2024-10-11 12:43:13 -04:00
| First Post Time | 30382 | pubkey | `"first_created_at"` (int,timestamp)|
| Post Count | 30382 | pubkey | `"post_cnt"` (int, sats) |
| Reply Count | 30382 | pubkey | `"reply_cnt"` (int, sats) |
| Reactions Count | 30382 | pubkey | `"reactions_cnt"` (int, sats) |
| Zap Amount Received | 30382 | pubkey | `"zap_amt_recd"` (int, sats) |
| Zap Amount Sent | 30382 | pubkey | `"zap_amt_sent"` (int, sats) |
| Zap Number Received | 30382 | pubkey | `"zap_cnt_recd"` (int) |
| Zap Number Sent | 30382 | pubkey | `"zap_cnt_sent"` (int) |
2024-10-11 12:43:13 -04:00
| Avg Zap Amount/day recd | 30382 | pubkey | `"zap_avg_amt_day_recd"` (int, sats)|
| Avg Zap Amount/day sent | 30382 | pubkey | `"zap_avg_amt_day_sent"` (int, sats)|
| Reports Received | 30382 | pubkey | `"reports_cnt_recd"` (int) |
| Reports Sent | 30382 | pubkey | `"reports_cnt_sent"` (int) |
| Common Topics | 30382 | pubkey | `"t"` (string) |
| Generally active start | 30382 | pubkey | `"active_hours_start"` (0-24 UTC) |
| Generally active end | 30382 | pubkey | `"active_hours_end"` (0-24 UTC) |
| Event Comment Count | 30383 | event id | `"comment_cnt"` (int) |
| Event Quote Count | 30383 | event id | `"quote_cnt"` (int) |
| Event Repost Count | 30383 | event id | `"repost_cnt"` (int) |
| Event Reaction Count | 30383 | event id | `"reaction_cnt"` (int) |
| Event Zap Count | 30383 | event id | `"zap_cnt"` (int) |
| Event Zap Amount | 30383 | event id | `"zap_amount"` (int, sats) |
2024-10-14 10:13:21 -04:00
| Event Rank | 30383 | event id | `"rank"` (int, normalized 0-100) |
| Address Comment Count | 30384 | event address | `"comment_cnt"` (int) |
| Address Quote Count | 30384 | event address | `"quote_cnt"` (int) |
| Address Repost Count | 30384 | event address | `"repost_cnt"` (int) |
| Address Reaction Count | 30384 | event address | `"reaction_cnt"` (int) |
| Address Zap Count | 30384 | event address | `"zap_cnt"` (int) |
| Address Zap Amount | 30384 | event address | `"zap_amount"` (int, sats) |
2024-10-14 10:13:21 -04:00
| Address Rank | 30384 | event address | `"rank"` (int, normalized 0-100) |
2024-10-11 09:08:21 -04:00
Example:
```jsonc
{
"kind": 30382,
"tags": [
["d", "e88a691e98d9987c964521dff60025f60700378a4879180dcbbb4a5027850411"],
2024-10-14 10:13:21 -04:00
["rank", "89"],
2024-10-11 09:08:21 -04:00
["zap_amt_sent", "1000000"],
],
"content": "",
//...
}
```
2024-10-11 09:43:07 -04:00
Service providers SHOULD update their results constantly and MAY limit access by using paid relays.
2024-10-11 09:18:11 -04:00
2024-10-11 09:08:21 -04:00
## Declaring Trusted Service Providers
Kind `10040` lists the user's authorized providers for each service. The service tag is followed by the `pubkey` of the service and the relay where the results are published.
```jsonc
{
"kind": 10040,
"tags": [
2024-10-14 10:13:21 -04:00
["rank", "818a39b5f164235f86254b12ca586efccc1f95e98b45cb1c91c71dc5d9486dda", "wss://relay.nostr.band"],
["rank", "3d842afecd5e293f28b6627933704a3fb8ce153aa91d790ab11f6a752d44a42d", "wss://nostr.wine"],
2024-10-11 09:08:21 -04:00
["zap_amt_sent", "818a39b5f164235f86254b12ca586efccc1f95e98b45cb1c91c71dc5d9486dda", "wss://relay.nostr.band"],
],
"content": "",
//...
}
```
2024-10-11 09:43:07 -04:00
Clients should download this list, and load and display assertions when appropriate.