-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Web of trust related DVMs #38
Draft
franzaps
wants to merge
1
commit into
nostr-protocol:master
Choose a base branch
from
vertex-lab:web-of-trust-dvm
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+439
−0
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,181 @@ | ||||||
--- | ||||||
layout: default | ||||||
title: Verify Reputation | ||||||
description: Job that returns pubkey reputation information based on an algorithm | ||||||
--- | ||||||
|
||||||
This service returns reputation information about a pubkey, including a list of pubkeys who follow it sorted by an algorithm. | ||||||
|
||||||
# Input | ||||||
|
||||||
None. The DVM `i` input tag SHOULD NOT be used and `content` SHOULD be empty. | ||||||
|
||||||
# Params | ||||||
|
||||||
| Parameter | Type | Description | Default Value | | ||||||
|-----|-----|-----|-----| | ||||||
| `source` | string | The source pubkeys used for personalized algorithms | The pubkey signing the DVM request | | ||||||
| `target` | string | Pubkeys the requester is interested in | - | | ||||||
| `context` | string | Additional context for the algorithm to compute | - | | ||||||
| `distance` | int | Maximum (or minimum) number of hops in the graph to perform the calculation to (or from) | `0` | | ||||||
| `sort` | string | Algorithm used to sort results | Implementation-specific | | ||||||
| `limit` | int | Maximum number of results returned in a response | Implementation-specific | | ||||||
| `proofs` | boolean | Whether to return applicable events (kinds 0, 3, etc.) on the websocket connection for clients to verify certain claims | `false` | | ||||||
|
||||||
Pubkeys SHOULD be in hex format. Implementations MAY support automatic npub decoding. | ||||||
|
||||||
Multiple `source` and/or `target` parameters MAY be supplied. Algorithms that work with single values SHOULD take the first value in these lists. | ||||||
|
||||||
Parameters `limit` and `sort` SHOULD NOT be required and are implementation-specific. | ||||||
|
||||||
## Sorting algorithms | ||||||
|
||||||
Algorithms are used for sorting results and MAY be passed in the request. Each service will offer different ones, here is a non-exhaustive list: | ||||||
|
||||||
- `globalPagerank`: Global Pagerank | ||||||
- `personalizedPagerank`: Personalized Pagerank | ||||||
- `graperank`: Graperank | ||||||
- `verifiedFollowers`: Followers with a minimum rank (uses `personalizedPagerank` if source is provided or otherwise `globalPagerank`) | ||||||
- `distance`: Number of hops in the graph between source and target | ||||||
|
||||||
# Output | ||||||
|
||||||
The response MUST be a standard DVM response including the corresponding `e` and `p` tags. | ||||||
|
||||||
Its `content` field MUST return a JSON-stringified array of objects formatted as: | ||||||
|
||||||
| Properties | Types | Description | | ||||||
|-----|-----|-----| | ||||||
| {`target`, `rank`} | {string, float} | Requested target along with its rank | | ||||||
| {`follower`, `rank`} | {string, float} | Follower of target along with its rank | | ||||||
|
||||||
Pubkeys SHOULD be in hex format. | ||||||
|
||||||
Services MAY return objects in descending rank order for client convenience. | ||||||
|
||||||
# How clients can use this | ||||||
|
||||||
- Assessing trust for a new profile a user comes across, for example by showing which of their followers follow that new profile | ||||||
- Obtaining verified followers of a new profile | ||||||
- Detecting the probability that new profile is an impersonator | ||||||
|
||||||
# Example | ||||||
|
||||||
```json | ||||||
{ | ||||||
"id": "1cd2c73f53e602ae6f081997962bd43c730a565053080ab27ef7efb7335f7f49", | ||||||
"pubkey": "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", | ||||||
"created_at": 1732758297, | ||||||
"kind": 5312, | ||||||
"tags": [ | ||||||
[ | ||||||
"param", | ||||||
"source", | ||||||
"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" | ||||||
], | ||||||
[ | ||||||
"param", | ||||||
"target", | ||||||
"5097f9b8bd3ebb3c240a6a0c95bdf24d22a10211181f90ba29c41c31c889ba0a" | ||||||
], | ||||||
[ | ||||||
"param", | ||||||
"sort", | ||||||
"personalizedPagerank" | ||||||
], | ||||||
[ | ||||||
"param", | ||||||
"limit", | ||||||
5 | ||||||
], | ||||||
[ | ||||||
"param", | ||||||
"proofs", | ||||||
false | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
] | ||||||
], | ||||||
"content": "", | ||||||
"sig": "22f8aa10a0a3e9ef44f2b6a050868f46f19fcc1bbd9da3c3b291164405fb854a4b83524770d82d008a7415636554defcfb5ea52bf42e8a681a69ef10a81bc8e2" | ||||||
} | ||||||
``` | ||||||
|
||||||
```json | ||||||
{ | ||||||
"id": "26594511e04ee1b20b94719616a2380b3dcaf0430e2fd6d4dcf59d24f9175fca", | ||||||
"pubkey": "a9b008476119ea693cbd2f0b4de99fd346e2e30880b18d42234a1158bd323783", | ||||||
"created_at": 1732758298, | ||||||
"kind": 6312, | ||||||
"tags": [ | ||||||
[ | ||||||
"e", | ||||||
"1cd2c73f53e602ae6f081997962bd43c730a565053080ab27ef7efb7335f7f49" | ||||||
], | ||||||
[ | ||||||
"p", | ||||||
"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" | ||||||
] | ||||||
], | ||||||
"content": "[{\"target\":\"f7c905827bc83e1330bee2c3a6a5b8e076976efd1b46b3e6d1ec2447a34785e2\",\"rank\":0.00266}, | ||||||
{\"follower\":\"bd0c0615960ff21214aee7f5b06fa0a104585938c8eb4b5cd4e2b109041fdf62\",\"rank\":0.0025},{\"follower\":\"d05ab982e1105476ab68e4c6728d148f8e6222154e60cc359ef6b8599c820bea\",\"rank\":0.00163},{\"follower\":\"6efd1b46b3e6d1ec2447af7c905827bc83e1330bee2c3a6a5b8e0769734785e2\",\"rank\":0.00154},{\"follower\":\"bb17f1e4e516e75e82a5b5e81c0120ffeb24e9e92866962440b9888ae82e42a1\",\"rank\":0.00111},{\"follower\":\"5097f9b8bd3ebb3c240a6a0c95bdf24d22a10211181f90ba29c41c31c889ba0a\",\"rank\":0.000107}]", | ||||||
"sig": "3c25ff7f8d6d847775a9aafb8b1f28d2f2e9b53f78de7f53b49fbbe46402358dc281be263c20919a426cbea86fbe9d36951fd5dd86465181d9d49be056616f53" | ||||||
} | ||||||
``` | ||||||
|
||||||
Formatted `content` JSON: | ||||||
|
||||||
```json | ||||||
[ | ||||||
{ | ||||||
"target": "f7c905827bc83e1330bee2c3a6a5b8e076976efd1b46b3e6d1ec2447a34785e2", | ||||||
"rank": 0.00266 | ||||||
}, | ||||||
{ | ||||||
"follower": "bd0c0615960ff21214aee7f5b06fa0a104585938c8eb4b5cd4e2b109041fdf62", | ||||||
"rank": 0.0025 | ||||||
}, | ||||||
{ | ||||||
"follower": "d05ab982e1105476ab68e4c6728d148f8e6222154e60cc359ef6b8599c820bea", | ||||||
"rank": 0.00163 | ||||||
}, | ||||||
{ | ||||||
"follower": "6efd1b46b3e6d1ec2447af7c905827bc83e1330bee2c3a6a5b8e0769734785e2", | ||||||
"rank": 0.00154 | ||||||
}, | ||||||
{ | ||||||
"follower": "bb17f1e4e516e75e82a5b5e81c0120ffeb24e9e92866962440b9888ae82e42a1", | ||||||
"rank": 0.00111 | ||||||
}, | ||||||
{ | ||||||
"follower": "5097f9b8bd3ebb3c240a6a0c95bdf24d22a10211181f90ba29c41c31c889ba0a", | ||||||
"rank": 0.000107 | ||||||
} | ||||||
] | ||||||
``` | ||||||
|
||||||
Error response: | ||||||
|
||||||
```json | ||||||
{ | ||||||
"kind": 7000, | ||||||
"id": "96f6eec0b3e410db91b85bee714740ec76ec64a9eb60a5503fee4dfc02047c1a", | ||||||
"pubkey": "5fc48ac4765ff81e9c51014b9d2f2c91621370f4c6b5452a9c06456e4cccaeb4", | ||||||
"created_at": 1738635799, | ||||||
"tags": [ | ||||||
[ | ||||||
"status", | ||||||
"error", | ||||||
"badly formatted key: npub1" | ||||||
], | ||||||
[ | ||||||
"e", | ||||||
"1cd2c73f53e602ae6f081997962bd43c730a565053080ab27ef7efb7335f7f49" | ||||||
], | ||||||
[ | ||||||
"p", | ||||||
"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" | ||||||
] | ||||||
], | ||||||
"content": "", | ||||||
"sig": "6318c7ce6c57dd85779faadc4fed7733a1e50bd46205d52c96e535648dd2dd07e573e8d1fdef496d27014c80d1f2f604cb5337744d24000c00dde485ccdcf48c" | ||||||
} | ||||||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
--- | ||
layout: default | ||
title: Recommend Follows | ||
description: Job that recommends follows based on an algorithm | ||
--- | ||
|
||
This service returns a list of recommended pubkeys (the ones with highest rank excluding source and its follows) sorted by an algorithm. | ||
|
||
# Input | ||
|
||
None. The DVM `i` input tag SHOULD NOT be used and `content` SHOULD be empty. | ||
|
||
# Params | ||
|
||
| Parameter | Type | Description | Default Value | | ||
|-----|-----|-----|-----| | ||
| `source` | string | The source pubkey used for personalized algorithms | The pubkey signing the DVM request | | ||
| `context` | string | Additional context for the algorithm to compute | - | | ||
| `distance` | int | Maximum (or minimum) number of hops in the graph to perform the calculation to (or from) | `0` | | ||
| `sort` | string | Algorithm used to sort results | Implementation-specific | | ||
| `limit` | int | Maximum number of results returned in a response | Implementation-specific | | ||
|
||
Pubkeys SHOULD be in hex format. Implementations MAY support automatic npub decoding. | ||
|
||
Parameters `limit` and `sort` SHOULD NOT be required and are implementation-specific. | ||
|
||
#### Sorting algorithms | ||
|
||
Algorithms are used for sorting results and MAY be passed in the request. Each service will offer different ones, here is a non-exhaustive list: | ||
|
||
- `globalPagerank`: Global Pagerank | ||
- `personalizedPagerank`: Personalized Pagerank | ||
- `graperank`: Graperank | ||
- `verifiedFollowers`: Followers with a minimum rank (uses `personalizedPagerank` if source is provided or otherwise `globalPagerank`) | ||
- `distance`: Number of hops in the graph between source and target | ||
|
||
# Output | ||
|
||
The response MUST be a standard DVM response including the corresponding `e` and `p` tags. | ||
|
||
Its `content` field MUST return a JSON-stringified array of objects formatted as: | ||
|
||
| Properties | Types | Description | | ||
|-----|-----|-----| | ||
| {`recommended`, `rank`} | {string, float} | Recommendation along with its rank | | ||
|
||
Pubkeys SHOULD be in hex format. | ||
|
||
Services MAY return objects in descending rank order for client convenience. | ||
|
||
# How clients can use this | ||
|
||
Offering users recommendations on accounts they may want to follow. | ||
|
||
# Example | ||
|
||
```json | ||
{ | ||
"id": "588d828025eab6404ed17c6c7a70d09a67c5da4ffe780e2f943f32509fe8af23", | ||
"pubkey": "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", | ||
"created_at": 1732759754, | ||
"kind": 5313, | ||
"tags": [], | ||
"content": "", | ||
"sig": "e0174ad1416e0d722f06491909fe8e4781fd732c21df6424cf0f1dc422db53ba525d544a29927297f63543796750ed7abf5e3c10c0e40e72b8c916b9a751c078" | ||
} | ||
``` | ||
|
||
```json | ||
{ | ||
"id": "171a0a7551c785ab0e2ac99577bfc25dd4fe7c28a19cacfcb625b4be2964ea4a", | ||
"pubkey": "a9b008476119ea693cbd2f0b4de99fd346e2e30880b18d42234a1158bd323783", | ||
"created_at": 1732759756, | ||
"kind": 6313, | ||
"tags": [ | ||
[ | ||
"e", | ||
"588d828025eab6404ed17c6c7a70d09a67c5da4ffe780e2f943f32509fe8af23" | ||
], | ||
[ | ||
"p", | ||
"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" | ||
] | ||
], | ||
"content": "[{\"recommended\":\"bd0c0615960ff21214aee7f5b06fa0a104585938c8eb4b5cd4e2b109041fdf62\",\"rank\":0.0025},{\"recommended\":\"d05ab982e1105476ab68e4c6728d148f8e6222154e60cc359ef6b8599c820bea\",\"rank\":0.00163},{\"recommended\":\"6efd1b46b3e6d1ec2447af7c905827bc83e1330bee2c3a6a5b8e0769734785e2\",\"rank\":0.00154},{\"recommended\":\"bb17f1e4e516e75e82a5b5e81c0120ffeb24e9e92866962440b9888ae82e42a1\",\"rank\":0.00111},{\"recommended\":\"5097f9b8bd3ebb3c240a6a0c95bdf24d22a10211181f90ba29c41c31c889ba0a\",\"rank\":0.000107}]", | ||
"sig": "c79f34b9f5603b242e00f0b04782d579ffcec2cb45e511fbbf1ba3e04d5297f7eb7a071433b0a14300fbd766feaf5e8e1f6fbd216ae1cce1cb400f987fc2d0d2" | ||
} | ||
``` | ||
|
||
Formatted `content` JSON: | ||
|
||
```json | ||
[ | ||
{ | ||
"recommended": "bd0c0615960ff21214aee7f5b06fa0a104585938c8eb4b5cd4e2b109041fdf62", | ||
"rank": 0.0025 | ||
}, | ||
{ | ||
"recommended": "d05ab982e1105476ab68e4c6728d148f8e6222154e60cc359ef6b8599c820bea", | ||
"rank": 0.00163 | ||
}, | ||
{ | ||
"recommended": "6efd1b46b3e6d1ec2447af7c905827bc83e1330bee2c3a6a5b8e0769734785e2", | ||
"rank": 0.00154 | ||
}, | ||
{ | ||
"recommended": "bb17f1e4e516e75e82a5b5e81c0120ffeb24e9e92866962440b9888ae82e42a1", | ||
"rank": 0.00111 | ||
}, | ||
{ | ||
"recommended": "5097f9b8bd3ebb3c240a6a0c95bdf24d22a10211181f90ba29c41c31c889ba0a", | ||
"rank": 0.000107 | ||
} | ||
] | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these should be strings ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @pablof7z, thanks for the review. Real question: why use strings? It doesn't matter and we can change it no problem, but I'm curious to know why.
Also, since you are a prolific client developer, what do you think about these DVMs more on a higher level? What would make you consider integrating them into Highligher or Olas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pippellia-btc Pablo is right, these are nostr tags which should be strings