OpenClawSkills
GitHub
Channels β€’ TutorialHeader.readTime

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.

Tutorial.step

Installation (Optional)

#

Tutorial.step

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.

#

Tutorial.step

Manual Installation

Bash
openclaw plugins install @openclaw/nostr

Local installation (dev workflow):

Bash
openclaw plugins install --link '<path-to-openclaw>'/extensions/nostr

After installing or enabling the plugin, restart Gateway.

Tutorial.step

Quick Setup

1. Generate Nostr key pair (if needed):

Bash
nak key generate

2. Write configuration:

Json
{
  "channels": {
    "nostr": {
      "privateKey": "\${NOSTR_PRIVATE_KEY}"
    }
  }
}

3. Set environment variable:

Bash
export NOSTR_PRIVATE_KEY="nsec1..."

4. Restart Gateway.

Tutorial.step

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 |

Tutorial.step

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:

Json
{
  "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.

Tutorial.step

Access Control

#

Tutorial.step

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: [&quot;*&quot;]</code>).

- <strong>disabled</strong>: Ignore inbound DMs.

#

Tutorial.step

Allowlist Example

Json
{
  "channels": {
    "nostr": {
      "privateKey": "\${NOSTR_PRIVATE_KEY}",
      "dmPolicy": "allowlist",
      "allowFrom": ["npub1abc...", "npub1xyz..."]
    }
  }
}
Tutorial.step

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

Tutorial.step

Relays

Default: <code>relay.damus.io</code> and <code>nos.lol</code>.

Json
{
  "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>).

Tutorial.step

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 |

Tutorial.step

Testing

#

Tutorial.step

Local relay

Bash
docker run -p 7777:7777 ghcr.io/hoytech/strfry
Json
{
  "channels": {
    "nostr": {
      "privateKey": "\${NOSTR_PRIVATE_KEY}",
      "relays": ["ws://localhost:7777"]
    }
  }
}

#

Tutorial.step

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.

Tutorial.step

Troubleshooting

#

Tutorial.step

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.

#

Tutorial.step

Not sending replies

- Confirm relay allows writes.

- Confirm outbound network connectivity.

- Watch for relay rate limits.

#

Tutorial.step

Duplicate replies

- Expected behavior when using multiple relays.