Thread

only took a couple months πŸ˜‘ but finally got profiles working in nostrdb. Damus now queries the local relay directly whenever it needs profile info. Its always up to date, has access to every profile its ever seen in realtime, and is as fast as accessing the profile from memory. No longer do clients need to have a separate in-memory cache for profiles, which *drastically* simplifies client code. The old profile database is buggy and is causing crashes on the current TestFlight build, so this will fix that and make profile loading a lot faster. Just a small update but a huge technical milestone for nostrdb. Again, thanks for your patience 😁. Damus is evolving into something new πŸ‘€

Replies (50)

You know what's the coolest part? Because almost all the #nostr clients are open source, whenever one of them implements a breakthrough improvement to their code, the rest can go right after and adopt that. So every progress in one of the clients is a progress for all of the #nostrland ecosystem! We are all winners if one of us gets ahead. πŸ’œ One for all, all for one 🀝🏻 View quoted note β†’
IndexedDB is slow as hell. Chrome implemented IndexedDB on top of LevelDB and Firefox on top of SQLite. Almost all fast-enough web clients cache events in JS memory instead of query from IndexedDB on every read. This is also why I intentionally do not implement storage layer for nostr.ts. Browser is not designed for local-first, client driven applications. If you implement NostrDB on top of IndexedDB, you effectively implemented it on top of SQLite/LevelDB which is exactly what you planned to avoid at the first place.
That could be a benefit if the client chooses to keep GBs of events in-memory. Blowater actually plans to "never" delete locally. Many web clients still don't treat on-device storage the main storage and query from relays everytime. I believe local-first approach is the only way to have decentralization product-wise and to have fast client tech-wise. Therefore, I like nostrdb's motivation a lot. But what will be nostrdb's query interface? Function calls? Query languages? Can it answer questions such as what's all my notes which have been replied within 2 hours of creation? I would love to see a nostr "database" that provides graph algorithm queries.
Right now it is just function calls (lookup profiles by pubkey, notes by id) but the plan is to full nostr query support. Then i will eventually remove all my websocket code from damus and talk to nostrdb directly, it will become a caching/multiplexing relay of sorts. Any data it doesn’t have it can use negentropy to fetch from strfry relays. This will all be transparent under the hood so clients won’t have to deal with the complexity.
i used to work in social media tech back in 2010ish. thinking of all the features good and bad (listening, NLP and other search models to find content, to find β€œintent” etc.) Having historical db of all nostr content can be helpful too. Build and view the decentralized free social graph.
The idea is to have an embeddable relay as fast a strfry in any native nostr app. It stores notes in a format that is equivalent to accessing the data in memory, so it’s already faster than most databases in that sense. The idea is that nostrdb will do all the heavy lifting: parsing, verifying, indexing, etc so clients can just be simple UIs and not have to think about protocol details or making crazy performance optimizations just go get a client up and running. Its just a database for now but i want it to handle networking and relay code eventually as well. A native nostr devkit.