我试图在两台机器上创建一个私有以太网网络(Windows 10) . 对于我使用相同的genesis文件的所有节点:
{
"config": {
"chainId": 1111,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"difficulty": "200000000",
"gasLimit": "2100000",
"alloc": {
"7df9a875a174b3bc565e6424a0050ebc1b2d1d82": { "balance": "300000" },
"f41c74c9ae680c1aa78f42e5647a62f353b7bdde": { "balance": "400000" }
}
}
我用以下链接初始化了链目录:
geth init conf/genesis.json --datadir <chain directory for the node>
并运行控制台:
geth --networkid 123 --datadir <chain directory for the node> --rpc --rpcport <rcp port for the node> --port <port for the node> --nodiscover console –ipcdisable
但是,当我尝试使用时将对等体添加到节点
admin.addPeer("enode://.....@<ip>:<port>)
我开始收到"Genesis block mismatch"和"network id mismatch"错误(参见下面的完整日志),即使所有节点都使用相同的genesis文件和相同的网络ID . 当我检查节点信息时,两台机器上的所有节点的genesis散列都是相同的 . 在一台机器上,我设法通过删除所有链目录并重新创建网络来解决这个问题(解决方案取自https://www.queryoverflow.gdn/query/addpeer-doesn-39-t-work-29_12122.html) . 但是,当连接到远程主机上的节点时,这不起作用 . 一般而言,删除链目录以便能够同步节点的需求似乎很奇怪 .
有人知道这背后的真正问题是什么?
DEBUG[02-21|23:24:25] Adding p2p peer id=bbaa8cba3eedc9f0 name=Geth/v1.7.3-stable-4... addr=159.65.22.22:30303 peers=1
DEBUG[02-21|23:24:25] Ethereum peer connected id=bbaa8cba3eedc9f0 conn=dyndial name=Geth/v1.7.3-stable-4bb3c89d/linux-amd64/go1.9
DEBUG[02-21|23:24:25] Ethereum handshake failed id=bbaa8cba3eedc9f0 conn=dyndial err="Genesis block mismatch - a470ecb23d5635bb (!= d4e56740f876aef8)"
DEBUG[02-21|23:24:25] Removing p2p peer id=bbaa8cba3eedc9f0 conn=dyndial duration=34.855ms peers=0 req=false err="Genesis block mismatch - a470ecb23d5635bb (!= d4e56740f876aef8)"
DEBUG[02-21|23:24:25] Adding p2p peer id=64bba669e16c6968 name=Parity/v1.8.5-beta-5... addr=81.2.240.250:30303 peers=1
DEBUG[02-21|23:24:25] Ethereum peer connected id=64bba669e16c6968 conn=dyndial name=Parity/v1.8.5-beta-54bae9a-20171228/x86_64-linux-gnu/rustc1.22.1
DEBUG[02-21|23:24:25] Adding p2p peer id=874f623a2e3d6aa8 name=Geth/v1.7.3-stable-4... addr=213.152.161.133:5089 peers=2
DEBUG[02-21|23:24:25] Ethereum peer connected id=874f623a2e3d6aa8 conn=dyndial name=Geth/v1.7.3-stable-4bb3c89d/linux-amd64/go1.9.2
DEBUG[02-21|23:24:25] Ethereum handshake failed id=874f623a2e3d6aa8 conn=dyndial err="NetworkId mismatch - 1 (!= 123)"
DEBUG[02-21|23:24:25] Removing p2p peer id=874f623a2e3d6aa8 conn=dyndial duration=138.434ms peers=1 req=true err="subprotocol error"
DEBUG[02-21|23:24:25] Ethereum handshake failed id=64bba669e16c6968 conn=dyndial err="NetworkId mismatch - 1 (!= 123)"