準備作業
依賴安裝
# OpenCL
sudo apt install mesa-opencl-icd ocl-icd-opencl-dev
編譯 - 除錯模式
# 在除錯模式下構建Lotus Binaries,最小使用2048個位元組的扇區,
make 2k
1. 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=false
2. miner
在另一個控制臺中,匯入ge??nesis 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 --nosync
3. "遠程"礦工
如果遠程礦工與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系列
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/287795.html
標籤:區塊鏈
下一篇:山東大學 軟體學院 區塊鏈技術
