@1sat/cli

中文文档
0.1.4发布于 2026/11/07MITES Module近 30 天下载 2603

1Sat Ordinals SDK 的 CLI 读取

中文使用文档
文档目录20 节
  1. 快速启动
  2. 安装
  3. 认证
  4. 配置
  5. 图标
  6. 设置
  7. 钱包
  8. 职称
  9. 托肯斯( BSV21)
  10. 锁定
  11. 身份( BAP)
  12. 社会
  13. 选项
  14. 扫
  15. 交易公用事业
  16. 普通动作执行器
  17. 全球选项
  18. 发展
  19. 许可证
  20. 经认证的 HTTP 请求

1sat CLI

@ 1sat/ cli (韩语)

BSV上的 1Sat Ordinals 命令行接口.

在22.13节点上运行 阿宝 1.2. 节点:

npm i -g @1sat/cli      # or: npx @1sat/cli <command>

与 Bun( 已出版的 bin 有 node shebang; 通过 --bun 以强制两种方式安装:

curl -fsSL https://bun.sh/install | bash

然后说:

bun add -g @1sat/cli

或者不安装就运行 :

bunx --bun @1sat/cli

快速启动

# 1. Set up your wallet (interactive)
1sat init

# 2. Check your balance
1sat wallet balance

# 3. List your ordinals
1sat ordinals list

安装

全局安装( 建议 ):

bun add -g @1sat/cli

不安装运行 :

bunx @1sat/cli <command>

二进制 : 已安装的二进制名称 1sat。 。 。 .


认证

CLI 按此顺序解决您的私钥 :

  1. PRIVATE_KEY_WIF 环境变量——工作时没有密码或任何磁盘状态.
  2. ~/.1sat/keys.bep —— 由 : 1sat init。运行时需要密码 ONESAT_PASSWORD env var 或 交互式提示 .
  3. 没有找到 —— 退出时出错, 并告诉你要运行 1sat init。 。 。 .

环境变量( CI / 脚本) :

export PRIVATE_KEY_WIF="<your WIF key>"
1sat wallet balance

信封文件 (和上面相同的密钥;文件值覆盖此运行的进程环境):

1sat --env-file mint.env wallet balance

加密密钥文件( 交互式使用) :

# Set once — creates ~/.1sat/keys.bep
1sat init

# Unlock at runtime via env var
export ONESAT_PASSWORD="your-password"
1sat wallet balance

# Or enter it interactively when prompted
1sat wallet balance

WIF 密钥起始于 5, (中文(简体) ), K,或 L 在主网和 c 在测试网.


配置

整个州都住在 ~/.1sat/ (模式) 0700:

文件目的
config.json网络、数据目录、存储设置
keys.bepAES 加密的私人密钥( 模式) 0600(中文(简体) )
data/本地钱包数据库

查看当前配置 :

1sat config show

设定值 :

1sat config set chain test
1sat config set remoteStorageUrl https://storage.example.com

固定键 : chain, (中文(简体) ), dataDir, (中文(简体) ), remoteStorageUrl, (中文(简体) ), storageIdentityKey。 。 。 .

打印配置目录 :

1sat config path

图标

设置

1sat init                          # Interactive wallet setup wizard

init 生成或导入 WIF 密钥,用您选择的密码加密,选择主网或测试网,并写入 ~/.1sat/config.json。 。 。 .


钱包

1sat wallet balance                # Show balance in satoshis and UTXO count
1sat wallet address                # Show deposit address
1sat wallet info                   # Show address, identity key, balance, network
1sat wallet send --to <addr> --sats <amount>
1sat wallet send-all --to <addr>   # Empty the wallet to one address

职称

1sat ordinals list                              # List owned inscriptions
1sat ordinals mint --file <path>                # Inscribe a file (MIME type auto-detected)
1sat ordinals mint --file <path> --type <mime>  # Inscribe with explicit content type
1sat ordinals transfer --outpoint <txid.vout> --to <addr>
1sat ordinals sell --outpoint <txid.vout> --price <sats>
1sat ordinals cancel --outpoint <txid.vout>
1sat ordinals buy --outpoint <txid.vout>

支持的自动检测文件类型 : .txt, (中文(简体) ), .html, (中文(简体) ), .css, (中文(简体) ), .js, (中文(简体) ), .json, (中文(简体) ), .svg, (中文(简体) ), .png, (中文(简体) ), .jpg, (中文(简体) ), .gif, (中文(简体) ), .webp, (中文(简体) ), .mp3, (中文(简体) ), .mp4, (中文(简体) ), .pdf还有更多.


托肯斯( BSV21)

1sat tokens balances                                         # Show balances by token ID
1sat tokens list                                             # List all token UTXOs
1sat tokens list --token-id <id>                             # Filter by token ID
1sat tokens send --token-id <id> --to <addr> --amount <n>
1sat tokens buy --outpoint <txid.vout> --token-id <id> --amount <n>

tokens deploy 尚未可用;一旦部署行动在 @1sat/actions。 。 。 .


锁定

1sat locks info                                 # Show locked amounts and maturity status
1sat locks lock --sats <amount> --blocks <n>    # Lock BSV until block height
1sat locks unlock                               # Unlock all matured locks

身份( BAP)

1sat identity create                            # Publish a BAP identity on-chain
1sat identity info                              # Show your identity key
1sat identity sign --message <text>             # Sign a message (BSM)

社会

1sat social post --content <text>              # Create an on-chain BSocial post
1sat social post --content <text> --app <name> # Post with a custom app tag

选项

OpNS( Ordinals Name System) 将您的 BAP 身份绑定在一个链上的名称铭文上.

1sat opns lookup                               # List OpNS names in your wallet
1sat opns register --id <id> --domain <host>   # Bind your identity to a name
1sat opns deregister --outpoint <txid.vout>    # Remove the identity binding

扫

从外部私人密钥(Legacy P2PKH / Yours备份 WIF)导入资产到 BRC- 100 钱包.

1sat sweep scan --wif <key>
1sat sweep import --wif <key> --dry-run
1sat sweep import --wif <key>
1sat sweep import --wif <key> --only opns,bsv20
1sat sweep import --wif <key> --skip bsv21

scan 是完整的清单. import --dry-run 后为同一计划 --only 编号 : --skip。 。 。 . import 没有类旗尝试每一个可以移动到 BRC-100 的类:

类目标
bsv供资
ordinals1sat 篮子
opnsopns 篮子
bsv20bsv20 篮子( 标记身份)
bsv21bsv21 篮子(调出点身份)

上市的OrdLocks在同一交易中取消进入目的地. 时间锁定和RUN产出仍为剩余. --only 财务报告和审定财务报表 --skip 带 bsv,ordinals,opns,bsv20,bsv21时确认,或通过 --yes。 。 。 .


交易公用事业

1sat tx decode <hex>            # Decode a raw transaction hex string

普通动作执行器

每一个动作都登记在 @1sat/actions 名称:

1sat action                     # List all registered actions grouped by category
1sat action <name>              # Run an action with no input
1sat action <name> '<json>'     # Run an action with JSON input

示例

1sat action sendBsv '{"requests":[{"address":"1A1zP1eP5QGefi2DMPTfTL5SLmv7Divf","satoshis":1000}]}'

此执行器允许脚本访问所有 30+ 动作, 而无需等待添加专门的 CLI 子命令 .


全球选项

这些选项与每个命令配合 :

旗帜说明
--json打印输出为 JSON( 机器可读)
--quiet, (中文(简体) ), -q禁止所有输出
--yes, (中文(简体) ), -y跳过确认提示
--chain <main|test>网络选择( 默认 ): main(中文(简体) )
--help, (中文(简体) ), -h显示帮助
--version, (中文(简体) ), -v显示版本

JSON 输出示例 :

1sat wallet balance --json
# {"satoshis":123456,"utxos":3}

1sat ordinals list --json
# [...array of outputs...]

脚本使用 -- 有:

1sat wallet send --to 1A1z... --sats 1000 --yes

发展

从单曲内源运行 :

cd /path/to/1sat-sdk

# Install dependencies
bun install

# Run the CLI directly (no compile step)
bun run packages/cli/src/cli.ts <command>

# Or use the dev script from the cli package
cd packages/cli
bun dev <command>

# Build a self-contained binary
bun run build
# Output: packages/cli/bin/1sat

CLI是纯Bun,没有框架. 参数解析为手动( R)src/args.ts) (中文(简体) ). Bun 直接执行 TypeScript, 这样您就可以从源代码运行, 而无需编译步骤 .


