Oddbean new post about | logout
 Imagine if any developer could easily create different types of trending algorithms that are immediately available to all nostr apps.

And now imagine if users could freely choose which algorithms they want to use to discover new content. Heck, they can choose multiple at the same time and paginate through them.

That's what Data Vending Machines enables:

many-to-many, clients<>algorithms

For example, this is what "Suggested Content" looks like in the upcoming Highlighter.

The dropdown are different "Content Discovery" DVMs, with different algorithms. 

https://image.nostr.build/1f059d3eb73d7b7b9aea799a7f89ee5ef0a7f80d47c7b18acda3d31668cc92ad.png 
 Where do I have to look on how to build my own? 
 I made a very simple skeleton repo that makes creating a new DVM trivial, all you need to do is write the algorithm you want to implement

Even cooler, you can run multiple DVMs with different algorithms in the same process with segregated pubkeys:, e.g.

* one DVM for content discovery where it only looks at the requester's follows activity
* another for extended network
* another for the user's relays' activity
* another one that only returns notes with images
etc, etc, etc

I open sourced this here

https://github.com/pablof7z/dvm-references 
 Thank you! Will have a look! 
 I'm planning on recording a livestream building one; probably this week if I find the time 
 This would be awesome. Just came across your explanation of DVMs in nostrovia as replacement for APIs and now it makes sense 
 after thinking a lot about DVMs I registered the domain endpointlessly.com; not sure what to do with it yet but it felt right

No more endpoints.

Protocols & many-to-many. 
 That’s a violation. Your’e on domain probation for the next 48 days. 
 THIS! I have been so confused and trying to figure out how you'd write a DVM. This is very, very helpful!

I hope that one day it could be simplified to a flat API like

import dvm from "...";
dvm.create({
  key: privkey, title: "...", desc: "...", relays: []/*, ...*/
}).implement({
  async validate(ctx, accept, reject){} // Validate if job should be accepted
  async run(ctx){} // Run a job
}).start(); 
 that skeleton is not far off. I.e. this is a DVM that provides the results of nostr.wine's trending results as a DVM

Basically replace the GET to nostr.wine for an algorithm you come up with and you're done 😉

https://cdn.satellite.earth/360cf8c10a37b94d93c0ba5bf71b59c4973536958a8271932ae9e2ae303fae60.png 
 Decentralize the algo! 
 nostr:note1knjrgesya6kau6e5tulpqwfkfuy5gx4wm854lwmz58tj6jhcvsksq3krgv 

Pablo, thank you!I am trying highlighter now.
Learning to use it, paso a paso ...