ordinals
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOrdinals Skill
Ordinals工具
Provides Bitcoin ordinals operations using the micro-ordinals library, mempool.space API, and Unisat API. Creating inscriptions follows the two-step commit/reveal pattern — first broadcasts the commit transaction, then after it confirms, broadcasts the reveal transaction to finalize the inscription.
inscribeinscribe-revealInscription transfers use the Unisat API to look up inscription UTXOs and build mixed-input transactions (P2TR inscription + P2WPKH fees).
All write operations require an unlocked wallet with Taproot key support.
借助micro-ordinals库、mempool.space API和Unisat API实现比特币Ordinals操作。创建铭文遵循两步提交/披露(commit/reveal)模式——首先执行命令广播提交交易,待交易确认后,执行命令广播披露交易以完成铭文创建。
inscribeinscribe-reveal铭文转移功能通过Unisat API查询铭文UTXO,并构建混合输入交易(P2TR铭文 + P2WPKH手续费)。
所有写入操作均需要支持Taproot密钥的已解锁钱包。
Usage
使用方法
bun run ordinals/ordinals.ts <subcommand> [options]bun run ordinals/ordinals.ts <子命令> [选项]Subcommands
子命令
get-taproot-address
get-taproot-address
Get the wallet's Taproot (P2TR) address for receiving inscriptions. Requires an unlocked wallet.
bun run ordinals/ordinals.ts get-taproot-address获取钱包用于接收铭文的Taproot(P2TR)地址。需要已解锁的钱包。
bun run ordinals/ordinals.ts get-taproot-addressestimate-fee
estimate-fee
Calculate the total cost (in satoshis) for creating an inscription.
bun run ordinals/ordinals.ts estimate-fee --content-type <type> --content-base64 <base64> [--fee-rate <rate>]Options:
- (required) — MIME type (e.g.,
--content-type,text/plain)image/png - (required) — Content as base64-encoded string
--content-base64 - (optional) — Fee rate in sat/vB (default: current medium fee)
--fee-rate
计算创建铭文的总成本(单位:聪)。
bun run ordinals/ordinals.ts estimate-fee --content-type <类型> --content-base64 <base64编码内容> [--fee-rate <费率>]选项:
- (必填)——MIME类型(例如:
--content-type、text/plain)image/png - (必填)——Base64编码的内容字符串
--content-base64 - (可选)——手续费率,单位:聪/字节(默认:当前中等费率)
--fee-rate
inscribe
inscribe
Create a Bitcoin inscription — STEP 1: Broadcast commit transaction.
bun run ordinals/ordinals.ts inscribe --content-type <type> --content-base64 <base64> [--fee-rate fast|medium|slow|<number>]Options:
- (required) — MIME type
--content-type - (required) — Content as base64-encoded string
--content-base64 - (optional) —
--fee-rate,fast,medium, or number in sat/vB (default:slow)medium
创建比特币铭文——步骤1:广播提交交易。
bun run ordinals/ordinals.ts inscribe --content-type <类型> --content-base64 <base64编码内容> [--fee-rate fast|medium|slow|<数值>]选项:
- (必填)——MIME类型
--content-type - (必填)——Base64编码的内容字符串
--content-base64 - (可选)——可选值为
--fee-rate、fast、medium,或具体数值(单位:聪/字节),默认值:slowmedium
inscribe-reveal
inscribe-reveal
Complete a Bitcoin inscription — STEP 2: Broadcast reveal transaction.
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>]Options:
- (required) — Transaction ID of the confirmed commit (64 hex chars)
--commit-txid - (required) — Amount in the commit output (satoshis)
--reveal-amount - (required) — MIME type (must match commit step)
--content-type - (required) — Content (must match commit step)
--content-base64 - (optional) — Fee rate for reveal tx (default:
--fee-rate)medium
完成比特币铭文创建——步骤2:广播披露交易。
bun run ordinals/ordinals.ts inscribe-reveal \
--commit-txid <交易ID> \
--reveal-amount <聪数> \
--content-type <类型> \
--content-base64 <base64编码内容> \
[--fee-rate fast|medium|slow|<数值>]选项:
- (必填)——已确认的提交交易ID(64位十六进制字符)
--commit-txid - (必填)——提交交易输出的金额(单位:聪)
--reveal-amount - (必填)——MIME类型(必须与提交步骤一致)
--content-type - (必填)——内容(必须与提交步骤一致)
--content-base64 - (可选)——披露交易的手续费率,默认值:
--fee-ratemedium
transfer-inscription
transfer-inscription
Transfer an inscription to a new owner. Looks up the inscription UTXO via Unisat, uses cardinal UTXOs from the SegWit address for fees, and sends the inscription to the recipient's Taproot address.
bun run ordinals/ordinals.ts transfer-inscription \
--inscription-id <id> \
--recipient <bc1p...> \
[--fee-rate fast|medium|slow|<number>]Options:
- (required) — Inscription ID (e.g.,
--inscription-id)abc123...i0 - (required) — Recipient Taproot address (bc1p... or tb1p...)
--recipient - (optional) — Fee rate (default:
--fee-rate)medium
Output:
json
{
"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"
}将铭文转移给新所有者。通过Unisat查询铭文UTXO,使用SegWit地址中的普通UTXO支付手续费,并将铭文发送至接收方的Taproot地址。
bun run ordinals/ordinals.ts transfer-inscription \
--inscription-id <ID> \
--recipient <bc1p...> \
[--fee-rate fast|medium|slow|<数值>]选项:
- (必填)——铭文ID(例如:
--inscription-id)abc123...i0 - (必填)——接收方的Taproot地址(格式为bc1p...或tb1p...)
--recipient - (可选)——手续费率,默认值:
--fee-ratemedium
输出:
json
{
"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
get-inscription
Fetch and parse inscription content from a Bitcoin reveal transaction.
bun run ordinals/ordinals.ts get-inscription --txid <txid>Options:
- (required) — Transaction ID of the reveal transaction (64 hex chars)
--txid
从比特币披露交易中获取并解析铭文内容。
bun run ordinals/ordinals.ts get-inscription --txid <交易ID>选项:
- (必填)——披露交易的ID(64位十六进制字符)
--txid
Two-Step Inscription Workflow
两步铭文创建流程
undefinedundefinedStep 1: Inscribe (broadcasts commit tx)
步骤1:提交铭文(广播提交交易)
CONTENT_B64=$(echo -n "Hello, Bitcoin!" | base64)
bun run ordinals/ordinals.ts inscribe --content-type text/plain --content-base64 "$CONTENT_B64"
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)
步骤2:披露(广播披露交易,完成铭文创建)
bun run ordinals/ordinals.ts inscribe-reveal
--commit-txid <commitTxid>
--reveal-amount <revealAmount>
--content-type text/plain
--content-base64 "$CONTENT_B64"
--commit-txid <commitTxid>
--reveal-amount <revealAmount>
--content-type text/plain
--content-base64 "$CONTENT_B64"
undefinedbun run ordinals/ordinals.ts inscribe-reveal
--commit-txid <commitTxid>
--reveal-amount <revealAmount>
--content-type text/plain
--content-base64 "$CONTENT_B64"
--commit-txid <commitTxid>
--reveal-amount <revealAmount>
--content-type text/plain
--content-base64 "$CONTENT_B64"
undefinedNotes
注意事项
- and
inscriberequire a wallet unlocked viainscribe-revealbun run wallet/wallet.ts unlock - The wallet must have BTC balance on the SegWit (bc1q/tb1q) address for funding
- Inscriptions are received at the Taproot (bc1p/tb1p) address
- requires
transfer-inscriptionfor inscription UTXO lookupUNISAT_API_KEY - Works on both mainnet and testnet (Unisat supports both)
- 执行和
inscribe命令前,需通过inscribe-reveal解锁钱包bun run wallet/wallet.ts unlock - 钱包的SegWit地址(bc1q/tb1q)需有BTC余额用于支付费用
- 铭文将被接收至Taproot地址(bc1p/tb1p)
- 执行命令需要
transfer-inscription用于查询铭文UTXOUNISAT_API_KEY - 支持主网和测试网(Unisat均提供支持)