Skip to content

relaystr/dart_ndk

Repository files navigation

Build Status Coverage Pub License

Dart Nostr Development Kit

Getting started

Add the following to your pubspec.yaml file:

dependencies:
  dart_ndk: any

Usage

        RelayManager manager = RelayManager();

        await manager.connect();
        
        NostrRequest request = await manager.query(
          Filter(kinds: [Nip01Event.TEXT_NODE_KIND], authors: [pubKey]));
        await for (final event in request.stream) {
          print(event);
        }

Features (WIP) / what does dart_ndk do? (clear borders)

  • return nostr data based on filters (any kind).
  • automatically discover the best relays to satisfy the provided request (using gossip)
  • specify desired coverage on each request (e.g. x relays per pubkey)
  • publish nostr events to optimal relays or explicit relays
  • cache responses to save network bandwidth
  • stream directly from cache and network (if needed)
  • query and subscription, e.g., get data once; subscribe to data.
  • plugin cache interface, bring your own db or use included ones: inMemory, isarDb
  • plug in verifier interface, bring your own event verifier, or use included ones: bip340, amber, acinq
  • contact list support, you can convert nostr_event to contact_list
  • nip51 list support, you can convert nostr_event to nip51_list

not Included

  • ready to use feeds, you have to build them on your own @see examples
  • file upload
  • nip05 caching
  • create && manage keypairs. You have to provide them
  • threading, you can do this on your own if you move dart_ndk or only the event_verifier into its own thread
  • easy way to get latest contact(or any) list / stream
  • easy way to get metadata or publish your own
  • support for request overrides (you have to close and reopen requests)

Gossip/outbox model of relay discovery and connectivity

The simplest characterization of the gossip model is just this: reading the posts of people you follow from the relays that they wrote them to.

more details on https://mikedilger.com/gossip-model/

NIPs

common terminology

term explanation simmilar to
broadcastEvent push event to nostr network/relays postEvent, publishEvent
JIT Just In Time, e.g. as it happens -
query get data once and close the request get request
subscription stream of events as they come in stream of data