mcpField
O
ordinals

ordinals

github.com/aibtcdev其他11145 次安装1 天前更新
代码仓库

关于 ordinals

用于 Bitcoin Ordinals 操作的命令行技能,涵盖创建、转移和读取铭文。创建采用两步 commit/reveal 流程,写入操作需要已解锁且支持 Taproot 的钱包。

主要功能

  1. 01估算铭文费用
  2. 02通过 commit/reveal 创建铭文
  3. 03转移铭文
  4. 04读取铭文内容
  5. 05获取 Taproot 接收地址

适用场景

  1. 01估算创建铭文的成本
  2. 02将内容刻入 Bitcoin
  3. 03向接收方发送铭文
  4. 04读取 reveal 交易中的内容

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/aibtcdev/skills --skill ordinals

安装后在 Claude Code 中输入/ordinals确认已加载。

附带文件AGENT.mdordinals.ts

详细介绍

Ordinals Skill

使用 micro-ordinals 库、mempool.space API 和 Unisat API 提供 Bitcoin ordinals 操作。创建铭文采用两步提交/揭示模式:首先,inscribe 广播提交交易;确认后,inscribe-reveal 广播揭示交易以完成铭文。

铭文转移使用 Unisat API 查询铭文 UTXO,并构建混合输入交易(P2TR 铭文 + P2WPKH 手续费)。

所有写入操作都需要已解锁且支持 Taproot 密钥的钱包。

用法

bun run ordinals/ordinals.ts <subcommand> [options]

子命令

get-taproot-address

获取钱包的 Taproot(P2TR)地址,用于接收铭文。需要已解锁的钱包。

bun run ordinals/ordinals.ts get-taproot-address
estimate-fee

计算创建铭文的总费用(以聪为单位)。

bun run ordinals/ordinals.ts estimate-fee --content-type <type> --content-base64 <base64> [--fee-rate <rate>]

选项:

  • --content-type(必需)—— MIME 类型(例如,text/plain、image/png)
  • --content-base64(必需)—— Base64 编码的内容字符串
  • --fee-rate(可选)—— 手续费率,单位为 sat/vB(默认:当前中等费率)
inscribe

创建 Bitcoin 铭文——第 1 步:广播提交交易。

bun run ordinals/ordinals.ts inscribe --content-type <type> --content-base64 <base64> [--fee-rate fast|medium|slow|<number>]

选项:

  • --content-type(必需)—— MIME 类型
  • --content-base64(必需)—— Base64 编码的内容字符串
  • --fee-rate(可选)—— fast、medium、slow 或以 sat/vB 为单位的数字(默认:medium)
inscribe-reveal

完成 Bitcoin 铭文——第 2 步:广播揭示交易。

bun run ordinals/ordinals.ts inscribe-reveal \
  --commit-txid <txid> \
  --reveal-amount <satoshis> \
  --content-type <type> \
  --content-base64 <base64> \
  [--fee-rate fast|medium|slow|<number>]

选项:

  • --commit-txid(必需)——已确认提交交易的交易 ID(64 个十六进制字符)
  • --reveal-amount(必需)——提交输出中的金额(聪)
  • --content-type(必需)—— MIME 类型(必须与提交步骤一致)
  • --content-base64(必需)——内容(必须与提交步骤一致)
  • --fee-rate(可选)——揭示交易的手续费率(默认:medium)
transfer-inscription

将铭文转移给新所有者。通过 Unisat 查询铭文 UTXO,使用 SegWit 地址中的 cardinal UTXO 支付手续费,并将铭文发送到接收方的 Taproot 地址。

bun run ordinals/ordinals.ts transfer-inscription \
  --inscription-id <id> \
  --recipient <bc1p...> \
  [--fee-rate fast|medium|slow|<number>]

选项:

  • --inscription-id(必需)——铭文 ID(例如,abc123...i0)
  • --recipient(必需)——接收方的 Taproot 地址(bc1p... 或 tb1p...)
  • --fee-rate(可选)——手续费率(默认:medium)

输出:

{
  "success": true,
  "txid": "def456...",
  "explorerUrl": "https://mempool.space/tx/def456...",
  "inscription": {
    "id": "abc123...i0",
    "contentType": "text/plain",
    "output": "abc123...:0"
  },
  "recipient": "bc1p...",
  "fee": { "satoshis": 1200, "rateUsed": "8 sat/vB" },
  "change": { "satoshis": 5000 },
  "network": "mainnet"
}
get-inscription

从 Bitcoin 揭示交易中获取并解析铭文内容。

bun run ordinals/ordinals.ts get-inscription --txid <txid>

选项:

  • --txid(必需)——揭示交易的交易 ID(64 个十六进制字符)

两步铭文工作流

# Step 1: Inscribe (broadcasts commit tx)
CONTENT_B64=$(echo -n "Hello, Bitcoin!" | base64)
bun run ordinals/ordinals.ts inscribe --content-type text/plain --content-base64 "$CONTENT_B64"

# Wait for commit to confirm

# Step 2: Reveal (broadcasts reveal tx, creates inscription)
bun run ordinals/ordinals.ts inscribe-reveal \
  --commit-txid <commitTxid> \
  --reveal-amount <revealAmount> \
  --content-type text/plain \
  --content-base64 "$CONTENT_B64"

注意事项

  • inscribe 和 inscribe-reveal 需要通过 bun run wallet/wallet.ts unlock 解锁的钱包
  • 钱包必须在 SegWit(bc1q/tb1q)地址上有 BTC 余额,用于提供资金
  • 铭文会发送到 Taproot(bc1p/tb1p)地址
  • transfer-inscription 需要 UNISAT_API_KEY 才能查询铭文 UTXO
  • 支持主网和测试网(Unisat 均支持)

评论

支持 Markdown