许可证

麻省理工学院

经认证的 HTTP 请求

1sat authfetch <method> <url> [--body <json|@file>] [--header 'K: V'] 使用 SDK 的 BRC- 104 AuthFetch 有 CLI 钱包密钥. 如果SDK报告 缺少响应认证信头, 只有 GET 和 HEAD 可以使用 公众阅读的普通读取。 其他方法失败,结果未知 警告:在重试前验证活动,因为服务器可能已经 执行请求.

402个答复要求互动付款确认或明确 --yes。 。 。 . 无 --yes 和 stdin 和 stdout 上的终端,命令返回 approval_required 退出状态 1 且不重试支付。 使用 --json 结构化产出; satoshis 只有在公开支付时才列入 头是非负数的安全整数,最多为16个小数。 评议 重运行前先付款 --yes; 这授权现有的 SDK 付款 流动。 它没有规定开支上限. --quiet 抑制输出如常.

版本与发布记录

@1sat/cli 共发布 132 个版本,首次发布于 2026/03/17;过去 12 个月发布了 132 个版本。

版本发布日期距今
0.1.4latest2026/11/07今天
0.1.32026/11/061 天前
0.1.22026/11/062 天前
0.1.12026/10/2711 天前
0.1.02026/10/2216 天前
0.0.1332026/10/1425 天前

关于 @1sat/cli 的常见问题

@1sat/cli 是什么?

1Sat Ordinals SDK 的 CLI 读取

如何安装 @1sat/cli?

在项目目录运行 npm install @1sat/cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 1sat,可以用 npx 1sat 直接运行。

@1sat/cli 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/1sat__cli 是否存在。

@1sat/cli 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@1sat/cli 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.13。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@1sat/cli 可以商用吗?

@1sat/cli 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@1sat/cli 的下载量有多少?

根据 npm 官方下载统计,@1sat/cli 在 2026/10/05 – 2026/11/03 这 30 天内被下载 2,603 次,日均约 87 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@1sat/cli 还在维护吗?

最新版本 0.1.4 发布于 2026/11/07(今天);至今共发布 132 个版本,其中过去 12 个月发布了 132 个;首次发布于 2026/03/17。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。