1、创建钱包
下载CKB最新版本:
15版
curl -O -L https://github.com/nervosnetwork/ckb/releases/download/v0.15.0/ckb_v0.15.0_x86_64-apple-darwin.zip
curl -O -L https://github.com/nervosnetwork/ckb/releases/download/v0.15.0/ckb_v0.15.0_x86_64-apple-darwin.zip.asc
16预发布版本
curl -O -L https://github.com/nervosnetwork/ckb/releases/download/v0.16.0/ckb_v0.16.0_x86_64-apple-darwin.zip
解压缩文件 并将CKb-cli添加到系统Path
15版本
unzip ckb_v0.15.0_x86_64-apple-darwin.zip && cd ckb_v0.15.0_x86_64-apple-darwin
16预发布版本
unzip ckb_v0.16.0_x86_64-apple-darwin.zip && cd ckb_v0.16.0_x86_64-apple-darwin
将命令添加都系统环境:
sudo ln -snf "$(pwd)/ckb" /usr/local/bin/ckb
sudo ln -snf "$(pwd)/ckb-cli" /usr/local/bin/ckb-cli
安装成功查看安装版本信息
ckb --version
ckb-cli --version
结果:
zhous-MBP-2:ckb_v0.15.0_x86_64-apple-darwin zhou*$ ckb --version
ckb 0.15.0 (rylai-v4 7cb6cff 2019-06-29)
zhous-MBP-2:ckb_v0.15.0_x86_64-apple-darwin zhou*$ ckb-cli --version
ckb-cli 0.15.0 (e1a73e6 2019-06-29)
1.1创建钱包:
zhous-MBP-2:ckb_v0.15.0_x86_64-apple-darwin zhou*$ ckb-cli account new
Your new account is locked with a password. Please give a password. Do not forget this password.
Password: 输入密码
Repeat password: 从新输入密码
address:
mainnet: ckb1q9gry5zg6keaxmq6luzuj0lsv93havkzl5qfl70jwc2zcc
testnet: ckt1q9gry5zg6keaxmq6luzuj0lsv93havkzl5qfl70jyyjcf2
lock_arg: d5b3d36c1aff05c93ff061637eb2c2fd009ff9f2
解释:
lock_arg:需要配置您的挖矿软件以及导出您的私钥,所以请备份它。
address:生成的钱包地址
1.2 导出钱包的私钥
用上面生成的lock_arg替换下面的–lock-arg;
ckb-cli account export –lock-arg d5b3d36c1aff05c93ff061637eb2c2fd009ff9f2 –extended-privkey-path privkey
zhous-MBP-2:ckb_v0.15.0_x86_64-apple-darwin zhou*$ ckb-cli account export --lock-arg d5b3d36c1aff05c93ff061637eb2c2fd009ff9f2 --extended-privkey-path privkey
Password: 输入创建钱包的密码
Success exported account as extended privkey to: “privkey”, please use this file carefully
zhous-MBP-2:ckb_v0.15.0_x86_64-apple-darwin zhou*$ ls
CHANGELOG.md COPYING README.md ckb ckb-cli docs init privkey
1.2 查看privkey内容
zhous-MBP-2:ckb_v0.15.0_x86_64-apple-darwin zhou*$ view privkey
893344d3a4195493df00bfb34363371b3dbbeba677f9ad565d7adc26c6230e7c
5f5decee1e5024e5b17f5e8ca415508bc7a53dceff789b369227f918e2f2cbdf
2、运行CKC节点
1.1创建配置文件
ckb init -C ckb-testnet --chain testnet &&
cd ckb-testnet
创建的结果:
zhous-MBP-2:ckb_v0.15.0_x86_64-apple-darwin zhou*$ ckb init -C ckb-testnet --chain testnet && \
> cd ckb-testnet
WARN: mining feature is disabled because of lacking the block assembler config options
Initialized CKB directory in ckb-testnet
create ckb.toml
create ckb-miner.toml
zhous-MBP-2:ckb-testnet zhou*$ ls
ckb-miner.toml ckb.toml
1.2修改ckb.toml配置
在ckb-testnet文件夹中找到ckb.toml文件,它包含你的CKB节点的的配置信息,
开始挖矿前,你需要添加[block_assembler]参数到ckb.toml文件中;
打开ckb.toml文件,添加以下的参数到文件最后;将args换成,生成钱包时的LOCK_ARG;
[block_assembler]
code_hash = “0x94334bdda40b69bae067d84937aa6bbccf8acd0df6626d4b9ac70d4612a11933”
args = [ “0x<LOCK_ARG>” ]
替换后的内容如下;— 保存修改后的文件
[block_assembler]
code_hash = “0x94334bdda40b69bae067d84937aa6bbccf8acd0df6626d4b9ac70d4612a11933”
args = [ “0xd5b3d36c1aff05c93ff061637eb2c2fd009ff9f2” ]
1.3启动节点
ckb run
结果;
zhous-MBP-2:ckb-testnet zhou*$ ckb run
2019-0 7 -11 19 :2 3:5 7. 523 +08 : 0 0 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-07-11 19:23 : 57. 5 53 + 08: 00 ma i n INFO ckb-db Initialize a new database
2019-07-11 19:23:57.734 +08:00 main INFO ckb-chain Start: loading live cells …
2019-07-11 19:23:57.735 +08:00 m ain INFO ckb-chain Done: total 1 transactions.
2019-07-11 19:23:57.737 +08:00 m a in INFO main chain genesis hash: 0xd5c54b0c699ef009edfedb00d8fb8198ac5ce1e9e266b9110a8972e1b05aba88
20 1 9-0 7-11 19:23:5 7 .742 +0 8: 00 m ai n INFO ckb-network Generate random key
2019-07 - 11 1 9: 23 :57 .7 43 + 08: 00 main INFO ckb-network write random secret key to “/Users/zhou*/mining/nervos07/ckb_v0.15.0_x86_64-apple-darwin/ckb-testnet/data/network/secret_key”
2019 -07 - 1 1 1 9:23 :57.769 +08:00 m ain INFO ckb-network No peer in peer store, start seeding…
2019-07-11 19: 2 3:5 7 .7 71 +08:0 0 ma in INFO ckb-network Listen on address: /ip4/0.0.0.0/tcp/8115/p2p/QmcK5ti1cZjYUsZzZemXz81F43thVhNFg9qt5yFhvwwyBp
2019-07-11 19:23: 57.7 74 +08: 0 0 NetworkRuntime-0 INFO ckb-network p2p service event: ListenStarted { address: “/ip4/0.0.0.0/tcp/8115” }
2019-07-11 19:23:58.209 +08:00 N e two r kR un tim e- 3 INFO ckb-relay RelayProtocol(1).connected peer=SessionId(1)
3、开始挖矿
打开另一个新的命令行窗口;
进入到ckb-testnet的文件夹中
运行CKB Miner
参考目录如下;
zhous-MBP-2:ckb-testnet zhou*$ pwd
/Users/zhou*/mining/nervos07/ckb_v0.15.0_x86_64-apple-darwin/ckb-testnet
目录内容如下
zhous-MBP-2:ckb-testnet zhou*$ ls
ckb-miner.toml ckb.toml data
zhous-MBP-2:ckb-testnet zhou*$
开始挖矿:
zhous-MBP-2:ckb-testnet zhouhe$ ckb miner
2019-0 7 -1 1 19:2 7: 1 1 .0 20 +08 : 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://48c6a88d92e246478[email protected]/1422795
Cu ckoo Simp l e -W o rker- 0 ⠈ [00:00:06] gps: 236.662 / cycles found: 118