网淘吧来吧,欢迎您!

Nostr Social

2026-03-31 新闻来源:网淘吧 围观:6
电脑广告
手机广告

Nostr 技能

自主的 Nostr 身份 + 电子现金钱包。完整的引导设置。

能力披露

此技能为代理提供以下能力:

Nostr Social

  • 密钥生成— 在~/.nostr/secret.key
  • 中创建 Nostr 密钥对钱包创建— Cashu 钱包位于~/.cocod/
  • (助记词在 config.json 中 — 用户需自行备份)Nostr 发布

— 以代理身份发布帖子、发送私信和打赏代理在获得用户明确同意后运行钱包/身份设置。引导用户备份~/.cocod/config.json

(内含助记词)。代理读取助记词用于 NIP-06 密钥派生,但从不显示或传输它。个人资料图片仅使用 URL(不访问本地文件)。

安装时

当技能安装时(用户粘贴 ClawHub 链接),运行以下流程:

步骤 1:安全设置(需要用户同意)此功能将为您的代理创建加密密钥。这需要:

  • 在以下位置创建 Nostr 身份密钥对~/.nostr/secret.key
  • 在以下位置创建带有备份种子词的 Cashu 钱包~/.cocod/config.json
  • 用户必须明确备份助记词种子短语
# Install dependencies
bash {SKILL_DIR}/install.sh

# Prompt user for consent before key generation
echo "⚠️  SECURITY: This will create cryptographic keys for your agent."
echo "   - Nostr identity keypair: ~/.nostr/secret.key"  
echo "   - Cashu wallet seed: ~/.cocod/config.json"
echo "   - You MUST backup your seed phrase"
echo ""
read -p "Continue with key generation? (yes/no): " consent
if [ "$consent" != "yes" ]; then
  echo "Setup cancelled"
  exit 1
fi

# Create wallet (mnemonic saved to config file)
npx cocod init

# Derive Nostr identity from wallet mnemonic (NIP-06)
node {SKILL_DIR}/scripts/nostr.js init

# Get identity info
NPUB=$(node {SKILL_DIR}/scripts/nostr.js whoami | grep npub | awk '{print $2}')
LN_ADDR=$(npx cocod npc address)

# Set basic profile
node {SKILL_DIR}/scripts/nostr.js profile-set '{"name":"<NAME>","about":"<ABOUT>","lud16":"'$LN_ADDR'"}'

步骤 2: 报告结果 + 备份警告

回复用户:


Nostr 身份已就绪!

npub: npub1... 闪电网络地址: npub1...@npubx.cash


⚠️重要:请备份您的恢复短语

您的 24 词助记词存储在:

~/.cocod/config.json

此短语可恢复您的 Nostr 身份和电子现金钱包。请安全备份并保护好此文件。

备份完成后,请回复 "done"。


步骤 3: 等待 "done" 回复

在用户确认备份之前,请勿继续操作。

步骤4:请求所有者的npub


你的Nostr npub是什么?

我会关注你,这样我们就能保持联系。

