OpenClaw Nostr Channel
Connect OpenClaw to the Nostr decentralized network via an optional plugin. This integration enables your AI assistant to receive and respond to NIP-04 encrypted direct messages across any Nostr relay — no centralized servers, no accounts to register, just a cryptographic keypair and a relay connection. Ideal for privacy-focused deployments where censorship resistance and self-sovereignty matter.
Nostr Supported Features
Text Messages
Supported
Media & Files
Not Supported
Reactions
Supported
Threads
Not Supported
Voice Messages
Not Supported
Group Chat
Not Supported
Nostr Prerequisites
- OpenClaw Gateway installed and running
- A Nostr keypair (private key in nsec or hex format) — generate with 'nak key generate'
- At least one Nostr relay accessible via WebSocket (e.g., wss://relay.damus.io)
- Node.js 18+ installed on your server
Nostr Quick Setup
Install the Nostr plugin
Run 'openclaw plugins install @openclaw/nostr' to add the Nostr channel. Alternatively, use 'openclaw onboard' or 'openclaw channels add' and select Nostr from the plugin list. Restart the Gateway after installation.
Generate a keypair and configure
Generate a Nostr keypair using 'nak key generate'. Set the private key as an environment variable (export NOSTR_PRIVATE_KEY="nsec1...") and reference it in your openclaw.json configuration using ${NOSTR_PRIVATE_KEY}.
Start and send a test DM
Restart the Gateway with 'openclaw start'. Find your bot's public key (npub) in the startup logs. Open any Nostr client (e.g., Damus, Amethyst, Primal), and send an encrypted DM to the bot's npub. If using the default pairing policy, approve the sender via the CLI.
Nostr Configuration Example
{
"channels": {
"nostr": {
"privateKey": "${NOSTR_PRIVATE_KEY}",
"relays": [
"wss://relay.damus.io",
"wss://nos.lol"
],
"dmPolicy": "pairing"
}
}
}
Nostr Deep Dive
Architecture Overview
Plugin Installation
Key Generation & Management
{
"channels": {
"nostr": {
"privateKey": "${NOSTR_PRIVATE_KEY}"
}
}
}
Relay Configuration
{
"channels": {
"nostr": {
"relays": [
"wss://relay.damus.io",
"wss://nos.lol",
"wss://relay.nostr.band"
]
}
}
}
DM Policies
{
"channels": {
"nostr": {
"dmPolicy": "allowlist",
"allowFrom": [
"npub1abc...xyz",
"npub1def...uvw"
]
}
}
}
Profile Metadata (NIP-01)
{
"channels": {
"nostr": {
"profile": {
"name": "openclaw-bot",
"display_name": "OpenClaw AI Assistant",
"about": "AI-powered assistant on Nostr. DM me!",
"picture": "https://example.com/bot-avatar.png",
"nip05": "bot@yourdomain.com"
}
}
}
}
Encryption & Protocol Support
Testing with a Local Relay
{
"channels": {
"nostr": {
"relays": ["ws://localhost:7777"],
"dmPolicy": "open",
"allowFrom": ["*"]
}
}
}
Nostr Configuration Reference
| Key | Type | Default | Description |
|---|---|---|---|
| privateKey | string | (required) | Nostr private key in nsec (Bech32) or 64-character hex format. Use an environment variable reference. |
| relays | string[] | ["wss://relay.damus.io", "wss://nos.lol"] | List of Nostr relay WebSocket URLs to connect to |
| dmPolicy | string | "pairing" | DM access control policy: 'pairing', 'allowlist', 'open', or 'disabled' |
| allowFrom | string[] | [] | Public keys (npub or hex) allowed to message the bot (when dmPolicy is 'allowlist') |
| enabled | boolean | true | Enable or disable the Nostr channel |
| name | string | "" | Display name for this channel instance |
| profile.name | string | "" | Bot username published as NIP-01 metadata |
| profile.display_name | string | "" | Full display name published as NIP-01 metadata |
| profile.about | string | "" | Bot biography / description published as NIP-01 metadata |
| profile.picture | string | "" | Avatar image URL (HTTPS required) published as NIP-01 metadata |
| profile.banner | string | "" | Banner image URL (HTTPS required) published as NIP-01 metadata |
| profile.website | string | "" | Website URL published as NIP-01 metadata |
| profile.nip05 | string | "" | NIP-05 verification identifier (e.g., 'bot@yourdomain.com') |
| profile.lud16 | string | "" | Lightning address for receiving zaps |
Nostr private key in nsec (Bech32) or 64-character hex format. Use an environment variable reference.
List of Nostr relay WebSocket URLs to connect to
DM access control policy: 'pairing', 'allowlist', 'open', or 'disabled'
Public keys (npub or hex) allowed to message the bot (when dmPolicy is 'allowlist')
Enable or disable the Nostr channel
Display name for this channel instance
Bot username published as NIP-01 metadata
Full display name published as NIP-01 metadata
Bot biography / description published as NIP-01 metadata
Avatar image URL (HTTPS required) published as NIP-01 metadata
Banner image URL (HTTPS required) published as NIP-01 metadata
Website URL published as NIP-01 metadata
NIP-05 verification identifier (e.g., 'bot@yourdomain.com')
Lightning address for receiving zaps
Nostr Frequently Asked Questions
Nostr Troubleshooting
The relay connection may have failed, or the sender is publishing to different relays than the bot is subscribed to.
The private key is not in a valid nsec (Bech32) or 64-character hex format, or the environment variable is not set.
The bot's configured relays and the recipient's client relays do not overlap, so events cannot propagate.
The Gateway was not restarted after plugin installation, or the installation failed silently.