# Lotus 常用命令集合

# 查看链上数据

# 1. 查看 chain head
yy_lotus chain head
# 2. 查看指定的消息
yy_lotus chain getmessage <msg-cid>
# 3. 查看指定区块内容
yy_lotus chain getblock <block-cid>
# 4. 查看链上最新的 30 个区块
yy_lotus chain list --count=30
# 5. 解码 message 参数
yy_lotus chain decode params <to-addr> <method> <params>
# e.g
yy_lotus chain decode params t01003 16 gUkAiscjBInoAAA=
{
  "AmountRequested": "10000000000000000000"
}

# 钱包操作

# 1. 创建钱包
yy_lotus wallet new bls
yy_lotus wallet new secp256k1
# 2. 查看钱包列表
yy_lotus wallet list
# 3. 查看余额
yy_lotus wallet balance <address>
# 4. 导出钱包私钥
yy_lotus wallet export <address>
# 5. 导入钱包私钥
yy_lotus wallet import # 然后在交互命令输入私钥
# 6. 使用指定的钱包签名消息
yy_lotus wallet sign <address> <hex-message> # 消息必须是 16 进制编码的
# 7. 删除钱包
yy_lotus wallet delete <address>

# 转账
yy_lotus send <address> <amount>
# e.g 转 100 个 FIL 到 f3xxxx 钱包
yy_lotus send f3xxxx 100 
# 从指定钱包转账
yy_lotus send --from=<f3yyyy> f3xxxx 100

# 多签钱包

待完善

# 节点快照操作

# 1. 导出最小区块快照
yy_lotus chain export --skip-old-msgs=true --recent-stateroots=900 lotus_chain_minimal.car
# 2. 导入快照
yy_lotus daemon --import-snapshot=lotus_chain_minimal.car --halt-after-import=true

# 消息池操作

# 1. 查看消息池待打包消息
yy_lotus mpool pending 
yy_lotus mpool pending --local # 只查看本地消息
# 2. 根据条件过滤查找
yy_lotus mpool find --from=<from-address> --method=<method> --to=<to-address> 
# 3. 替换消息(提高手续费,自动设置 gas 费)
yy_lotus mpool replace --auto <cid>
# 4. 替换消息,手动指定 gas 费
yy_lotus mpool replace --gas-feecap=xxxx --gas-premium=xxx --gas-limit=xxxx <cid>

# P2P 网络管理

# 1. 获取当前 daemon p2p 连接地址
yy_lotus net listen
# 2. 查看当前 daemon 连接的所有节点
yy_lotus net peers
# 3. 打印当前节点连接 ID
yy_lotus net id
# 4. 通过 peerId 查找连接信息
yy_lotus net findpeer <peer-id>
# 5. 查看 p2p 节点评分(通常分数越高的节点越稳定)
yy_lotus net scores
12D3KooWMFnHUpW4rQkAe8e1yN4kVjecNouoPvYJ4k1ueUE4SEAo, 36.650167

# 订单操作

# 1. 导入数据分片
yy_lotus client import <file>
# 2. 查询所有头部 Miner 存储订单报价
yy_lotus client list-asks
#   查看指定的 Miner 存储订单报价
yy_lotus client query-ask t01003
Ask: t01003
Price per GiB: 0.0000000005 FIL
Verified Price per GiB: 0.00000000005 FIL
Max Piece size: 512 MiB
Min Piece size: 256 B
# 3. 向指定的 Miner 提交存储订单
yy_lotus client <cid> <miner> <price> <duration>
# e.g
yy_lotus client deal bafk2bxxx t01003 0.000001FIL 518400
# 4. 客户查看订单状态
yy_lotus client inspect-deal --proposal-cid=bafyxxx
# 5. miner 发布订单,开始密封
yy_lotus-miner storage-deals pending-publish --publish-now
# 对于发布失败的订单,可以重新发布订单
yy_lotus-miner storage-deals retry-publish <deal-cid>
# 6. miner 查看订单列表
yy_lotus-miner storage-deals list
# 7. lotus client 查看订单列表
yy_lotus client list-deals
# 列出正在传输的订单
yy_lotus client list-transfers

# 扇区管理