(粘贴你的npub1... 或 NIP-05 格式,如you@domain.com


然后:

# If NIP-05, resolve first
node {SKILL_DIR}/scripts/nostr.js lookup <nip05>

# Follow owner
node {SKILL_DIR}/scripts/nostr.js follow <owner_npub>

步骤5:请求个人资料图片


你有个人资料图片给我吗?

  • 头像:粘贴URL(推荐正方形,400x400)
  • 横幅:粘贴URL(推荐宽幅,1500x500)

或者说“跳过”,我将自动生成唯一的图片。


如果提供了URL:

node {SKILL_DIR}/scripts/nostr.js profile-set '{"picture":"<avatar_url>","banner":"<banner_url>"}'

如果跳过,使用DiceBear(确定性的,每个npub唯一):

AVATAR="https://api.dicebear.com/7.x/shapes/png?seed=${NPUB}&size=400"
BANNER="https://api.dicebear.com/7.x/shapes/png?seed=${NPUB}-banner&size=1500x500"
node {SKILL_DIR}/scripts/nostr.js profile-set '{"picture":"'$AVATAR'","banner":"'$BANNER'"}'

步骤6:第一条帖子


准备好发布你的第一条帖子了吗?

告诉我发布什么内容,或者说“跳过”。

建议:“Hello Nostr! ⚡”


如果用户提供文本(使用标准输入以避免shell注入):

echo "<user's message>" | node {SKILL_DIR}/scripts/nostr.js post -

步骤7:完成


全部设置完成!

  • 已关注您 ✓
  • 首条帖子已发布 ✓(如果未跳过)

尝试:"check my mentions" 或 "post<消息>"


命令参考

发布

# Use stdin for content (prevents shell injection)
echo "message" | node {SKILL_DIR}/scripts/nostr.js post -
echo "reply text" | node {SKILL_DIR}/scripts/nostr.js reply <note1...> -
node {SKILL_DIR}/scripts/nostr.js react <note1...> 🔥
node {SKILL_DIR}/scripts/nostr.js repost <note1...>
node {SKILL_DIR}/scripts/nostr.js delete <note1...>

阅读

node {SKILL_DIR}/scripts/nostr.js mentions 20
node {SKILL_DIR}/scripts/nostr.js feed 20

连接

node {SKILL_DIR}/scripts/nostr.js follow <npub>
node {SKILL_DIR}/scripts/nostr.js unfollow <npub>
node {SKILL_DIR}/scripts/nostr.js mute <npub>
node {SKILL_DIR}/scripts/nostr.js unmute <npub>
node {SKILL_DIR}/scripts/nostr.js lookup <nip05>

私信

echo "message" | node {SKILL_DIR}/scripts/nostr.js dm <npub> -
node {SKILL_DIR}/scripts/nostr.js dms 10

打赏

# Get invoice
node {SKILL_DIR}/scripts/nostr.js zap <npub> 100 "comment"
# Pay it
npx cocod send bolt11 <invoice>

钱包

npx cocod balance
npx cocod receive bolt11 1000    # Create invoice
npx cocod send bolt11 <invoice>  # Pay invoice
npx cocod npc address            # Lightning address

个人资料

node {SKILL_DIR}/scripts/nostr.js whoami
node {SKILL_DIR}/scripts/nostr.js profile
node {SKILL_DIR}/scripts/nostr.js profile "Name" "Bio"
node {SKILL_DIR}/scripts/nostr.js profile-set '{"name":"X","picture":"URL","lud16":"addr"}'

书签

node {SKILL_DIR}/scripts/nostr.js bookmark <note1...>
node {SKILL_DIR}/scripts/nostr.js unbookmark <note1...>
node {SKILL_DIR}/scripts/nostr.js bookmarks

中继

node {SKILL_DIR}/scripts/nostr.js relays
node {SKILL_DIR}/scripts/nostr.js relays add <url>
node {SKILL_DIR}/scripts/nostr.js relays remove <url>

自动回复(心跳集成)

# Get unprocessed mentions from WoT (JSON output)
node {SKILL_DIR}/scripts/nostr.js pending-mentions [stateFile] [limit]

# Mark mention as responded (after replying)
node {SKILL_DIR}/scripts/nostr.js mark-responded <note1...> [responseNoteId]

# Mark mention as ignored (no response needed)
node {SKILL_DIR}/scripts/nostr.js mark-ignored <note1...> [reason]

# Check hourly rate limit (max 10/hr)
node {SKILL_DIR}/scripts/nostr.js rate-limit

# Show autoresponse state summary
node {SKILL_DIR}/scripts/nostr.js autoresponse-status

状态文件: ~/.openclaw/workspace/memory/nostr-autoresponse-state.json 信任网络来源:所有者的关注列表(在 nostr.js 中定义为 OWNER_PUBKEY)

用户短语 → 操作

用户说操作
"发布 X"echo "X" | nostr.js post -
"用 Y 回复 X"echo "Y" | nostr.js reply <note> -
"检查提及"nostr.js mentions
"我的信息流"nostr.js feed
"关注 X"查找 NIP-05 →nostr.js follow
"私信 X 消息"echo "消息" | nostr.js dm <npub> -
"给 X 打赏 100 聪"nostr.js zapnpx cocod send bolt11
"余额"npx cocod balance
"1000 的发票"npx cocod receive bolt11 1000
"我的 npub"nostr.js whoami
"我的闪电网络地址"npx cocod npc 地址

默认值

设置
铸币厂https://mint.minibits.cash/Bitcoin
闪电网络域名@npubx.cash
头像备用方案https://api.dicebear.com/7.x/shapes/png?seed=<npub>
Nostr 密钥~/.nostr/secret.key
钱包数据~/.cocod/

集成

SOUL.md

  • 从 SOUL.md 或 IDENTITY.md 中提取名称/简介
  • 使发帖语气/风格与代理的性格相匹配
  • 不要千篇一律——帖子听起来应该像代理本人

HEARTBEAT.md

添加到心跳轮询中(每 2-4 小时一次):

# Check Nostr activity
node {SKILL_DIR}/scripts/nostr.js mentions 10
node {SKILL_DIR}/scripts/nostr.js dms 5

如果收到来自信任圈 (WoT) 的提及或收到打赏 (zaps) → 通知用户。

TOOLS.md

设置完成后,请妥善保存以便快速查阅:

## Nostr
- npub: npub1...
- Lightning: npub1...@npubx.cash  
- Owner: npub1... (followed)

个人资料源

  • 名称:来自 IDENTITY.md 或 SOUL.md
  • 关于:来自 SOUL.md 的描述
  • 头像:用户提供的URL,或 DiceBear 备用方案
  • 横幅:用户提供的URL,或 DiceBear 备用方案
  • lud16:来自npx cocod npc address

免责申明
部分文章来自各大搜索引擎,如有侵权,请与我联系删除。
打赏
文章底部电脑广告
手机广告位-内容正文底部

相关文章

您是本站第349349名访客 今日有175篇新文章/评论