Nostr (Notes and Other Stuff Transmitted by Relays) is an open, decentralized social protocol. Unlike traditional centralized platforms, Nostr has no central server — messages are propagated through multiple relay nodes. OpenClaw supports the Nostr protocol through its plugin system, allowing your AI agent to interact with users on this decentralized network.
Nostr Protocol Basics
Before configuring, it helps to understand some fundamental Nostr concepts. Nostr uses public-key cryptography to identify users. Each user is identified by a key pair: a private key (nsec) for signing messages, and a public key (npub) for public identity. Messages (called Events) are forwarded through relay servers, and users can choose which relays to connect to.
For OpenClaw, your AI agent will have its own key pair and exist as an independent Nostr identity on the network.
Prerequisites
- An OpenClaw instance deployed and running
- A Nostr key pair (can be auto-generated by OpenClaw, or you can use an existing one)
- At least one reliable Nostr relay server address
Installing the Nostr Plugin
Install via the OpenClaw plugin system:
openclaw plugin install nostr
Configure using the interactive command:
openclaw channels login nostr
If you don't have a Nostr key pair yet, the plugin will ask whether to auto-generate one. After generation, make sure to securely back up the private key.
Configuring openclaw.json
Manual configuration example:
{
"channels": {
"nostr": {
"enabled": true,
"privateKey": "nsec1xxxxxxxxxxxxxxxxxx",
"relays": [
"wss://relay.damus.io",
"wss://relay.nostr.band",
"wss://nos.lol"
],
"respondToMentions": true,
"respondToDirectMessages": true
}
}
}
privateKey is your AI agent's Nostr private key, a bech32-encoded string starting with nsec. relays is the list of relay servers — configuring multiple relays is recommended to improve message delivery reliability.
Supported Message Types
The OpenClaw Nostr plugin supports the following interaction methods:
Encrypted Direct Messages (NIP-04/NIP-44): Users send encrypted direct messages to the AI agent via a Nostr client. The agent decrypts the message, processes it, and returns an encrypted reply. This is the most private interaction method. NIP-44 is a newer encryption standard that provides better security.
Public Mentions: When a user @mentions the AI agent's public key in a public note, the agent can reply with a public note. This approach is suitable for public Q&A scenarios.
Channel Messages (NIP-28): The Nostr protocol supports public channel functionality, and the AI agent can join specific channels and respond to messages within them.
Relay Selection Strategy
Relay selection directly affects the AI agent's reachability and response speed. Follow these guidelines:
Choose well-known and stable public relays as a foundation, such as relay.damus.io and relay.nostr.band. If your target user base primarily uses specific relays, add those to the list as well. Configuring too many relays is not recommended — three to five is usually sufficient, as too many actually increases connection management overhead.
If you operate your own relay server, you can set it as the primary relay to ensure reliable message delivery.
Identity Verification and Security
Since Nostr is an open protocol, anyone can send messages to your AI agent. To prevent abuse, it's recommended to configure an allowlist:
{
"channels": {
"nostr": {
"allowlist": [
"npub1xxxxxxxxxxxx",
"npub1yyyyyyyyyyyyyy"
]
}
}
}
Only users corresponding to the public keys in the list can interact with the AI agent. If no allowlist is set, all Nostr users can converse with the agent.
You can also use OpenClaw's DM pairing mechanism. Users must first send a pairing code via direct message, and only after verification will they gain full AI interaction access.
NIP-05 Identity Verification
Configuring NIP-05 identity verification for your AI agent adds credibility. NIP-05 allows associating a Nostr public key with an internet domain, similar to an SSL certificate for a traditional website. Simply place a .well-known/nostr.json file at the root of your domain containing the AI agent's public key mapping.
Multi-Channel Coexistence
The Nostr channel can run simultaneously with all other OpenClaw channels. Due to Nostr's decentralized nature, it's particularly suitable as a backup communication channel — when centralized platforms experience outages, users can still interact with the AI agent via Nostr.
Important Notes
Message delivery on the Nostr network is not as reliable as on centralized platforms. Messages may be delayed or lost due to relay downtime, network latency, or other reasons. In production environments, it's recommended to monitor relay connection status and configure reconnection strategies. The OpenClaw plugin has a built-in auto-reconnection mechanism that attempts to reconnect every 30 seconds after disconnection by default.