Nostr
Nostr (Notes and Other Stuff Transmitted by Relays) is a decentralized social protocol that’s grown quickly as a censorship-resistant alternative to Twitter/X. It has no central server, no company, no content moderation beyond what individual relays choose to enforce. AI Butler’s Nostr adapter lets you receive and send NIP-04 encrypted direct messages, making it the first self-hosted AI agent on Nostr that you own end-to-end.
What You Get
Section titled “What You Get”- Receive NIP-04 encrypted DMs from any Nostr user
- Reply with encrypted messages via your relay set
- Multi-relay fan-out (publish to 3+ relays for reliability)
- No rate limits imposed by a single company
- Works with any Nostr client (Damus, Amethyst, Iris, Nostrudel, etc.)
1. Generate or import a Nostr key pair
Section titled “1. Generate or import a Nostr key pair”If you don’t already have a Nostr identity:
# Use any Nostr client or CLI tool. For example, with noscl:noscl key-gen# Saves to ~/.config/noscl/config.jsonOr copy your existing nsec (secret key) and npub (public key) from your Nostr client. Butler uses your nsec to sign outgoing messages and decrypt incoming DMs.
2. Pick your relay set
Section titled “2. Pick your relay set”Nostr is only as reliable as the relays you use. Popular public relays:
wss://relay.damus.iowss://nos.lolwss://relay.nostr.bandwss://nostr.wine(paid, higher reliability)wss://relay.primal.net
Recommendation: start with 3–5 relays. The adapter publishes to all of them in parallel and reads DMs from the union.
3. Store Credentials
Section titled “3. Store Credentials”aibutler vault set nostr_nsec nsec1...your_secret_keyThis is your signing key — treat it like a password. Anyone with your nsec can impersonate you on Nostr. The vault stores it encrypted at rest in your OS keyring.
4. Enable the Channel
Section titled “4. Enable the Channel”configurations: channels: active: - nostr nostr: relays: - wss://relay.damus.io - wss://nos.lol - wss://relay.nostr.band - wss://relay.primal.net reconnect_interval: 30s5. Restart
Section titled “5. Restart”aibutler runYou should see log lines like:
nostr: connected to wss://relay.damus.ionostr: connected to wss://nos.lolnostr: subscribed to NIP-04 DMs for <your npub>nostr: 4/4 relays connected6. Test it
Section titled “6. Test it”From any Nostr client:
- Find the bot’s
npub(Butler prints it at startup, or runaibutler auth list) - Send it an encrypted DM
- Butler decrypts, processes through the agent, and replies with an encrypted response to the same thread
Features
Section titled “Features”| Feature | Supported |
|---|---|
| NIP-04 encrypted DMs (receive) | Yes |
| NIP-04 encrypted DMs (send) | Yes |
| Multi-relay publish | Yes (fan-out to all configured relays) |
| Public notes (kind 1) | No — Butler is DM-only for privacy |
| NIP-17 private DMs (newer spec) | v0.2 roadmap |
| Reactions / zaps | No |
| Media attachments (NIP-94) | No in v0.1 — text only |
Why DM-only?
Section titled “Why DM-only?”AI Butler on Nostr is intentionally limited to direct messages, not public kind-1 notes, for two reasons:
- Privacy — DMs are end-to-end encrypted (NIP-04), so only you and Butler can read them. Public notes are broadcast in plaintext.
- Trust model — a public AI bot that posts on Nostr would be fair game for prompt injection attacks from anyone who can reach the bot’s inbox. DM-only limits the attack surface to people who actively initiate the conversation.
If you want to publish public notes from Butler, write a plugin or subprocess bridge that explicitly calls the Nostr publish flow with clear capability gating.
Troubleshooting
Section titled “Troubleshooting”“0/N relays connected”. Check that the relay URLs are valid WebSocket URLs (wss://, not https://), and that your network allows outbound WebSocket connections.
Messages received but no reply. Check the outbound publish result in logs. Some relays require proof-of-work (NIP-13), paid membership, or authentication (NIP-42) — the adapter doesn’t yet support all three. Stick to permissive public relays for v0.1.
Decryption fails on incoming DMs. NIP-04 encryption is strict about key formatting. Make sure the nsec in your vault is the canonical bech32-encoded format (starts with nsec1...), not a hex-encoded secret.