关于 child-inscription
用于创建带链上溯源关系的父子 Ordinals 铭文的命令行技能。它可估算费用,并分 commit 与 reveal 两步操作;reveal 会同时花费父项 UTXO 和 commit 输出。
主要功能
- 01估算子铭文费用
- 02广播 commit 交易
- 03揭示子铭文
- 04验证父铭文所有权
- 05将父铭文返还钱包
适用场景
- 01提交资金前规划费用
- 02创建关联父铭文的子铭文
- 03通过 reveal 完成已确认的 commit
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ aibtcdev/ skills --skill child-inscription安装后在 Claude Code 中输入/child-inscription确认已加载。
附带文件AGENT.mdchild-inscription.ts
详细介绍
子铭文技能
根据 Ordinals 来源规范创建父子 Ordinals 铭文。铭文所有者会在揭示交易中花费父 UTXO,并嵌入一个指针,为子铭文确立链上来源。
- estimate — 只读费用计算,无需钱包。
- inscribe — 步骤 1:提交交易,需要已解锁且有 BTC 的钱包。
- reveal — 步骤 2:揭示交易,需要提交交易已确认。
用法
bun run child-inscription/child-inscription.ts <subcommand> [options]
子命令
estimate
计算子铭文的总成本(提交费用 + 揭示金额),不会广播任何内容。
bun run child-inscription/child-inscription.ts estimate \
--parent-id <inscription-id> \
--content-type <mime> \
--content <string>
选项:
--parent-id(必填)— 父铭文 ID,例如abc123...i0--content-type(必填)— MIME 类型,例如text/plain或image/png--content(必填)— UTF-8 字符串格式的内容(内部会进行 base64 编码)--fee-rate(可选)— 费率,单位为 sat/vB;默认为当前内存池的中等费率
输出:
{
"parentId": "abc123...i0",
"contentType": "text/plain",
"contentSize": 42,
"feeRate": 12,
"fees": {
"commitFee": 1440,
"revealFee": 2100,
"revealAmount": 3394,
"totalCost": 4834
},
"breakdown": "Commit tx: 1440 sats | Reveal amount: 3394 sats (includes 2100 reveal fee) | Total: 4834 sats"
}
inscribe
广播提交交易(步骤 1)。提交交易会将资金锁定到一个支付到 taproot 地址,该地址编码了铭文脚本。此交易确认后,运行 reveal。
bun run child-inscription/child-inscription.ts inscribe \
--parent-id <inscription-id> \
--content-type <mime> \
--content <string> \
[--fee-rate <sats-per-vbyte>]
选项:
--parent-id(必填)— 父铭文 ID。你的钱包必须拥有此铭文(通过链上验证)。--content-type(必填)— 子内容的 MIME 类型。--content(必填)— UTF-8 字符串格式的子内容。--fee-rate(可选)— 费率:fast、medium、slow,或以 sat/vB 为单位的整数(默认值:medium)。
输出:
{
"status": "commit_broadcast",
"commitTxid": "deadbeef...",
"commitExplorerUrl": "https://mempool.space/tx/deadbeef...",
"revealAddress": "bc1p...",
"revealAmount": 3394,
"commitFee": 1440,
"feeRate": 12,
"parentInscriptionId": "abc123...i0",
"contentType": "text/plain",
"contentSize": 42,
"nextStep": "After commit confirms, call reveal with commitTxid and revealAmount from this response."
}
reveal
广播揭示交易(步骤 2)。此交易会同时花费提交输出和父 UTXO,创建子铭文,并将父铭文返还到你的地址。
调用此命令前,请等待提交交易确认。
bun run child-inscription/child-inscription.ts reveal \
--commit-txid <txid> \
--vout <num>
选项:
--commit-txid(必填)— 已确认提交交易的 Txid(来自inscribe步骤)。--vout(必填)— 提交交易的输出索引(几乎总是0)。
注意:内容、内容类型、父 ID 和揭示金额会从 inscribe 子命令写入的 .child-inscription-state.json 文件中读取。
输出:
{
"status": "success",
"inscriptionId": "revealthash...i0",
"parentInscriptionId": "abc123...i0",
"contentType": "text/plain",
"contentSize": 42,
"commit": {
"txid": "deadbeef...",
"explorerUrl": "https://mempool.space/tx/deadbeef..."
},
"reveal": {
"txid": "revealthash...",
"fee": 2100,
"explorerUrl": "https://mempool.space/tx/revealthash..."
},
"recipientAddress": "bc1p..."
}
注意事项
- 请务必先运行
estimate,了解总成本后再提交资金。 inscribe子命令会在当前工作目录中写入.child-inscription-state.json文件。运行reveal前请勿删除该文件。- 在
inscribe和reveal两个步骤之间,父铭文必须留在你的 Taproot 地址中。请勿在此期间转移父铭文。 - 内容会先编码为 UTF-8,再进行 base64 编码,然后传递给 MCP 工具。二进制内容(如图像等)应预先编码。
- 钱包操作需要已解锁的钱包(请先运行
bun run wallet/wallet.ts unlock)。 - 默认情况下,所有操作都针对 Bitcoin 主网(由
NETWORK环境变量控制)。
评论
支持 Markdown