Cypherium 同步区块链测试步骤。以下步骤适用于同一台机子测试。如果使用两台电脑测试,则有关第二节点的操作在另一台机子上执行即可。以下命令请在cypherium_private/go-cypherium路径下执行。
1 2 3 4 5 6 7 8 9 |
~/workspace/test ⌚ 14:02:17
$ tree
.
├── genesis.json
├── group.toml
├── node_01
│ ├── data
└── node_02
├── data
|
1 |
make clean |
1 |
make cypher |
1 |
./build/bin/cypher setup |
需要输入 ip:端口,用于测试使用kyber的Ed25519算法生成public.toml和private.toml,保存在默认路径。目前没做ip发现,所以需手动拼接公钥~/Library/Application\ Support/cypher/public.toml(Mac默认路径),用于模拟测试。节点名字可自定义,如node_01_name。

同理,再生成第二个节点。
把第一、二个节点的public.toml,拼接到~/workspace/test/group.toml中。

第一个节点:
1 |
./build/bin/cypher --datadir "~/workspace/test/node_01/data" init ~/workspace/test/genesis.json |
第二个节点:
1 |
./build/bin/cypher --datadir "~/workspace/test/node_02/data" init ~/workspace/test/genesis.json |
genesis.json中内容可参考:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
{
"config": {
"chainId": 123666,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"alloc" : {},
"coinbase" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x20000",
"extraData" : "",
"gasLimit" : "0x2fefd8",
"nonce" : "0x0000000000000042",
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp" : "0x00"
}
|
1 |
./build/bin/cypher --onetdir ~/workspace/test/node_01/private.toml --datadir ~/workspace/test/node_01/data --publickeydir ~/workspace/test/group.toml --networkid 123666 --port 7010 --rpcport 8510 --rpc --rpccorsdomain "*" --rpcaddr 0.0.0.0 --rpcapi eth,web3,personal --verbosity 5 2> ~/workspace/test/node_01/output2.log |
1 |
./build/bin/cypher attach ~/workspace/test/node_01/data/cypher.ipc |
1 |
./build/bin/cypher --onetdir ~/workspace/test/node_02/private.toml --datadir ~/workspace/test/node_02/data --publickeydir ~/workspace/test/group.toml --networkid 123666 --port 7020 --rpcport 8520 --rpc --rpccorsdomain "*" --rpcaddr 0.0.0.0 --rpcapi eth,web3,personal --verbosity 5 2> ~/workspace/test/node_02/output2.log |
1 |
./build/bin/cypher attach ~/workspace/test/node_02/data/cypher.ipc |

1 |
admin.nodeInfo |
1 |
personal.newAccount("password")
|
1 |
admin.addPeer("cnode")
|
1 |
net |
1 |
bftcosi.start() |
1 |
bftcosi.stop() |

1 |
personal.unlockAccount("需解锁账户")
|

1 |
txpool.status |
会显示
1 2 3 4 |
{
pending: 0,
queued: 0
}
|