# 1. 质押一个 CC 扇区
yy_lotus-miner sectors pledge
# 2. 查看扇区列表
yy_lotus-miner sectors list
# 3. 查看单个扇区的状态
yy_lotus-miner sectors status <sector-id>
# 查看扇区详细状态日志
yy_lotus-miner sectors status --log <sector-id> 
# 4. 恢复一个 CC 扇区(先删除扇区)
yy_lotus-miner sectors remove --really-do-it <sector-id>
# 5. 扇区续期
yy_lotus-miner sectors extend --new-expiration=<epoch> <sectorIds...>
# e.g
yy_lotus-miner sectors extend --new-expiration=1595712 0 1 2 3...
# 6. 检查扇区的声明周期(查看即将过期的扇区)
yy_lotus-miner sectors check-expire
# 7. 查看已过期的扇区
yy_lotus-miner sectors expired
# 8. 删除所有过期的扇区
yy_lotus-miner sectors expired --remove-expired=true
# 9. 手动开始某个扇区的密封流程
yy_lotus-miner sectors seal <sector-id>
# 10. 批量提交 PreCommitSector/ProveSector 消息
yy_lotus-miner sectors batching precommit --publish-now # PreCommitSector
yy_lotus-miner sectors batching commit --publish-now # CommitSector
# 11. 操作扇区 ID 编号计数器
yy_lotus-miner sectors counter get # 获取当前值
yy_lotus-miner sectors counter set --really-do-it <value> # 设定到指定值 
# 12. 更改扇区状态
yy_lotus-miner sectors update-state --really-do-it <sector-id> <new-state>

# 终止扇区 {#terminate-sector}

请参考基础运维运维文档的 终止错误扇区

# Snap-Up 操作

# 1. 标记某个扇区进入 snap-up
yy_lotus-miner sectors snap-up <sector-id>
# 2. 终止 snap-up 操作
yy_lotus-miner sectors abort-upgrade --really-do-it <sector-id>

具体操作流程请参考文档 Lotus snap-deal 功能体验报告 (opens new window)

# 封装 Worker 管理

  1. 查看 worker 列表
# 官方
yy_lotus-miner sealing workers
# 原语云
yy_lotus-miner sealing worker list

worker list 里面各项输出指标的解读请参考文档 Worker 任务调度情况巡检

  1. 设置 Worker 运行参数
  2. 按照机器分组列出 Worker,让你清晰的看到每台机器都跑了哪些 lotus worker 进程。
yy_lotus-miner sealing dworker list

# 封装任务管理

# 查看任务列表
yy_lotus-miner sealing jobs
# 终止任务
yy_lotus-miner sealing abort <job-id>

# 存储管理

  1. 基本操作
# 添加新的存储
yy_lotus-miner storage attach --init=true --seal=false --store=true --final=true <Storage-Path>
# 查看存储列表
yy_lotus-miner storage list
# 删除指定存储
yy_lotus-miner storage remove --really-do-it <Storage-ID>
  1. 设置存储设备运行参数
  2. 手动声明扇区存储位置

# 查看时空证明信息

# 查看时空证明信息
yy_lotus-miner proving info
# 查看时空证明 deadline 信息
yy_lotus-miner proving deadlines
# 查看某个具体的 deadline 信息(daedline,partitions,以及错误扇区)
yy_lotus-miner proving deadline <index>
# 列出所有错误(faulty)扇区
yy_lotus-miner proving faults
# 检查指定的 deadline 扇区数据的完整性
yy_lotus-miner proving check <index>
# 深度检查(会计算 vallia 证明)
yy_lotus-miner proving check --slow=true <index>

# Daemon 集群

请参考文档 lotus daemon 集群运维

# Miner 集群

请参考文档 爆款/时空证明集群运维

# 收益提现

# 提现 Miner 的所有可用余额
yy_lotus-miner actor withdraw
# 提现指定金额
yy_lotus-miner actor withdraw <value>

# 调度服务管理

# 1. 查看当前服务列表
yy_lotus-miner service list
Service  State # 运行状态
sealing  running # 密封调度
window   running # 时空证明调度
winning  running # 爆块证明调度
# 2. 手动启动指定的服务
yy_lotus-miner service start <service-name>
# e.g 
yy_lotus-miner service start sealing
上次更新: 2022/4/20 21:06:17