Nervos 挖矿第二季(教程)— Mac+Docker --- command

挖矿只需要3步
1: 创建钱包
钱包创建请参考:Nervos 挖矿第二季(教程)--- Mac+Docker
2: 创建节点
3: 开始挖矿

1:通过命令行创建文件

vi ckb-build.command

复制以下内容到文件中

docker pull nervos/ckb:latest

docker volume create ckb-testnet

docker run --rm -it -v ckb-testnet:/var/lib/ckb nervos/ckb:latest init --spec testnet --force

docker create -it -v ckb-testnet:/var/lib/ckb --name ckb-testnet-node nervos/ckb:latest run

docker cp ckb-testnet-node:/var/lib/ckb/ckb.toml .

docker cp ckb-testnet-node:/var/lib/ckb/ckb-miner.toml .

echo $1 >> ckb.toml

echo $2 >> ckb.toml

echo $3 >> ckb.toml

chmod 777 ckb.toml

chmod 777 ckb-miner.toml

docker cp ckb.toml ckb-testnet-node:/var/lib/ckb/

docker cp ckb-miner.toml ckb-testnet-node:/var/lib/ckb/

docker start -i ckb-testnet-node

保存文件:wq!

2: 修改文件权限 chmod 777 ckb-build.command

3: 执行命令
./ckb-build.command [block_assembler] code_hash=’"‘0x9e3b3557f11b2b3532ce352bfe8017e9fd11d154c4c7f9b7aaaa1e621b539a08’"’ args=[’"‘0x23a51c47aeb69ff2b702ad6efb2f01a66a1d8d30’"’]

解释:
一共4个部分
./ ckb-build.command 执行文件
[block_assembler] 参数1
code_hash=’"‘0x9e3b3557f11b2b3532ce352bfe8017e9fd11d154c4c7f9b7aaaa1e621b539a08’"’ 参数2
args=[’"‘0x23a51c47aeb69ff2b702ad6efb2f01a66a1d8d30’"’] 参数3

其中参数1,2,3来自创建钱包;参数之间需要有空格

日志记录如下:
latest: Pulling from nervos/ckb

Digest: sha256:1783c323c88217c1b73925b603a204f9ecac7bd31ca459154c1d3a86bc603dd9

Status: Image is up to date for nervos/ckb:latest

ckb-testnet

Deprecated: Option --spec is deprecated, use --chain instead

Reinitialized CKB directory in /var/lib/ckb

create ckb.toml

create ckb-miner.toml

ee2a957f5a1ad6776c98c50732ad14eefae245ed82a5fe856b5f8c04b888839d

2019-06-05 15:17:45.947 +00:00 main INFO sentry Notice: The ckb process will send stack trace to sentry on Rust panics. This is enabled by default before mainnet, which can be opted out by setting the option dsn to empty in the config file. The DSN is now https://[email protected]/1422795

2019-06-05 15:17:46.304 +00:00 main INFO main chain genesis hash: 0xeb897810b75a922309d748c0d16e7a980e0de1cc0ba0e0e3e3bda6f2e03cbc1b

201

4: 当确定节点正常启动之后,执行挖矿命令(在同一个文件夹下)

docker exec ckb-testnet-node ckb miner

2019-06-05 15:18:55.422 +00:00 main INFO sentry Notice: The ckb process will send stack trace to sentry on Rust panics. This is enabled by default before mainnet, which can be opted out by setting the option dsn to empty in the config file. The DSN is now https://[email protected]/1422795

2019-06-05 15:25:40.418 +00:00 main INFO miner found seal: Seal { nonce: 6567622239665910161, proof: 0x32000000ca020000c604000048080000cc36000059420000be46000067490000a35800006c640000a16f0000b77e0000 }