nihao 👋
Nostr identity setup and health-check CLI. Single binary, non-interactive, agent-friendly.
Source: https://github.com/dergigi/nihao
Capabilities Disclosure
This skill installs a single Go binary (nihao) that:
- - Generates Nostr keypairs — random Ed25519 key generation via INLINECODE1
- Publishes events — kind 0 (profile), kind 3 (follows), kind 1 (note), kind 10002 (relay list), kind 10050 (DM relays), kind 17375 (wallet), kind 10019 (nutzap info)
- Makes HTTP requests — NIP-05 verification, LNURL resolution, Cashu mint validation, relay NIP-11 probes, image HEAD checks
- Connects to Nostr relays — WebSocket connections to publish and query events
It does not:
- - Store keys on disk (prints nsec to stdout; use
--nsec-file to write to a file or --nsec-cmd to pipe to a command) - Run as a daemon or background process
- Access local files beyond the binary itself
- Require any accounts, API keys, or KYC
Prerequisites
- - Go 1.21+ — required to compile the binary from source. Check with
go version.
- Install: https://go.dev/dl/ or via your package manager (
brew install go,
apt install golang, etc.)
Install
nihao is distributed as source code compiled locally via Go's standard toolchain. No pre-built binaries are downloaded — the code is fetched from GitHub, compiled on your machine, and placed in your $GOPATH/bin.
CODEBLOCK0
Verify: INLINECODE8
The source is fully auditable at https://github.com/dergigi/nihao.
On Install
When an agent installs this skill:
Step 1: Install Binary
CODEBLOCK1
Step 2: Create Identity
CODEBLOCK2
This generates a keypair, publishes the identity, and securely writes the nsec to ./nsec.key with 0600 permissions. Parse the JSON output to extract npub, pubkey, and relays.
⚠️ The nsec cannot be recovered if lost. Always use --nsec-file or --nsec-cmd to persist it securely.
Step 3: Report to User
Tell the user:
- - Their agent's npub
- Their agent's lightning address (default:
<npub>@npub.cash) - Remind them to back up the nsec
Step 4: (Optional) Follow Owner
If the user provides their npub, the agent should follow them. nihao doesn't handle follows of specific npubs — use nak or another tool for that.
Setup — Create a New Identity
CODEBLOCK3
What this does:
- 1. Generates a Nostr keypair (or uses
--sec/--stdin) - Publishes profile metadata (kind 0)
- Publishes relay list (kind 10002) with NIP-65 read/write markers
- Publishes DM relay list (kind 10050) per NIP-17
- Publishes follow list (kind 3)
- Sets up a NIP-60 Cashu wallet (kind 17375 + kind 10019)
- Sets lightning address to INLINECODE20
- Posts a first note with
#nihao hashtag
Setup Flags
| Flag | Purpose |
|---|
| INLINECODE22 | Display name (default: "nihao-user") |
| INLINECODE23 |
Bio |
|
--picture <url> | Profile picture URL |
|
--banner <url> | Banner image URL |
|
--nip05 <user@domain> | NIP-05 identifier |
|
--lud16 <user@domain> | Lightning address (default:
npub@npub.cash) |
|
--relays <r1,r2,...> | Override default relay list |
|
--discover | Discover relays from well-connected npubs |
|
--dm-relays <r1,r2,...> | Override DM relay list (kind 10050) |
|
--no-dm-relays | Skip DM relay list publishing |
|
--mint <url> | Custom Cashu mint (repeatable) |
|
--no-wallet | Skip wallet setup |
|
--sec, --nsec <nsec\|hex> | Use existing secret key |
|
--stdin | Read secret key from stdin |
|
--nsec-file <path> | Write nsec to file (0600 perms) for secure storage |
|
--nsec-cmd <command> | Pipe nsec to shell command (alias:
--nsec-exec) |
|
--json | JSON output for parsing |
|
--quiet, -q | Suppress non-JSON, non-error output |
Key Management
nihao never writes keys to disk by default. Secret keys are handled securely:
- -
--nsec-file <path> — writes nsec to a file with 0600 permissions (recommended for automation) --nsec-cmd <command> — pipes nsec to a command's stdin (e.g., a password manager), never as a CLI argument--stdin — reads an existing key from stdin, avoiding shell history and process list exposure--json output — includes nsec in structured output for programmatic parsing
⚠️ Avoid passing raw nsec values as CLI arguments (e.g., --sec nsec1...) in shared environments, as arguments are visible in process listings. Prefer --stdin or --nsec-cmd instead.
CODEBLOCK4
Check — Audit an Existing Identity
CODEBLOCK5
Checks and scores (0–8):
| Check | What it does |
|---|
| INLINECODE50 | Kind 0 completeness (name, display_name, about, picture, banner) |
| INLINECODE51 |
NIP-05 live HTTP verification, root domain detection |
|
picture | Image reachability, Blossom hosting detection, file size |
|
banner | Same as picture |
|
lud16 | Lightning address LNURL resolution |
|
relay_list | Kind 10002 presence, relay count |
|
relay_markers | NIP-65 read/write marker analysis |
|
relay_quality | Per-relay latency, NIP-11 support, reachability |
|
dm_relays | Kind 10050 DM relay list (NIP-17) |
|
follow_list | Kind 3 follow count |
|
nip60_wallet | Kind 17375/37375 wallet presence |
|
nutzap_info | Kind 10019 nutzap configuration |
|
wallet_mints | Cashu mint reachability and validation |
Check Flags
| Flag | Purpose |
|---|
| INLINECODE63 | Structured JSON output |
| INLINECODE64 |
Suppress non-JSON output |
|
--relays <r1,r2,...> | Query these relays instead of defaults |
Exit Codes
| Code | Meaning |
|---|
| INLINECODE66 | All checks pass (score = max) |
| INLINECODE67 |
One or more checks fail |
Backup — Export Identity Events
CODEBLOCK6
Exports all identity-related events as JSON: kind 0 (profile), kind 3 (follows), kind 10002 (relay list), kind 10050 (DM relays), kind 10019 (nutzap info), kind 17375/37375 (wallet). JSON goes to stdout, progress to stderr. Use for snapshots, migration, or archival.
Backup Flags
| Flag | Purpose |
|---|
| INLINECODE68 | Suppress progress output (JSON always goes to stdout) |
| INLINECODE69 |
Query these relays instead of defaults |
JSON Output
Both setup and check support --json for structured, parseable output.
Setup output:
CODEBLOCK7
Check output:
CODEBLOCK8
Integration
TOOLS.md
After setup, store for quick reference:
CODEBLOCK9
Periodic Health Check
Run nihao check <npub> --json --quiet on a schedule to monitor identity health. Parse the JSON and alert if score drops.
Security
- - No pre-built binaries — nihao is compiled from source on your machine via
go install. The source is public and auditable. - No key storage — nihao does not persist keys unless explicitly told to via
--nsec-file or --nsec-cmd. - No network exfiltration — the only network connections are to Nostr relays (WebSocket), NIP-05/LNURL endpoints (HTTPS), and Cashu mints (HTTPS). No telemetry, no analytics, no phoning home.
- Stdin-first key input — when using an existing key, prefer
--stdin over --sec to avoid process list exposure. - File permissions —
--nsec-file writes with 0600 (owner read/write only).
Defaults
| Setting | Value |
|---|
| Relays | relay.damus.io, relay.primal.net, nos.lol, purplepag.es |
| DM relays |
nip17.com, relay.damus.io, relay.primal.net, nos.lol |
| Lightning |
<npub>@npub.cash |
| Mints | minibits, coinos, macadamia |
| Wallet kind | 17375 (NIP-60) |
nihao 👋
Nostr 身份设置与健康检查命令行工具。单一二进制文件,非交互式,对代理友好。
来源:https://github.com/dergigi/nihao
能力说明
本技能安装一个 Go 二进制文件(nihao),该文件能够:
- - 生成 Nostr 密钥对 — 通过 crypto/rand 随机生成 Ed25519 密钥
- 发布事件 — 类型 0(个人资料)、类型 3(关注列表)、类型 1(笔记)、类型 10002(中继列表)、类型 10050(私信中继)、类型 17375(钱包)、类型 10019(nutzap 信息)
- 发起 HTTP 请求 — NIP-05 验证、LNURL 解析、Cashu 铸币验证、中继 NIP-11 探测、图片 HEAD 检查
- 连接 Nostr 中继 — 通过 WebSocket 连接发布和查询事件
它不会:
- - 将密钥存储在磁盘上(将 nsec 输出到标准输出;使用 --nsec-file 写入文件或 --nsec-cmd 管道传输到命令)
- 作为守护进程或后台进程运行
- 访问除二进制文件本身之外的本地文件
- 需要任何账户、API 密钥或 KYC
前提条件
- - Go 1.21+ — 需要从源代码编译二进制文件。使用 go version 检查。
- 安装:https://go.dev/dl/ 或通过包管理器(brew install go、apt install golang 等)
安装
nihao 以源代码形式分发,通过 Go 的标准工具链在本地编译。不会下载预编译的二进制文件——代码从 GitHub 获取,在您的机器上编译,并放置在 $GOPATH/bin 中。
bash
go install github.com/dergigi/nihao@latest
验证:nihao version
源代码完全可审计,地址为 https://github.com/dergigi/nihao。
安装过程
当代理安装此技能时:
步骤 1:安装二进制文件
bash
go install github.com/dergigi/nihao@latest
步骤 2:创建身份
bash
nihao --name <代理名称> --about <代理简介> --nsec-file ./nsec.key --json --quiet
这将生成密钥对、发布身份,并以 0600 权限将 nsec 安全写入 ./nsec.key。解析 JSON 输出以提取 npub、pubkey 和 relays。
⚠️ nsec 丢失后无法恢复。 始终使用 --nsec-file 或 --nsec-cmd 安全持久化保存。
步骤 3:向用户报告
告知用户:
- - 其代理的 npub
- 其代理的 闪电网络地址(默认:@npub.cash)
- 提醒他们备份 nsec
步骤 4:(可选)关注所有者
如果用户提供其 npub,代理应关注他们。nihao 不处理特定 npub 的关注操作——请使用 nak 或其他工具。
设置 — 创建新身份
bash
nihao --name AgentName --about 我做一些事情 --json
此操作完成以下工作:
- 1. 生成 Nostr 密钥对(或使用 --sec/--stdin)
- 发布个人资料元数据(类型 0)
- 发布中继列表(类型 10002),包含 NIP-65 读/写标记
- 根据 NIP-17 发布私信中继列表(类型 10050)
- 发布关注列表(类型 3)
- 设置 NIP-60 Cashu 钱包(类型 17375 + 类型 10019)
- 将闪电网络地址设置为 @npub.cash
- 发布第一条带有 #nihao 标签的笔记
设置标志
| 标志 | 用途 |
|---|
| --name <名称> | 显示名称(默认:nihao-user) |
| --about <文本> |
简介 |
| --picture
| 个人资料图片 URL |
| --banner | 横幅图片 URL |
| --nip05 | NIP-05 标识符 |
| --lud16 | 闪电网络地址(默认:npub@npub.cash) |
| --relays | 覆盖默认中继列表 |
| --discover | 从连接良好的 npub 中发现中继 |
| --dm-relays | 覆盖私信中继列表(类型 10050) |
| --no-dm-relays | 跳过私信中继列表发布 |
| --mint | 自定义 Cashu 铸币(可重复) |
| --no-wallet | 跳过钱包设置 |
| --sec, --nsec | 使用现有密钥 |
| --stdin | 从标准输入读取密钥 |
| --nsec-file <路径> | 将 nsec 写入文件(0600 权限)以安全存储 |
| --nsec-cmd <命令> | 将 nsec 管道传输到 shell 命令(别名:--nsec-exec) |
| --json | JSON 格式输出以便解析 |
| --quiet, -q | 抑制非 JSON、非错误输出 |
密钥管理
默认情况下,nihao 从不将密钥写入磁盘。密钥安全处理方式如下:
- - --nsec-file <路径> — 以 0600 权限将 nsec 写入文件(推荐用于自动化)
- --nsec-cmd <命令> — 将 nsec 管道传输到命令的标准输入(例如密码管理器),绝不作为 CLI 参数
- --stdin — 从标准输入读取现有密钥,避免暴露 shell 历史和进程列表
- --json 输出 — 在结构化输出中包含 nsec,便于程序化解析
⚠️ 避免在共享环境中将原始 nsec 值作为 CLI 参数传递(例如 --sec nsec1...),因为参数在进程列表中可见。建议使用 --stdin 或 --nsec-cmd。
bash
生成并安全保存
nihao --name Bot --nsec-file ./bot-nsec.key --json
管道传输到密码管理器
nihao --name Bot --nsec-cmd pass insert -m nostr/nsec --json
通过标准输入使用现有密钥(避免进程列表暴露)
echo $NSEC | nihao --name Bot --stdin
检查 — 审计现有身份
bash
nihao check npub1... --json
检查项及评分(0–8):
| 检查项 | 功能说明 |
|---|
| profile | 类型 0 完整性(名称、显示名称、简介、图片、横幅) |
| nip05 |
NIP-05 实时 HTTP 验证,根域名检测 |
| picture | 图片可达性、Blossom 托管检测、文件大小 |
| banner | 同图片检查 |
| lud16 | 闪电网络地址 LNURL 解析 |
| relay_list | 类型 10002 存在性、中继数量 |
| relay_markers | NIP-65 读/写标记分析 |
| relay_quality | 每个中继的延迟、NIP-11 支持、可达性 |
| dm_relays | 类型 10050 私信中继列表(NIP-17) |
| follow_list | 类型 3 关注数量 |
| nip60_wallet | 类型 17375/37375 钱包存在性 |
| nutzap_info | 类型 10019 nutzap 配置 |
| wallet_mints | Cashu 铸币可达性和验证 |
检查标志
| 标志 | 用途 |
|---|
| --json | 结构化 JSON 输出 |
| --quiet, -q |
抑制非 JSON 输出 |
| --relays | 查询这些中继而非默认中继 |
退出码
一个或多个检查失败 |
备份 — 导出身份事件
bash
nihao backup > identity.json
nihao backup --