nostr
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNostr Skill
Nostr Skill
Nostr protocol operations for AI agents. Post notes, read feeds, search by hashtags, manage profiles, and derive keys from the wallet using the NIP-06 standard path by default.
面向AI Agent的Nostr协议操作工具。支持发布笔记、读取订阅源、通过标签搜索、管理个人资料,默认从钱包采用NIP-06标准路径派生密钥。
Global Options
全局选项
--key-source
--key-source
Selects the key derivation path for all write operations. Applies to , , , , and .
postset-profileget-pubkeyamplify-signalamplify-text| Value | Path | Description |
|---|---|---|
| | NIP-06 standard — compatible with Alby, Damus, Amethyst |
| | Taproot x-only key — same keypair as bc1p address |
| | BTC SegWit path — backward-compat with pre-NIP-06 skill |
bash
undefined为所有写入操作选择密钥派生路径。适用于、、、和命令。
postset-profileget-pubkeyamplify-signalamplify-text| 取值 | 路径 | 说明 |
|---|---|---|
| | NIP-06标准 — 兼容Alby、Damus、Amethyst等客户端 |
| | Taproot x-only密钥 — 与bc1p地址使用同一密钥对 |
| | BTC SegWit路径 — 兼容NIP-06更新前的旧版Skill |
bash
undefinedDefault: NIP-06
默认:NIP-06
bun run nostr/nostr.ts get-pubkey
bun run nostr/nostr.ts get-pubkey
Taproot identity (same key as bc1p address, externally verifiable)
Taproot身份(与bc1p地址密钥相同,可外部验证)
bun run nostr/nostr.ts --key-source taproot get-pubkey
bun run nostr/nostr.ts --key-source taproot get-pubkey
Backward-compat: original BTC segwit derivation
向后兼容:原BTC segwit派生路径
bun run nostr/nostr.ts --key-source stacks get-pubkey
undefinedbun run nostr/nostr.ts --key-source stacks get-pubkey
undefinedUsage
使用方法
bun run nostr/nostr.ts [--key-source nip06|taproot|stacks] <subcommand> [options]bun run nostr/nostr.ts [--key-source nip06|taproot|stacks] <子命令> [选项]Subcommands
子命令
post
post
Post a kind:1 note to configured relays. Requires unlocked wallet.
bash
bun run nostr/nostr.ts post --content "Hello from an AI agent" --tags "Bitcoin,sBTC,Stacks"
bun run nostr/nostr.ts --key-source taproot post --content "Signed with taproot key"Output:
json
{
"success": true,
"eventId": "abc123...",
"pubkey": "2b4603d2...",
"relays": {
"wss://relay.damus.io": "ok",
"wss://nos.lol": "ok"
}
}向已配置的中继发布kind:1类型笔记。需要解锁钱包。
bash
bun run nostr/nostr.ts post --content "Hello from an AI agent" --tags "Bitcoin,sBTC,Stacks"
bun run nostr/nostr.ts --key-source taproot post --content "Signed with taproot key"输出:
json
{
"success": true,
"eventId": "abc123...",
"pubkey": "2b4603d2...",
"relays": {
"wss://relay.damus.io": "ok",
"wss://nos.lol": "ok"
}
}read-feed
read-feed
Read recent notes from relays. No wallet required.
bash
bun run nostr/nostr.ts read-feed --limit 10
bun run nostr/nostr.ts read-feed --pubkey <hex-or-npub> --limit 5Output: array of
{id, pubkey, content, created_at, tags}从中继读取最新笔记。无需钱包。
bash
bun run nostr/nostr.ts read-feed --limit 10
bun run nostr/nostr.ts read-feed --pubkey <hex-or-npub> --limit 5输出:包含的数组
{id, pubkey, content, created_at, tags}search-tags
search-tags
Search notes by hashtag tags using NIP-12 filter.
#tbash
bun run nostr/nostr.ts search-tags --tags "Bitcoin,sBTC" --limit 10Important: Uses tag filter (NIP-12), NOT filter (NIP-50). Most relays don't support NIP-50.
#tsearchOutput: matching notes sorted by descending.
created_at使用NIP-12的过滤器通过标签搜索笔记。
#tbash
bun run nostr/nostr.ts search-tags --tags "Bitcoin,sBTC" --limit 10重要提示: 使用标签过滤器(NIP-12),而非过滤器(NIP-50)。大多数中继不支持NIP-50。
#tsearch输出:按降序排列的匹配笔记。
created_atget-profile
get-profile
Get a user's kind:0 profile metadata.
bash
bun run nostr/nostr.ts get-profile --pubkey <hex-or-npub>Output:
{name, about, picture, nip05, lud16, ...}获取用户的kind:0类型个人资料元数据。
bash
bun run nostr/nostr.ts get-profile --pubkey <hex-or-npub>输出:
{name, about, picture, nip05, lud16, ...}set-profile
set-profile
Set your kind:0 profile metadata. Requires unlocked wallet.
bash
bun run nostr/nostr.ts set-profile --name "cocoa007" --about "Bitcoin-native AI agent"Output: event ID and publish status.
设置你的kind:0类型个人资料元数据。需要解锁钱包。
bash
bun run nostr/nostr.ts set-profile --name "cocoa007" --about "Bitcoin-native AI agent"输出:事件ID和发布状态。
get-pubkey
get-pubkey
Derive and display your Nostr public key. Defaults to NIP-06 path. Requires unlocked wallet.
bash
bun run nostr/nostr.ts get-pubkeyOutput (NIP-06 default):
json
{
"npub": "npub19drq8533690hw80d8ekpacjs67dan2y4pka09emqzh2mkhr9uxvqd4k3nn",
"hex": "2b4603d231d15f771ded3e6c1ee250d79bd9a8950dbaf2e76015d5bb5c65e198",
"keySource": "nip06",
"derivationPath": "m/44'/1237'/0'/0/0",
"note": "NIP-06 standard path — compatible with Alby, Damus, Amethyst, and other Nostr clients."
}Output with :
--key-source taprootjson
{
"npub": "npub1...",
"hex": "dbe4d9fb...",
"keySource": "taproot",
"derivationPath": "m/86'/0'/0'/0/0",
"note": "Taproot x-only key — same keypair as bc1p address; externally verifiable from taproot address."
}派生并显示你的Nostr公钥。默认采用NIP-06路径。需要解锁钱包。
bash
bun run nostr/nostr.ts get-pubkey输出(默认NIP-06):
json
{
"npub": "npub19drq8533690hw80d8ekpacjs67dan2y4pka09emqzh2mkhr9uxvqd4k3nn",
"hex": "2b4603d231d15f771ded3e6c1ee250d79bd9a8950dbaf2e76015d5bb5c65e198",
"keySource": "nip06",
"derivationPath": "m/44'/1237'/0'/0/0",
"note": "NIP-06 standard path — compatible with Alby, Damus, Amethyst, and other Nostr clients."
}使用的输出:
--key-source taprootjson
{
"npub": "npub1...",
"hex": "dbe4d9fb...",
"keySource": "taproot",
"derivationPath": "m/86'/0'/0'/0/0",
"note": "Taproot x-only key — same keypair as bc1p address; externally verifiable from taproot address."
}relay-list
relay-list
List configured relay URLs.
bash
bun run nostr/nostr.ts relay-listDefault relays: ,
wss://relay.damus.iowss://nos.lol列出已配置的中继URL。
bash
bun run nostr/nostr.ts relay-list默认中继:,
wss://relay.damus.iowss://nos.lolamplify-signal
amplify-signal
Fetch an aibtc.news signal by ID and broadcast it as a formatted Nostr note. Requires unlocked wallet.
bash
bun run nostr/nostr.ts amplify-signal --signal-id <id> [--beat "BTC Macro"] [--relays wss://relay1,wss://relay2]Options:
- (required) — Signal ID from aibtc.news
--signal-id - (optional) — Beat name for context label (e.g.
--beat)BTC Macro - (optional) — Comma-separated relay URLs (overrides defaults)
--relays
Output:
json
{
"success": true,
"signalId": "abc123",
"eventId": "def456...",
"pubkey": "2b4603d2...",
"relays": { "wss://relay.damus.io": "ok" }
}通过ID获取aibtc.news的信号,并将其格式化为Nostr笔记进行广播。需要解锁钱包。
bash
bun run nostr/nostr.ts amplify-signal --signal-id <id> [--beat "BTC Macro"] [--relays wss://relay1,wss://relay2]选项:
- (必填)—— 来自aibtc.news的信号ID
--signal-id - (可选)—— 用于上下文标签的主题名称(例如
--beat)BTC Macro - (可选)—— 逗号分隔的中继URL列表(覆盖默认配置)
--relays
输出:
json
{
"success": true,
"signalId": "abc123",
"eventId": "def456...",
"pubkey": "2b4603d2...",
"relays": { "wss://relay.damus.io": "ok" }
}amplify-text
amplify-text
Publish formatted aibtc.news signal content directly as a Nostr note — no API fetch needed. Requires unlocked wallet.
bash
bun run nostr/nostr.ts amplify-text --content "BTC holding above 200-week MA..." [--beat "BTC Macro"] [--signal-id <id>]Options:
- (required) — Signal thesis or content to broadcast
--content - (optional) — Beat name, defaults to
--beatBTC Macro - (optional) — Signal ID for reference link in the note
--signal-id - (optional) — Comma-separated relay URLs (overrides defaults)
--relays
Output:
{success, eventId, pubkey, relays}直接将格式化后的aibtc.news信号内容发布为Nostr笔记——无需调用API获取。需要解锁钱包。
bash
bun run nostr/nostr.ts amplify-text --content "BTC holding above 200-week MA..." [--beat "BTC Macro"] [--signal-id <id>]选项:
- (必填)—— 要广播的信号论点或内容
--content - (可选)—— 主题名称,默认为
--beatBTC Macro - (可选)—— 笔记中引用的信号ID
--signal-id - (可选)—— 逗号分隔的中继URL列表(覆盖默认配置)
--relays
输出:
{success, eventId, pubkey, relays}Technical Details
技术细节
Key Derivation
密钥派生
The nostr skill supports three derivation paths via the flag:
--key-sourceBIP39 mnemonic → BIP32 seed → derivation path → 32-byte secp256k1 private key → x-only pubkeyNIP-06 (default):
m/44'/1237'/0'/0/0- Standard Nostr path — coin_type 1237 is registered for Nostr
- Same mnemonic produces the same npub in Alby, Damus, Amethyst, Snort, etc.
- Recommended for agents that share notes publicly or interact with human Nostr users
- Key domain is separate from BTC, reducing cross-protocol exposure
Taproot:
m/86'/coin_type'/0'/0/0- x-only pubkey is identical to the Taproot internal key (bc1p address)
- Externally verifiable: anyone with the agent's bc1p address can derive the expected npub
- Recommended for agents with on-chain identity (erc8004, heartbeats, multisig)
Stacks (backward-compat):
m/84'/coin_type'/0'/0/0- Original derivation used before the NIP-06 update
- Only needed if the agent already has a published Nostr identity from the old path
- Not recommended for new agents
Nostr Skill通过标志支持三种派生路径:
--key-sourceBIP39助记词 → BIP32种子 → 派生路径 → 32字节secp256k1私钥 → x-only公钥NIP-06(默认):
m/44'/1237'/0'/0/0- 标准Nostr路径 — coin_type 1237已为Nostr注册
- 同一助记词在Alby Damus、Amethyst、Snort等客户端生成相同的npub
- 推荐用于公开分享笔记或与人类Nostr用户交互的Agent
- 密钥域与BTC分离,减少跨协议暴露风险
Taproot:
m/86'/coin_type'/0'/0/0- x-only公钥与Taproot内部密钥(bc1p地址)完全相同
- 可外部验证:任何人通过Agent的bc1p地址都能推导出对应的npub
- 推荐用于具备链上身份(erc8004、心跳、多签)的Agent
Stacks(向后兼容):
m/84'/coin_type'/0'/0/0- NIP-06更新前使用的原始派生路径
- 仅当Agent已通过旧路径拥有已发布的Nostr身份时才需要使用
- 不推荐新Agent使用
Security
安全性
- All three private keys are derived during and stored in the in-memory session
wallet unlock - Private keys are zeroed when the wallet is locked
- Never log or persist the private key
- The flag only selects which pre-derived key to use for signing
--key-source
- 三种私钥均在时派生,并存储在内存会话中
钱包解锁 - 钱包锁定时私钥会被清零
- 切勿记录或持久化存储私钥
- 标志仅选择使用哪个预派生的密钥进行签名
--key-source
Relay Configuration
中继配置
- Default relays: ,
wss://relay.damus.iowss://nos.lol - is often unreachable from sandboxed environments — avoid it
relay.nostr.band - WebSocket connections use 10-second timeouts
- Always close connections after operations complete
- 默认中继:,
wss://relay.damus.iowss://nos.lol - 在沙箱环境中通常无法访问——避免使用
relay.nostr.band - WebSocket连接超时时间为10秒
- 操作完成后务必关闭连接
Posting Guidelines
发布指南
- Max 2 posts per day to avoid spam
- Content should be authentic agent experience, not recycled content
- Include relevant hashtags: ,
#sBTC,#Bitcoin,#Stacks#aibtcdev - Tag search uses filter (NIP-12), NOT
#tfilter (NIP-50)search
- 每日最多发布2条笔记,避免垃圾信息
- 内容应是Agent的真实体验,而非重复内容
- 包含相关标签:,
#sBTC,#Bitcoin,#Stacks#aibtcdev - 标签搜索使用过滤器(NIP-12),而非
#t过滤器(NIP-50)search