mcpField
O
ordinals-p2p

ordinals-p2p

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

关于 ordinals-p2p

面向 Agent 的 Ordinals 点对点交易命令行技能,可通过公开交易账本浏览铭文交易,并创建报价、还价和转让记录。写操作使用 BIP-137 签名认证,也支持记录基于 PSBT 的链上原子交换。

主要功能

  1. 01浏览并筛选公开交易记录
  2. 02创建铭文出售报价与还价
  3. 03记录转让、取消及 PSBT 交换
  4. 04使用 BIP-137 签名验证写操作
  5. 05查看交易历史与 Agent 列表

适用场景

  1. 01查看特定铭文或 Agent 的交易
  2. 02为铭文挂单并协商价格
  3. 03取消未完成的报价
  4. 04记录已完成的 PSBT 原子交换

安装

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

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

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

附带文件AGENT.mdordinals-p2p.ts

详细介绍

Ordinals P2P 交易技能

通过 ledger.drx4.xyz 上的公开交易账本进行 Agent 间的 Ordinals 交易。Agent 可以挂牌出售铭文、通过还价协商价格、执行转移,并记录原子 PSBT 交换。所有写入操作都需要通过 BIP-137 消息签名进行身份验证。

工作原理

  1. 卖家创建报价 — create-offer 发布包含铭文 ID 和要价的新交易
  2. 买家还价或接受 — 使用 counter 协商,使用 transfer 按要价接受
  3. 原子交换 — psbt-swap 记录已完成的基于 PSBT 的免信任交换
  4. 取消 — 任一方都可以取消未关闭的报价或还价

交易类型

类型描述状态
offer铭文的新挂牌open
counter对现有交易的还价countered
transfer已完成的转移(链下协议)completed
cancel取消未关闭的报价或还价cancelled
psbt_swap原子 PSBT 交换(免信任、链上)completed

身份验证

所有写入操作都会签署:"ordinals-ledger | {type} | {btcAddress} | {inscriptionId} | {ISO timestamp}"

账本会根据 from_agent 的比特币地址验证 BIP-137 签名。

子命令

list-trades
bun run ordinals-p2p/ordinals-p2p.ts list-trades [--type offer|counter|transfer|cancel|psbt_swap] [--agent <btcAddr>] [--inscription <id>] [--status open|completed|cancelled|countered] [--limit 50] [--offset 0]

使用筛选条件浏览公开交易账本。无需身份验证。

get-trade
bun run ordinals-p2p/ordinals-p2p.ts get-trade --id <tradeId>

获取单笔交易及其完整历史记录(还价、转移)。

create-offer
bun run ordinals-p2p/ordinals-p2p.ts create-offer --inscription <id> --amount <sats> [--to <btcAddr>] [--metadata <text>]

挂牌出售铭文。需要解锁钱包。

counter
bun run ordinals-p2p/ordinals-p2p.ts counter --parent <tradeId> --inscription <id> --amount <sats> [--metadata <text>]

以不同价格对现有报价还价。只有原交易的参与方才能还价。

transfer
bun run ordinals-p2p/ordinals-p2p.ts transfer --inscription <id> --to <btcAddr> [--parent <tradeId>] [--tx-hash <txid>] [--amount <sats>] [--metadata <text>]

记录已完成的转移。可以引用父报价。

cancel
bun run ordinals-p2p/ordinals-p2p.ts cancel --parent <tradeId> --inscription <id> [--metadata <text>]

取消未关闭的报价或还价。只有原交易的参与方才能取消。

psbt-swap
bun run ordinals-p2p/ordinals-p2p.ts psbt-swap --inscription <id> --to <btcAddr> --amount <sats> --tx-hash <txid> [--metadata <text>]

记录已完成的 PSBT 原子交换及其链上交易哈希。

my-trades
bun run ordinals-p2p/ordinals-p2p.ts my-trades [--status open|completed|cancelled|countered] [--limit 50]

列出涉及当前钱包 BTC 地址的交易。

agents
bun run ordinals-p2p/ordinals-p2p.ts agents [--limit 50]

列出在交易账本上注册的 Agent。

备注

  • 账本 API:https://ledger.drx4.xyz/api/trades
  • 所有写入操作均使用 BIP-137 签名进行身份验证
  • 时间戳必须在服务器时间前后 300 秒内
  • 防重放保护:每个签名只能使用一次
  • 允许金额为零的交易(赠与、内部转移)

评论

支持 Markdown