NDK v1.0 Released: OutBox Model

NDK is a nostr development kit that makes the experience of building Nostr-related applications, whether they are relays, clients, or anything in between, better, more reliable and overall nicer to work with.

NDK v1.0 Released: OutBox Model
  • "When I set out to write NDK my main goal was implementing the gossip protocol, now known as *outbox model*. I wanted nostr applications to have decentralizing tendencies by *default*; transparent to the developer," wrote PABLOF7z.
  • "After a few failed attempts, it's finally here, which, paired with a bunch of non-backward compatible changes, prompts me to do a major version bump."
"In short, the outbox model allows nostr to fragment, instead of everybody coalescing around a few popular relay and using things like Blastr. Nostr simply doesn't work without the outbox model."
  • "Outbox model comes disabled by default *for now*, as soon as I test it more thoroughly it will be the default."
  • "The outbox model will largely be transparent to you and will work on the background once you enable it."

What's new

  • Outbox model support;
  • `fetchEvent(s)` is now faster, (particularly with queries using exclusively `ids` filters);
  • Fixed unstable relay back-off code (credit goes to @NVK for the valuable testing infrastructure);
  • Defaults to blacklisting wss://brb.io #censorship (credit goes to @NVK for the widely hinted-at dead relay);
  • Subscription aggregation now works when multiple filters run at the same time;
  • Subscriptions that should close when EOSEd are now closed when each individual relay EOSEs instead of waiting for all of them to EOSE;
  • A better algorithm on when to signal a subscription's EOSE. The margin that NDK now gives to relays to EOSE is now a function of how many of the connected relays in the relay set have EOSEd (accounting for relays that are still sending events);
  • "There are *many* more changes that I needed to do to accommodate for this that I don't remember now."

Some of the most glaring breaking changes

  • ndk.subscribe` now defaults to keeping the subscription alive; the default of closing subscriptions on EOSE was bothering me;
  • NDKUser changes the `hexpubkey` from a function to a getter, so wherever you were using `user.hexpubkey()` needs to change to `user.hexpubkey`.

Announcement / Archive
GitHub Repo