Thanks to visit codestin.com
Credit goes to github.com

Skip to content
85 changes: 85 additions & 0 deletions 85.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
NIP-85
======

Trusted Assertions
------------------

`draft` `optional`

Certain calculations require access to a large volume of events, making it impossible to perform them directly on clients. This NIP allows service providers to handle such computations and generate signed events with results in real-time. Each calculation type is assigned an 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.

Assertions are always addressable events with the `d` tag pointing to the subject of the assertion. The following kinds and tags have been specified:

| name | kind | `d` tag value | result tags |
| ----------------------- | ----- | ------------- | ----------------------------------- |
| Follower Count | 30382 | pubkey | `"followers"` (int) |
| User Rank | 30382 | pubkey | `"rank"` (int, normalized 0-100) |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolute ranks are pointless. Relative ranks will require "d" tag to reflect the ID of 'observer' AS WELL as 'subject'.

Copy link
Collaborator Author

@vitorpamplona vitorpamplona Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the relative rank should be made via a DVM, where there is a request/response that facilitates creating each pair that matters. Otherwise, generating ranks for every pair of public keys in Nostr will take a huge processing power.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with @vitorpamplona

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generating ranks for every pairs of public keys in Nostr will take a huge processing power.

No. Ranking services won't have to calculate "Every pair of public keys" on Nostr.

  • Services will only calculate "subject" pubkeys for an "observer" who "trusts" and authorizes (and subscribes to?) the service.

  • Services will (presumably) cache rankings for each "subscribed" observer.

  • Clients and services only need to handle rankings for ONE "observer" (client user) per session.

In the end... this is no additional work for the client ... and services providers can "optionally" provide relative (observer centric) rankings or not.

| 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) |
| 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) |
| 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) |
| Address Rank | 30384 | event address | `"rank"` (int, normalized 0-100) |

Example:

```jsonc
{
"kind": 30382,
"tags": [
["d", "e88a691e98d9987c964521dff60025f60700378a4879180dcbbb4a5027850411"],
["p", "e88a691e98d9987c964521dff60025f60700378a4879180dcbbb4a5027850411", "<user-home-relay-url>"], // relay hints to find the user
["rank", "89"],
["zap_amt_sent", "1000000"],
],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

["delegation", "4fd5e210530e4f6b2cb083795834bfe5108324f1ed9f00ab73b9e8fcfe5f12fe"], // publish this assertion on 'behalf' of another pubkey ... as for 'relative' ranks of user and content

"content": "",
//...
}
```

Service providers SHOULD update their results constantly and MAY limit access to the results by using paid relays.

`p`, `e`, and `a` tags with the same value as the `d` tag can be used to add a relay hint with the home relay of that user or event.

## Declaring Trusted Service Providers

Kind `10040` lists the user's authorized providers for each service. The service's `kind:tag` is followed by the `pubkey` of the service and the relay where the results are published. Users can specify these publicly or privately by JSON-stringifying and encrypting the tag list in the `.content`

```js
{
"kind": 10040,
"tags": [
["30382:rank", "4fd5e210530e4f6b2cb083795834bfe5108324f1ed9f00ab73b9e8fcfe5f12fe", "wss://nip85.nostr.band"],
["30382:rank", "3d842afecd5e293f28b6627933704a3fb8ce153aa91d790ab11f6a752d44a42d", "wss://nostr.wine"],
["30382:zap_amt_sent", "4fd5e210530e4f6b2cb083795834bfe5108324f1ed9f00ab73b9e8fcfe5f12fe", "wss://nip85.nostr.band"],
],
"content": nip44Encrypt(JSON.stringify([
["30383:rank", "4fd5e210530e4f6b2cb083795834bfe5108324f1ed9f00ab73b9e8fcfe5f12fe", "wss://nip85.nostr.band"],
["30384:rank", "4fd5e210530e4f6b2cb083795834bfe5108324f1ed9f00ab73b9e8fcfe5f12fe", "wss://nip85.nostr.band"],
]),
//...
}
```