第一个节点根目录:/nodes/bc01
mkdir -p /nodes/bc01/data
mkdir -p /nodes/bc01/log
mkdir -p /nodes/bc01/keystore
bcoseth --gennetworkrlp /nodes/bc01/data/network.rlp
cat /nodes/bc01/data/network.rlp.pub
结果:
a14e8837a86b42bbdb7edd672d06af4850232f1b8f5a988043ed71cb01f113549221b8c9971f5b183d46645469e18d174696f96b4f38c01b8076a49eb3972041
第一个节点的config.json:
{
"sealEngine": "PBFT",
"systemproxyaddress":"0x0",
"listenip":"127.0.0.1",
"rpcport": "8545",
"p2pport": "30303",
"wallet":"/nodes/bc01/keys.info",
"keystoredir":"/nodes/bc01/keystore/",
"datadir":"/nodes/bc01/data/",
"vm":"interpreter",
"networkid":"100",
"logverbosity":"4",
"coverlog":"OFF",
"eventlog":"ON",
"logconf":"/nodes/bc01/log.conf",
"params": {
"accountStartNonce": "0x0",
"maximumExtraDataSize": "0x0",
"tieBreakingGas": false,
"blockReward": "0x0",
"networkID": "0x0"
},
"NodeextraInfo":[
{
"Nodeid":"a14e8837a86b42bbdb7edd672d06af4850232f1b8f5a988043ed71cb01f113549221b8c9971f5b183d46645469e18d174696f96b4f38c01b8076a49eb3972041",
"Nodedesc": "test1",
"Agencyinfo": "test1",
"Peerip": "127.0.0.1",
"Identitytype": 1,
"Port":30303,
"Idx":0
}
]
}
第一个节点的genesis.json:
{
"nonce": "0x0",
"difficulty": "0x0",
"mixhash": "0x0",
"coinbase": "0x0",
"timestamp": "0x0",
"parentHash": "0x0",
"extraData": "0x0",
"gasLimit": "0x13880000000000",
"god":"0xbc45a3b978f790b3da82a62b525cee499f451c5e",
"alloc": {},
"initMinerNodes":["a14e8837a86b42bbdb7edd672d06af4850232f1b8f5a988043ed71cb01f113549221b8c9971f5b183d46645469e18d174696f96b4f38c01b8076a49eb3972041"]
}
然后,启动第一个节点:
bcoseth --genesis /nodes/bc01/genesis.json --config /nodes/bc01/config.json
看日志,已经成功在出块了。
第一个节点启动成功之后,部署系统合约
cd systemcontractv2
cnpm install
vim config.js
babel-node deploy.js
之后,vim node1.json
{
"id":"a14e8837a86b42bbdb7edd672d06af4850232f1b8f5a988043ed71cb01f113549221b8c9971f5b183d46645469e18d174696f96b4f38c01b8076a49eb3972041",
"ip":"127.0.0.1",
"port":30303,
"category":1,
"desc":"test1",
"CAhash":"",
"agencyinfo":"test1",
"idx":0
}
添加创世节点入网
babel-node tool.js NodeAction registerNode node1.json
验证
babel-node tool.js NodeAction all
已经成功加入
至此,第一个节点已经完成
-----------------------------------------------------------------------------------------------------------
第二个节点根目录:/nodes/bc02
mkdir -p /nodes/bc02/data
mkdir -p /nodes/bc02/log
mkdir -p /nodes/bc02/keystore
bcoseth --gennetworkrlp /nodes/bc02/data/network.rlp
cat /nodes/bc02/data/network.rlp.pub
结果:
8ed98503886110de3ffe54d219235c57458ab0fb8d552b2957eea898d538ca5fed9da0e5a6e9b77f5bb9aea6623d12b20a770d209bf76d1dc8acb228ea2c778c
第二个节点的config.json:
{
"sealEngine": "PBFT",
"systemproxyaddress":"0x0",
"listenip":"127.0.0.1",
"rpcport": "8546",
"p2pport": "30304",
"wallet":"/nodes/bc02/keys.info",
"keystoredir":"/nodes/bc02/keystore/",
"datadir":"/nodes/bc02/data/",
"vm":"interpreter",
"networkid":"100",
"logverbosity":"4",
"coverlog":"OFF",
"eventlog":"ON",
"logconf":"/nodes/bc02/log.conf",
"params": {
"accountStartNonce": "0x0",
"maximumExtraDataSize": "0x0",
"tieBreakingGas": false,
"blockReward": "0x0",
"networkID": "0x0"
},
"NodeextraInfo":[
{
"Nodeid":"a14e8837a86b42bbdb7edd672d06af4850232f1b8f5a988043ed71cb01f113549221b8c9971f5b183d46645469e18d174696f96b4f38c01b8076a49eb3972041",
"Nodedesc": "test1",
"Agencyinfo": "test1",
"Peerip": "127.0.0.1",
"Identitytype": 1,
"Port":30303,
"Idx":0
},
{
"Nodeid":"8ed98503886110de3ffe54d219235c57458ab0fb8d552b2957eea898d538ca5fed9da0e5a6e9b77f5bb9aea6623d12b20a770d209bf76d1dc8acb228ea2c778c",
"Nodedesc": "test2",
"Agencyinfo": "test2",
"Peerip": "127.0.0.1",
"Identitytype": 1,
"Port":30304,
"Idx":1
}
]
}
genesis.json文件和第一个节点文件一样(直接从第一个节点拷贝过来)
然后,启动第二个节点:
bcoseth --genesis /nodes/bc02/genesis.json --config /nodes/bc02/config.json
启动之后,第二个节点出不了快了。但是端口已经启动了
error_log_2017110411.log
fatal_log_2017110411.log
里面没有错误信息
错误日志如下:
info_log_2017110411.log 内容如下:
INFO|2017-11-04 11:03:54|CAVerify is false.
INFO|2017-11-04 11:03:54|⧎ ✘|⧎ ✘ 11:03:54 AM.528|p2p|a14e8837…|eth/v1.3.0/Linux/g++/Interpreter/RelWithDebInfo/c6bd28ad*/ Error sending: Broken pipe
INFO|2017-11-04 11:03:54|⧎ ✘|⧎ ✘ 11:03:54 AM.528|p2p|a14e8837…|eth/v1.3.0/Linux/g++/Interpreter/RelWithDebInfo/c6bd28ad*/ Closing tcp://0.0.0.0:0 ( Low-level TCP communication error. )
INFO|2017-11-04 11:03:54|⧎ ✘|⧎ ✘ 11:03:54 AM.528|p2p|a14e8837…|eth/v1.3.0/Linux/g++/Interpreter/RelWithDebInfo/c6bd28ad*/ EthereumPeer::~EthereumPeer
INFO|2017-11-04 11:03:59|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Report: blk=0,hash=4c5840d0…,idx=0, Next: blk=1
INFO|2017-11-04 11:03:59|--BLOCKSTAT--|--BLOCKSTAT-- 11:03:59 AM.461|eth BLOCK_TIMESTAMP_STAT:[ ][ 1 ][ 1509764639461 ][ commitToSeal ]
INFO|2017-11-04 11:03:59|+++++++++++++++++++++++++++ Generating seal on b99d2abb…#1tx:0
INFO|2017-11-04 11:03:59|--BLOCKSTAT--|--BLOCKSTAT-- 11:03:59 AM.462|eth BLOCK_TIMESTAMP_STAT:[ b99d2abbf9170e1a0741c06a0277374b1b46903baeb3cbe61ba72e52ecb70ea7 ][ 1 ][ 1509764639462 ][ broadcastPrepareReq ]
INFO|2017-11-04 11:04:24|⧎ ✘|⧎ ✘ 11:04:24 AM.417|p2p Host::keepAlivePeers erase ##a14e8837…
INFO|2017-11-04 11:04:52|collectGarbage timecost(ms)=0.005
INFO|2017-11-04 11:04:54| getSelfSignData hash is 1cd413536c891c6df7f6cd7ed9ab3be195563938d17fa66f6cb0c52363d90c9e|nodeid is 8ed98503886110de3ffe54d219235c57458ab0fb8d552b2957eea898d538ca5fed9da0e5a6e9b77f5bb9aea6623d12b20a770d209bf76d1dc8acb228ea2c778c|agenceinfo is test2|ip is 127.0.0.1
INFO|2017-11-04 11:04:54|ConstructHandShakeRLP, pub256:,nodeSign:ecd83707f22a0fc6192b7d6fe53bbf2187b63585f1aff706d33ddfa995c2b5db5e557ab2c5e9215457fa846614616899a6212abf591fb489e073761917a28e7a00,nodeId:8ed98503886110de3ffe54d219235c57458ab0fb8d552b2957eea898d538ca5fed9da0e5a6e9b77f5bb9aea6623d12b20a770d209bf76d1dc8acb228ea2c778c
INFO|2017-11-04 11:04:54|SerializeHandShakeRLP,pub:a14e8837a86b42bbdb7edd672d06af4850232f1b8f5a988043ed71cb01f113549221b8c9971f5b183d46645469e18d174696f96b4f38c01b8076a49eb3972041,signature:6bca1de3f20a17c1e0916932001c4a3c1704f1a3395ba05eca7f7bfcbb1ac8e406b5b057f2b71c50fa8d4d2dce2a9fe538736a1fe4721a37e51bdfe26eac433200,caPub256:
INFO|2017-11-04 11:04:54| checkNodeConnInfo nodeid is a14e8837a86b42bbdb7edd672d06af4850232f1b8f5a988043ed71cb01f113549221b8c9971f5b183d46645469e18d174696f96b4f38c01b8076a49eb3972041| sign is 6bca1de3f20a17c1e0916932001c4a3c1704f1a3395ba05eca7f7bfcbb1ac8e406b5b057f2b71c50fa8d4d2dce2a9fe538736a1fe4721a37e51bdfe26eac433200
INFO|2017-11-04 11:04:54|checkNodeConnInfo hash is 0a41de2a2cfe038ac409bbec4009d6dc53067f424ede00cee6901a74ba30f54e|a14e8837a86b42bbdb7edd672d06af4850232f1b8f5a988043ed71cb01f113549221b8c9971f5b183d46645469e18d174696f96b4f38c01b8076a49eb3972041|test1|127.0.0.1
INFO|2017-11-04 11:04:54|CAVerify is false.
INFO|2017-11-04 11:04:54|⧎ ✘|⧎ ✘ 11:04:54 AM.612|p2p|a14e8837…|eth/v1.3.0/Linux/g++/Interpreter/RelWithDebInfo/c6bd28ad*/ Error sending: Broken pipe
INFO|2017-11-04 11:04:54|⧎ ✘|⧎ ✘ 11:04:54 AM.613|p2p|a14e8837…|eth/v1.3.0/Linux/g++/Interpreter/RelWithDebInfo/c6bd28ad*/ Closing tcp://0.0.0.0:0 ( Low-level TCP communication error. )
INFO|2017-11-04 11:04:54|⧎ ✘|⧎ ✘ 11:04:54 AM.614|p2p|a14e8837…|eth/v1.3.0/Linux/g++/Interpreter/RelWithDebInfo/c6bd28ad*/ EthereumPeer::~EthereumPeer
INFO|2017-11-04 11:05:24|⧎ ✘|⧎ ✘ 11:05:24 AM.491|p2p Host::keepAlivePeers erase ##a14e8837…
INFO|2017-11-04 11:05:52|collectGarbage timecost(ms)=0.001
warn_log_2017110411.log
WARNING|2017-11-04 11:03:54|New session for capabilityeth; idOffset:16; protocolID:0
WARNING|2017-11-04 11:03:54|New session for capabilitypbft; idOffset:35; protocolID:0
WARNING|2017-11-04 11:03:54|New session for capabilityeth; idOffset:16; protocolID:0
WARNING|2017-11-04 11:03:54|New session for capabilitypbft; idOffset:35; protocolID:0
WARNING|2017-11-04 11:04:54|New session for capabilityeth; idOffset:16; protocolID:0
WARNING|2017-11-04 11:04:54|New session for capabilitypbft; idOffset:35; protocolID:0
WARNING|2017-11-04 11:05:54|New session for capabilityeth; idOffset:16; protocolID:0
WARNING|2017-11-04 11:05:54|New session for capabilitypbft; idOffset:35; protocolID:0
WARNING|2017-11-04 11:06:54|New session for capabilityeth; idOffset:16; protocolID:0
WARNING|2017-11-04 11:06:54|New session for capabilitypbft; idOffset:35; protocolID:0
WARNING|2017-11-04 11:07:54|New session for capabilityeth; idOffset:16; protocolID:0
WARNING|2017-11-04 11:07:54|New session for capabilitypbft; idOffset:35; protocolID:0
WARNING|2017-11-04 11:08:54|New session for capabilityeth; idOffset:16; protocolID:0
WARNING|2017-11-04 11:08:54|New session for capabilitypbft; idOffset:35; protocolID:0
WARNING|2017-11-04 11:09:54|New session for capabilityeth; idOffset:16; protocolID:0
WARNING|2017-11-04 11:09:54|New session for capabilitypbft; idOffset:35; protocolID:0
WARNING|2017-11-04 11:10:54|New session for capabilityeth; idOffset:16; protocolID:0
WARNING|2017-11-04 11:10:54|New session for capabilitypbft; idOffset:35; protocolID:0
WARNING|2017-11-04 11:11:54|New session for capabilityeth; idOffset:16; protocolID:0
log_2017110411.log
INFO|2017-11-04 11:10:54|CAVerify is false.
WARNING|2017-11-04 11:10:54|New session for capabilityeth; idOffset:16; protocolID:0
TRACE|2017-11-04 11:10:54|EthereumHost::newPeerCapability totalDifficulty=0,number=0
WARNING|2017-11-04 11:10:54|New session for capabilitypbft; idOffset:35; protocolID:0
DEBUG|2017-11-04 11:10:54|⧎ ◌|⧎ ◌ 11:10:54 AM.878|p2p|a14e8837…|eth/v1.3.0/Linux/g++/Interpreter/RelWithDebInfo/c6bd28ad*/ Disconnect (reason: Unexpected identity given. )
INFO|2017-11-04 11:10:54|⧎ ✘|⧎ ✘ 11:10:54 AM.878|p2p|a14e8837…|eth/v1.3.0/Linux/g++/Interpreter/RelWithDebInfo/c6bd28ad*/ Closing tcp://127.0.0.1:30303 ( Disconnect was requested. )
DEBUG|2017-11-04 11:10:54|⧎ ◌|⧎ ◌ 11:10:54 AM.878|p2p|a14e8837…|eth/v1.3.0/Linux/g++/Interpreter/RelWithDebInfo/c6bd28ad*/ Closing peer session :-(
TRACE|2017-11-04 11:10:54|Peer aborting while being asked for State
INFO|2017-11-04 11:10:54|⧎ ✘|⧎ ✘ 11:10:54 AM.878|p2p|a14e8837…|eth/v1.3.0/Linux/g++/Interpreter/RelWithDebInfo/c6bd28ad*/ EthereumPeer::~EthereumPeer
TRACE|2017-11-04 11:10:54|onPeerAborting call continueSync
TRACE|2017-11-04 11:11:09|Since 2017-11-04 03:10:54.824Z (15): 15ticks
INFO|2017-11-04 11:11:24|⧎ ✘|⧎ ✘ 11:11:24 AM.910|p2p Host::keepAlivePeers erase ##a14e8837…
TRACE|2017-11-04 11:11:25|Since 2017-11-04 03:11:09.911Z (15): 15ticks
TRACE|2017-11-04 11:11:40|Since 2017-11-04 03:11:25.0000Z (15): 15ticks
INFO|2017-11-04 11:11:52|collectGarbage timecost(ms)=0.001
TRACE|2017-11-04 11:11:54|NodeConnParamsManager::connNodeenode://a14e8837a86b42bbdb7edd672d06af4850232f1b8f5a988043ed71cb01f113549221b8c9971f5b183d46645469e18d174696f96b4f38c01b8076a49eb3972041@127.0.0.1:30303 Valid=1
TRACE|2017-11-04 11:11:54|NodeConnParamsManager::connNode startenode://a14e8837a86b42bbdb7edd672d06af4850232f1b8f5a988043ed71cb01f113549221b8c9971f5b183d46645469e18d174696f96b4f38c01b8076a49eb3972041@127.0.0.1:30303 Valid=1
TRACE|2017-11-04 11:11:54|WebThreeDirect::addPeer
TRACE|2017-11-04 11:11:54|Host::addPeerenode://a14e8837a86b42bbdb7edd672d06af4850232f1b8f5a988043ed71cb01f113549221b8c9971f5b183d46645469e18d174696f96b4f38c01b8076a49eb3972041@127.0.0.1:30303
TRACE|2017-11-04 11:11:54|Host::addPeer Required
TRACE|2017-11-04 11:11:54|Host::requirePeera14e8837a86b42bbdb7edd672d06af4850232f1b8f5a988043ed71cb01f113549221b8c9971f5b183d46645469e18d174696f96b4f38c01b8076a49eb3972041
TRACE|2017-11-04 11:11:54|NodeTable::addNode a14e8837a86b42bbdb7edd672d06af4850232f1b8f5a988043ed71cb01f113549221b8c9971f5b183d46645469e18d174696f96b4f38c01b8076a49eb3972041,1
TRACE|2017-11-04 11:11:54|NodeTable::noteActiveNode a14e8837a86b42bbdb7edd672d06af4850232f1b8f5a988043ed71cb01f113549221b8c9971f5b183d46645469e18d174696f96b4f38c01b8076a49eb3972041,127.0.0.1:30303
INFO|2017-11-04 11:11:54| getSelfSignData hash is 1cd413536c891c6df7f6cd7ed9ab3be195563938d17fa66f6cb0c52363d90c9e|nodeid is 8ed98503886110de3ffe54d219235c57458ab0fb8d552b2957eea898d538ca5fed9da0e5a6e9b77f5bb9aea6623d12b20a770d209bf76d1dc8acb228ea2c778c|agenceinfo is test2|ip is 127.0.0.1
INFO|2017-11-04 11:11:54|ConstructHandShakeRLP, pub256:,nodeSign:ecd83707f22a0fc6192b7d6fe53bbf2187b63585f1aff706d33ddfa995c2b5db5e557ab2c5e9215457fa846614616899a6212abf591fb489e073761917a28e7a00,nodeId:8ed98503886110de3ffe54d219235c57458ab0fb8d552b2957eea898d538ca5fed9da0e5a6e9b77f5bb9aea6623d12b20a770d209bf76d1dc8acb228ea2c778c
DEBUG|2017-11-04 11:11:54|⧎ ◌|⧎ ◌ 11:11:54 AM.943|p2p Hello: eth/v1.3.0/Linux/g++/Interpreter/RelWithDebInfo/c6bd28ad*/ V[ 4 ] ##a14e8837… (eth,63)(pbft,63) 30303
INFO|2017-11-04 11:11:54|SerializeHandShakeRLP,pub:a14e8837a86b42bbdb7edd672d06af4850232f1b8f5a988043ed71cb01f113549221b8c9971f5b183d46645469e18d174696f96b4f38c01b8076a49eb3972041,signature:6bca1de3f20a17c1e0916932001c4a3c1704f1a3395ba05eca7f7bfcbb1ac8e406b5b057f2b71c50fa8d4d2dce2a9fe538736a1fe4721a37e51bdfe26eac433200,caPub256:
INFO|2017-11-04 11:11:54| checkNodeConnInfo nodeid is a14e8837a86b42bbdb7edd672d06af4850232f1b8f5a988043ed71cb01f113549221b8c9971f5b183d46645469e18d174696f96b4f38c01b8076a49eb3972041| sign is 6bca1de3f20a17c1e0916932001c4a3c1704f1a3395ba05eca7f7bfcbb1ac8e406b5b057f2b71c50fa8d4d2dce2a9fe538736a1fe4721a37e51bdfe26eac433200
INFO|2017-11-04 11:11:54|checkNodeConnInfo hash is 0a41de2a2cfe038ac409bbec4009d6dc53067f424ede00cee6901a74ba30f54e|a14e8837a86b42bbdb7edd672d06af4850232f1b8f5a988043ed71cb01f113549221b8c9971f5b183d46645469e18d174696f96b4f38c01b8076a49eb3972041|test1|127.0.0.1
INFO|2017-11-04 11:11:54|CAVerify is false.
WARNING|2017-11-04 11:11:54|New session for capabilityeth; idOffset:16; protocolID:0
TRACE|2017-11-04 11:11:54|EthereumHost::newPeerCapability totalDifficulty=0,number=0
WARNING|2017-11-04 11:11:54|New session for capabilitypbft; idOffset:35; protocolID:0
INFO|2017-11-04 11:11:54|⧎ ✘|⧎ ✘ 11:11:54 AM.945|p2p|a14e8837…|eth/v1.3.0/Linux/g++/Interpreter/RelWithDebInfo/c6bd28ad*/ Error sending: Broken pipe
INFO|2017-11-04 11:11:54|⧎ ✘|⧎ ✘ 11:11:54 AM.945|p2p|a14e8837…|eth/v1.3.0/Linux/g++/Interpreter/RelWithDebInfo/c6bd28ad*/ Closing tcp://0.0.0.0:0 ( Low-level TCP communication error. )
DEBUG|2017-11-04 11:11:54|⧎ ◌|⧎ ◌ 11:11:54 AM.945|p2p|a14e8837…|eth/v1.3.0/Linux/g++/Interpreter/RelWithDebInfo/c6bd28ad*/ Disconnect (reason: Unexpected identity given. )
DEBUG|2017-11-04 11:11:54|⧎ ◌|⧎ ◌ 11:11:54 AM.945|p2p|a14e8837…|eth/v1.3.0/Linux/g++/Interpreter/RelWithDebInfo/c6bd28ad*/ Closing peer session :-(
TRACE|2017-11-04 11:11:54|Peer aborting while being asked for State
INFO|2017-11-04 11:11:54|⧎ ✘|⧎ ✘ 11:11:54 AM.945|p2p|a14e8837…|eth/v1.3.0/Linux/g++/Interpreter/RelWithDebInfo/c6bd28ad*/ EthereumPeer::~EthereumPeer
TRACE|2017-11-04 11:11:54|onPeerAborting call continueSync
TRACE|2017-11-04 11:11:55|Since 2017-11-04 03:11:40.091Z (15): 15ticks
TRACE|2017-11-04 11:12:10|Since 2017-11-04 03:11:55.183Z (15): 15ticks
INFO|2017-11-04 11:12:24|⧎ ✘|⧎ ✘ 11:12:24 AM.979|p2p Host::keepAlivePeers erase ##a14e8837…