Nostr

Decentralized Nostr protocol integration via NIP-04 encrypted DMs with relay support and profile metadata publishing.

Nostr (Notes and Other Stuff Transmitted by Relays) is a minimalist, decentralized protocol for censorship-resistant social networking. OpenClaw's Nostr integration enables your AI agent to communicate via NIP-04 encrypted direct messages, relayed through the distributed Nostr network. There's no central server, no account registration, no company to trust — just cryptographic keypairs and relays. The plugin connects to one or more Nostr relays via WebSocket and listens for encrypted DMs addressed to the bot's public key (npub). Responses are encrypted with the sender's public key and published back through the relays. NIP-01 profile metadata publishing lets you set a name, avatar, about text, NIP-05 verification, and Lightning address for your bot's public identity. Setup is straightforward: generate a Nostr keypair, configure the private key in OpenClaw, optionally customize relay URLs, and start the gateway. The default relays (relay.damus.io and nos.lol) work out of the box. Access control follows the standard OpenClaw patterns — pairing (default), allowlist by npub, or open. This is currently an experimental, DM-only integration. No group chats, no media attachments, no reactions. NIP-04 encryption is the baseline (not the most modern Nostr encryption), with NIP-17 gift-wrapped DMs and NIP-44 versioned encryption planned for future releases. For Nostr-native users who want an AI assistant accessible from any Nostr client (Damus, Amethyst, Primal, etc.), this is the integration that brings OpenClaw into the decentralized web.

Tags: decentralized, privacy, encrypted, web3

Category: Decentralized

Use Cases

  • Censorship-resistant AI assistant accessible from any Nostr client
  • Decentralized personal AI bot for the Nostr community
  • Privacy-focused AI DMs without centralized servers
  • AI agent with a public Nostr identity (NIP-05 verified)
  • Testing ground for decentralized AI agent protocols
  • Lightning-tippable AI assistant (via lud16 profile field)

Tips

  • Use environment variables for the private key: export NOSTR_PRIVATE_KEY and reference with ${NOSTR_PRIVATE_KEY} in config
  • Add 2-3 relays for redundancy — relay.damus.io and nos.lol are solid defaults
  • Set a NIP-05 identifier in your profile for verified bot identity
  • Use a paid relay (like nostr.wine) for improved reliability and spam filtering
  • Test with a local relay first (strfry via Docker) before going live
  • Set profile metadata (name, about, picture) to make your bot discoverable and recognizable
  • Use 'openclaw channels add --channel nostr --private-key' for non-interactive setup
  • Monitor gateway logs for relay connection errors — they're the most common issue

Known Issues & Gotchas

  • Never commit your private key to version control — always use environment variables
  • Default relays (relay.damus.io, nos.lol) may have rate limits — add 2-3 relays for redundancy
  • Too many relays increase latency and message duplication — stick to 2-3 for best results
  • NIP-04 is the only encryption supported currently — NIP-17 gift-wrapped DMs are planned but not yet available
  • Duplicate responses from multiple relays are deduplicated by event ID — this is normal and handled automatically
  • Profile URLs must use https:// — http URLs are rejected
  • The bot's npub is derived from the private key — changing the key changes the bot's identity
  • No multi-account support — one private key per OpenClaw instance

Alternatives

  • Matrix
  • Signal
  • Tlon (Urbit)
  • IRC

Community Feedback

An AI assistant on Nostr that respects the protocol's ethos — no accounts, no central servers, just encrypted DMs through relays. This is what decentralized AI should look like.

— Nostr.com

OpenClaw's Nostr plugin is early but promising. Being able to DM an AI bot from Damus or Amethyst without any centralized service is pretty cool. Hoping for NIP-17 support soon.

— Reddit r/nostr

The Nostr integration is minimal but clean — exactly what you'd expect for an experimental decentralized channel. Profile metadata publishing via NIP-01 is a nice touch for bot identity.

— GitHub Discussions

Frequently Asked Questions

Is the Nostr plugin bundled with OpenClaw?

No. Nostr is an optional plugin: openclaw plugins install @openclaw/nostr. It's not included in the core package and is disabled by default.

What Nostr clients work with the OpenClaw bot?

Any Nostr client that supports NIP-04 DMs: Damus (iOS), Amethyst (Android), Primal (web/mobile), Coracle, Snort, and more. The bot appears as a standard Nostr identity that you can DM.

Is NIP-04 encryption secure?

NIP-04 provides basic encryption for DMs but has known limitations (metadata leakage, no forward secrecy). NIP-17 (gift-wrapped DMs) and NIP-44 (versioned encryption) are planned improvements that address these issues. For now, NIP-04 is the standard used by most Nostr clients.

Can I use a local relay for testing?

Yes. Run a local relay like strfry via Docker (docker run -p 7777:7777 ghcr.io/hoytech/strfry) and set relays to ["ws://localhost:7777"]. Great for development without hitting public relays.

Why am I getting duplicate responses?

This is normal when using multiple relays — the same message may arrive from different relays. OpenClaw deduplicates by event ID, so only the first delivery triggers a response. If you're still seeing duplicates, check your relay configuration.

Does Nostr support group chats or channels?

Not in the current OpenClaw integration. Only NIP-04 encrypted DMs are supported. Group chat support may come with future NIP implementations.

Configuration Examples

Basic DM bot

channels:
  nostr:
    privateKey: "${NOSTR_PRIVATE_KEY}"
    dmPolicy: pairing

Custom relays with profile

channels:
  nostr:
    privateKey: "${NOSTR_PRIVATE_KEY}"
    relays:
      - "wss://relay.damus.io"
      - "wss://relay.primal.net"
      - "wss://nostr.wine"
    profile:
      name: "mybot"
      displayName: "My AI Bot"
      about: "AI assistant powered by OpenClaw"
      picture: "https://example.com/avatar.png"
      nip05: "mybot@example.com"
      lud16: "mybot@getalby.com"
    dmPolicy: pairing

Allowlist with specific npubs

channels:
  nostr:
    privateKey: "${NOSTR_PRIVATE_KEY}"
    dmPolicy: allowlist
    allowFrom:
      - "npub1abc..."
      - "npub1xyz..."

Installation

openclaw plugins install @openclaw/nostr