ordinals

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Ordinals 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
inscribe
broadcasts the commit transaction, then after it confirms,
inscribe-reveal
broadcasts the reveal transaction to finalize the inscription.
Inscription 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)模式——首先执行
inscribe
命令广播提交交易,待交易确认后,执行
inscribe-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-address

estimate-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:
  • --content-type
    (required) — MIME type (e.g.,
    text/plain
    ,
    image/png
    )
  • --content-base64
    (required) — Content as base64-encoded string
  • --fee-rate
    (optional) — Fee rate in sat/vB (default: current medium fee)
计算创建铭文的总成本(单位:聪)。
bun run ordinals/ordinals.ts estimate-fee --content-type <类型> --content-base64 <base64编码内容> [--fee-rate <费率>]
选项:
  • --content-type
    (必填)——MIME类型(例如:
    text/plain
    image/png
  • --content-base64
    (必填)——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:
  • --content-type
    (required) — MIME type
  • --content-base64
    (required) — Content as base64-encoded string
  • --fee-rate
    (optional) —
    fast
    ,
    medium
    ,
    slow
    , or number in sat/vB (default:
    medium
    )
创建比特币铭文——步骤1:广播提交交易。
bun run ordinals/ordinals.ts inscribe --content-type <类型> --content-base64 <base64编码内容> [--fee-rate fast|medium|slow|<数值>]
选项:
  • --content-type
    (必填)——MIME类型
  • --content-base64
    (必填)——Base64编码的内容字符串
  • --fee-rate
    (可选)——可选值为
    fast
    medium
    slow
    ,或具体数值(单位:聪/字节),默认值:
    medium

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:
  • --commit-txid
    (required) — Transaction ID of the confirmed commit (64 hex chars)
  • --reveal-amount
    (required) — Amount in the commit output (satoshis)
  • --content-type
    (required) — MIME type (must match commit step)
  • --content-base64
    (required) — Content (must match commit step)
  • --fee-rate
    (optional) — Fee rate for reveal tx (default:
    medium
    )
完成比特币铭文创建——步骤2:广播披露交易。
bun run ordinals/ordinals.ts inscribe-reveal \
  --commit-txid <交易ID> \
  --reveal-amount <聪数> \
  --content-type <类型> \
  --content-base64 <base64编码内容> \
  [--fee-rate fast|medium|slow|<数值>]
选项:
  • --commit-txid
    (必填)——已确认的提交交易ID(64位十六进制字符)
  • --reveal-amount
    (必填)——提交交易输出的金额(单位:聪)
  • --content-type
    (必填)——MIME类型(必须与提交步骤一致)
  • --content-base64
    (必填)——内容(必须与提交步骤一致)
  • --fee-rate
    (可选)——披露交易的手续费率,默认值:
    medium

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:
  • --inscription-id
    (required) — Inscription ID (e.g.,
    abc123...i0
    )
  • --recipient
    (required) — Recipient Taproot address (bc1p... or tb1p...)
  • --fee-rate
    (optional) — Fee rate (default:
    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|<数值>]
选项:
  • --inscription-id
    (必填)——铭文ID(例如:
    abc123...i0
  • --recipient
    (必填)——接收方的Taproot地址(格式为bc1p...或tb1p...)
  • --fee-rate
    (可选)——手续费率,默认值:
    medium
输出:
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:
  • --txid
    (required) — Transaction ID of the reveal transaction (64 hex chars)
从比特币披露交易中获取并解析铭文内容。
bun run ordinals/ordinals.ts get-inscription --txid <交易ID>
选项:
  • --txid
    (必填)——披露交易的ID(64位十六进制字符)

Two-Step Inscription Workflow

两步铭文创建流程

undefined
undefined

Step 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"
undefined
bun run ordinals/ordinals.ts inscribe-reveal
--commit-txid <commitTxid>
--reveal-amount <revealAmount>
--content-type text/plain
--content-base64 "$CONTENT_B64"
undefined

Notes

注意事项

  • inscribe
    and
    inscribe-reveal
    require a wallet unlocked via
    bun 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
  • transfer-inscription
    requires
    UNISAT_API_KEY
    for inscription UTXO lookup
  • 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
    命令需要
    UNISAT_API_KEY
    用于查询铭文UTXO
  • 支持主网和测试网(Unisat均提供支持)