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 (80)

This guide by @walker explains it really well: https://www.btctimes.com/news/what-is-nostr-how-does-it-work-why-does-it-matter From the article: Can I send money on Nostr? Anyone can send money on Nostr using the power of the Bitcoin Lightning Network. You can send Lightning invoices directly on Nostr by simply generating an invoice and pasting it into a note. On clients like Damus, the invoice text automatically changes into a nice little pay button. Download a wallet (like Wallet of Satoshi), tap receive, add a custom amount, and paste the URL into Damus. Jack might even pay your invoice… To add the lightning bolt tips icon to your profile: go to Wallet of Satoshi, tap "Receive," tap the "Lightning Address" button and tap the QR code to copy your LNURL. Then on Damus, tap "Edit" on your profile and paste your copied LNURL address into the "BITCOIN LIGHTNING TIPS" section, then save. ---written by @walker
**William Casarin:** Hey Satoshi, I've been thinking about the potential of integrating social media on the Bitcoin blockchain. What are your thoughts on this? **Satoshi:** Interesting idea, William. While Bitcoin is primarily designed for financial transactions, adding social media features would require significant changes. What's your vision for this? **William Casarin:** Well, I envision a decentralized social media platform where users can interact, share content, and even tip each other with Bitcoin. It could offer a censorship-resistant alternative to traditional platforms. **Satoshi:** That could be beneficial for free speech and privacy. But scalability and data storage might be issues. How do you plan to address those? **William Casarin:** Valid concerns. We could use second-layer solutions like Lightning Network for microtransactions and decentralized storage solutions like IPFS for media content. The blockchain itself would store essential data. **Satoshi:** That sounds promising. But maintaining the decentralized and trustless nature of Bitcoin is critical. How do you prevent spam and abuse on this platform? **William Casarin:** We could implement a proof-of-work mechanism for creating posts or transactions, similar to Bitcoin's mining process. This would require users to invest resources, making spam costly. **Satoshi:** Security and privacy are paramount. How do you plan to protect user data and identities? **William Casarin:** User data could be encrypted and stored off-chain, with keys held only by the users. As for identities, we could explore pseudonymous accounts, aligning with Bitcoin's principles. **Satoshi:** It's an ambitious idea, William. But it could diversify Bitcoin's utility beyond just a store of value. Remember, though, to maintain consensus and avoid contentious forks. **William Casarin:** Absolutely, Satoshi. Collaboration with the Bitcoin community and careful design will be key. It's an exciting challenge to tackle. **Satoshi:** Indeed, innovation is what keeps the crypto space evolving. I'm intrigued to see where this idea leads. #bitcoin #btc #damus #zap image
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.
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.