# OpenCL sudo apt install mesa-opencl-icd ocl-icd-opencl-dev编译 - 调试模式
# 在调试模式下构建Lotus Binaries,最小使用2048个字节的扇区。 make 2k1. lotus 准备 - 删除之前的数据
rm -rf ~/.lotus ~/.lotusminer/ ~/.genesis-sectors ~/.lotusworker rm -rf ~/.lotusstorage/准备 - 预密封
# 在中国服务器上运行的话, 添加ipfs网关
IPFS_GATEWAY="https://proof-parameters.s3.cn-south-1.jdcloud-oss.com/ipfs/"
export LOTUS_SKIP_GENESIS_CHECK=_yes_
# 下载2048字节参数:(可用此命令提前下载好证明用参数)
./lotus fetch-params 2048
# 预密封一些 sectors: (最小使用2048个字节)
./lotus-seed pre-seal --sector-size 2KiB --num-sectors 2
# --num-sectors: select number of sectors to pre-seal (default: 1)
创建创世块
./lotus-seed genesis new localnet.json ./lotus-seed genesis add-miner localnet.json ~/.genesis-sectors/pre-seal-t01000.json启动第一个节点
./lotus daemon --lotus-make-genesis=dev.gen --genesis-template=localnet.json --bootstrap=false2. miner 在另一个控制台中,导入genesis miner密钥
./lotus wallet import ~/.genesis-sectors/pre-seal-t01000.key设置创世矿工
./lotus-miner init --genesis-miner --actor=t01000 --sector-size=2KiB --pre-sealed-sectors=~/.genesis-sectors --pre-sealed-metadata=~/.genesis-sectors/pre-seal-t01000.json --nosync启动矿机
./lotus-miner run --nosync3. "远程"矿工
如果远程矿工与miner开在同一机器上(通常开发环境如此),需要在miner启动前关闭miner的seal功能
# ~/.lotusminer/config.toml AllowAddPiece = false AllowPreCommit1 = false AllowPreCommit2 = false AllowCommit = false AllowUnseal = false AllowWindowPost = false启动矿工
# 设置 连接哪个miner # 拷贝上一句生成的命令, 执行 tmp=$(./lotus-miner auth api-info --perm admin) export $tmp # 启动矿工 ./lotus-worker run --address 127.0.0.1:7001 #--address是worker要监听的ip端口 ./lotus-worker run --address 127.0.0.1:7001 / --precommit1 true / --precommit2 false / --commit true # 后台运行 worker # nohup lotus-worker run --address 127.0.0.1:7001 > /storage/worker.log 2>&1 &
-
往期精彩回顾:
- 区块链知识系列
- 密码学系列
- 零知识证明系列
- 共识系列
- 公链调研系列
- 比特币系列
- 以太坊系列
- EOS系列
- 联盟链系列
- Fabric系列
- 智能合约系列
- Token系列



