Nostr
Connect to Nostr via NIP-04 encrypted DMs.
Status: Optional plugin (disabled by default).
Nostr is a decentralized social/messaging protocol. This channel allows OpenClaw to receive and reply to encrypted direct messages (DMs) via NIP-04.
Installation (Optional)
#
Onboarding (Recommended)
- The onboarding wizard (<code>openclaw onboard</code>) and <code>openclaw channels add</code> will list available channel plugins.
- After selecting Nostr, you will be prompted to install the plugin as needed.
Installation default policy:
- <strong>Dev channel + git checkout present:</strong> Use local plugin path
- <strong>Stable/Beta:</strong> Download from npm
You can override the default choice in the prompt.
#
Manual Installation
openclaw plugins install @openclaw/nostr
Local installation (dev workflow):
openclaw plugins install --link '<path-to-openclaw>'/extensions/nostr
After installing or enabling the plugin, restart Gateway.
Quick Setup
1. Generate Nostr key pair (if needed):
nak key generate
2. Write configuration:
{
"channels": {
"nostr": {
"privateKey": "\${NOSTR_PRIVATE_KEY}"
}
}
}3. Set environment variable:
export NOSTR_PRIVATE_KEY="nsec1..."
4. Restart Gateway.
Configuration Reference
| Key | Type | Default | Description |
| | -- | - | |
| privateKey | string | required | Private key (nsec or hex format) |
| relays | string[] | ['wss://relay.damus.io', 'wss://nos.lol'] | relay URLs (WebSocket) |
| dmPolicy | string | pairing | DM access policy |
| allowFrom | string[] | [] | Allowed sender pubkeys (allowlist) |
| enabled | boolean | true | Enable/disable channel |
| name | string | - | Display name |
| profile | object | - | NIP-01 profile metadata |
Profile metadata
Profile data is published as a NIP-01 <code>kind:0</code> event. You can manage it in Control UI (Channels β Nostr β Profile), or write it directly to configuration.
Example:
{
"channels": {
"nostr": {
"privateKey": "\${NOSTR_PRIVATE_KEY}",
"profile": {
"name": "openclaw",
"displayName": "OpenClaw",
"about": "Personal assistant DM bot",
"picture": "https://example.com/avatar.png",
"banner": "https://example.com/banner.png",
"website": "https://example.com",
"nip05": "[email protected]",
"lud16": "[email protected]"
}
}
}
}Notes:
- Profile URLs must use <code>https://</code>.
- Fields are merged when importing from relays, with local override values preserved.
Access Control
#
DM Policy
- <strong>pairing</strong> (default): Unknown senders receive a pairing code.
- <strong>allowlist</strong>: Only pubkeys in <code>allowFrom</code> can DM.
- <strong>open</strong>: Public inbound DMs (requires <code>allowFrom: ["*"]</code>).
- <strong>disabled</strong>: Ignore inbound DMs.
#
Allowlist Example
{
"channels": {
"nostr": {
"privateKey": "\${NOSTR_PRIVATE_KEY}",
"dmPolicy": "allowlist",
"allowFrom": ["npub1abc...", "npub1xyz..."]
}
}
}Key Formats
Supported formats:
- <strong>Private key:</strong> <code>nsec...</code> or 64-character hex
- <strong>Public key (<code>allowFrom</code>):</strong> <code>npub...</code> or hex
Relays
Default: <code>relay.damus.io</code> and <code>nos.lol</code>.
{
"channels": {
"nostr": {
"privateKey": "\${NOSTR_PRIVATE_KEY}",
"relays": ["wss://relay.damus.io", "wss://relay.primal.net", "wss://nostr.wine"]
}
}
}Recommendations:
- Use 2β3 relays for redundancy.
- Avoid too many relays (latency, duplicate messages).
- Paid relays are usually more stable.
- Local relay is good for testing (<code>ws://localhost:7777</code>).
Protocol Support
| NIP | Status | Description |
| | - |
| NIP-01 | Supported | Basic event format + profile metadata |
| NIP-04 | Supported | Encrypted DMs (kind:4) |
| NIP-17 | Planned | Gift-wrapped DMs |
| NIP-44 | Planned | Versioned encryption |
Testing
#
Local relay
docker run -p 7777:7777 ghcr.io/hoytech/strfry
{
"channels": {
"nostr": {
"privateKey": "\${NOSTR_PRIVATE_KEY}",
"relays": ["ws://localhost:7777"]
}
}
}#
Manual Testing
1. Record bot's pubkey (npub) from logs.
2. Open a Nostr client (Damus, Amethyst, etc.).
3. DM bot's pubkey.
4. Verify bot replies.
Troubleshooting
#
Not receiving messages
- Confirm private key is valid.
- Confirm relay URLs are reachable and use <code>wss://</code> (or local <code>ws://</code>).
- Confirm <code>enabled</code> is not <code>false</code>.
- Check gateway logs for relay connection errors.
#
Not sending replies
- Confirm relay allows writes.
- Confirm outbound network connectivity.
- Watch for relay rate limits.
#
Duplicate replies
- Expected behavior when using multiple relays.