Subscriptions are made on nostrdb, and the same subs are made on remote relays. The only thing the network code does is call ndb_process_event, this feeds the notes to a multithreaded ingester that can de-dupe without even parsing the entire json blob so it’s crazy fast. When ingesting it verifies signatures, collects like stats, indexes and parses contents, stores in a compact binary format, parses profiles into flatbuffers, etc. Once it’s done processing it lets the local subscriptions know if they are looking for it.

So client code only ever talks to the local relay (nostrdb), and the UI code doesn’t have to do any processing. Everything is there once its ready.

Reply to this note

Please Login to reply.

Discussion

damn, I love how much you sucked into nostrdb to keep the client code simple and consistent.

nostrdb fixes this™️

A lot of this would have been duplicate could I would have had to write in different clients, so it made sense to just put it all in one library and make it stupid fast.

The Rust bindings are also coming together and are way nicer to use than the C api, so this will likely become the standard way to use it for most projects.

I want go bindings badly but haven’t put in the work to make it happen.