ndk 0.8.4-dev.11 copy "ndk: ^0.8.4-dev.11" to clipboard
ndk: ^0.8.4-dev.11 copied to clipboard

Nostr Development Kit - the most performant lib for all your nostr usecases

Dart Nostr Development Kit (NDK) #

Build Status Coverage Pub License

NDK (Nostr Development Kit) is a Dart library that enhances the Nostr development experience.
NDK supplies you with high-level usecases like lists or metadata while still allowing you to use low-level queries enhanced with inbox/outbox (gossip) by default.
Our Target is to make it easy to build constrained Nostr clients, particularly for mobile devices.

Apps using NDK #

➡️ Getting Started 🔗 #

Changelog 🔗 #


CLI #

NDK ships a CLI tool. Install it on Linux / macOS with a single command:

curl -fsSL https://raw.githubusercontent.com/relaystr/ndk/refs/heads/master/install.sh | bash

By default this installs the ndk binary to ~/.local/bin/ndk (user mode).

# system-wide install (/usr/bin/ndk), may require sudo
curl -fsSL https://raw.githubusercontent.com/relaystr/ndk/refs/heads/master/install.sh | bash -s -- --system

# pin a specific version
NDK_VERSION=v0.8.3 curl -fsSL https://raw.githubusercontent.com/relaystr/ndk/refs/heads/master/install.sh | bash

If ~/.local/bin is not in your PATH, add it to your shell profile:

export PATH="$PATH:$HOME/.local/bin"

Verify the installation with ndk --version. See releases for available versions.


Core Features #

Network & Data Management #

  • Automatic relay discovery using inbox/outbox (gossip) model for optimal relay selection
  • Flexible data fetching with query (one-time) and subscription (real-time) modes
  • Smart caching to reduce network bandwidth and improve performance
  • Concurrent event streaming from both cache and network
  • Request coverage control to specify desired relay coverage per request

Account & Authentication #

  • Multiple signer support: Built-in (BIP-340), NIP-55 external signers, NIP-07 (web), and NIP-46 (remote signing/bunkers)
  • Account management with state tracking and multiple account support
  • Relay authentication (NIP-42) for private relay access

High-Level Use Cases #

  • Metadata management: Query and update user profiles with automatic caching
  • Contact lists: Follow/unfollow users and manage contact lists
  • NIP-51 lists: Public and private relay sets, mute lists, and custom lists
  • Gift wrap (NIP-59): Encrypted, metadata-obscured messaging
  • Zaps (NIP-57): Lightning payments on Nostr
  • Nostr Wallet Connect (NIP-47): Integrate Lightning wallets
  • Domain verification (NIP-05): Verify and cache Nostr addresses
  • File management: Upload, download, and delete files using Blossom servers
  • Connectivity: Get notified about connection issues
  • Proof of Work (NIP-13): Create and verify PoW events

Developer Experience #

  • Pluggable architecture: Bring your own cache, verifier, or signer, replace any component
  • Multiple database options: In-memory, ObjectBox, Sembast
  • Event verification: BIP-340 or Rust-based (recommended for performance)
  • Comprehensive logging with configurable log levels and outputs
  • Clean architecture for maintainability and extensibility

Performance & Optimization #

  • Local caching of events to minimize network requests and improve responsiveness
  • Efficient event verification Rust-based verifier available for high throughput
  • Optimized relay selection using inbox/outbox model to reduce latency and improve reliability
  • Threading support for offloading heavy operations like json encoding, compute to separate threads (isolate pool).

not Included #

  • ready to use feeds, you have to build them on your own (🚫 not planned)
  • create && manage keypairs. You have to provide them (🚫 not planned)
  • support for request overrides (you have to close and reopen requests) (🚫 not planned)