What is Nostr?
Yuki Kishimoto
npub1drv…seet
2023-12-14 21:30:34
in reply to nevent1q…ky02

Yuki Kishimoto on Nostr: Yes, I'll take a look into it! In the past months I built `nostr-database`, with ...

Yes, I'll take a look into it!

In the past months I built `nostr-database`, with support to multiple backends: in-memory, SQLite, RocksDB and indexeddb (for web). It's based on in-memory indexes, to perform fast queries using an vector of `Filter`, like when querying relays.
It's fast but probably not reach the same performance of nostrdb.

NostrDatabase is a generic trait so should be possible to implement also the jb55 (npub1xts…kk5s)'s database, making it available in nostr-sdk.

https://github.com/rust-nostr/nostr/blob/master/crates%2Fnostr-database%2FREADME.md

Nostr SDK now support in-memory and persistent storages.

Currently are available the MemoryDatabase (RAM, by default store only the seen event ids but it's configurable to store the full events), RocksDB, SQLite and IndexedDB (for web apps).

It's possible to use custom database just implementing the NostrDatabase trait.

NostrDatabase trait provide some very generic methods, useful to improve the efficiency and performance of nostr apps, like: query events by filters, get user profile and get items for negentropy reconciliation.

If anyone is interested in testing new changes can find 2 examples in nostr-sdk crate (rocksdb.rs and sqlite.rs, more docs coming soon) and 1 example in nostr-indexeddb crate. Let me know if there are issues.


https://github.com/rust-nostr/nostr/blob/f20c77660691f895879ec523c234ee9cb3f68ea6/crates/nostr-database/src/lib.rs#L88

https://github.com/rust-nostr/nostr/tree/f20c77660691f895879ec523c234ee9cb3f68ea6/crates/nostr-indexeddb/examples/webapp

https://github.com/rust-nostr/nostr/blob/f20c77660691f895879ec523c234ee9cb3f68ea6/crates/nostr-sdk/examples/sqlite.rs
Author Public Key
npub1drvpzev3syqt0kjrls50050uzf25gehpz9vgdw08hvex7e0vgfeq0eseet