创建创世区块文件->初始化区块->启动节点
一、初始化节点报错Fatal: Failed to write genesis block: unsupported fork ordering: eip150Block not enabled, but eip155Block enabled at 0 genesis block
解决方法:
在genesis.json文件中添加 eip150Block字段信息。全文更新后如下:
{ "config": { "chainId": 20210311, "homesteadBlock": 0, "eip150Block": 0, "eip155Block": 0, "eip158Block": 0 }, "alloc" : {}, "coinbase" : "0x0000000000000000000000000000000000000000", "difficulty" : "0x20000", "extraData" : "", "gasLimit" : "0x2fefd8", "nonce" : "0x0000000000000042", "mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "timestamp" : "0x00" }
二、对等节点发现问题:
先使用admin.nodeInfo查询需要连接节点到信息,如:
{ enode: "enode://fb161d7fd7cdce3fc0ddefb9a54c84ccd128aa8f6e0adfab157557f778e0305256f330e5ed8d423a354bcab8fff4cc04635a6c1bad45f796cc68e11aeb1997de@119.123.132.69:30303?discport=65158", enr: "enr:-J-4QIrKejUxOYUS5-afohUOn4m9W8Xp535guMxGxvBd7AelL8pEXrnrYGrtnu5-UngNRbWwuzQBQyE9uiW2dKdU7g8Eg2V0aMfGhHEB0w2AgmlkgnY0gmlwhHd7hEWJc2VjcDI1NmsxoQL7Fh1_183OP8Dd77mlTITM0Siqj24K36sVdVf3eOAwUoN0Y3CCdl-DdWRwgv6GhHVkcDaCdl8", id: "daa0fcd9bda92ac86222ba00232db20b4642cd6e376489707ec6dbcb20321fea", ip: "119.123.132.69", listenAddr: "[::]:30303", name: "Geth/v1.9.6-stable-bd059680/windows-amd64/go1.13", ports: { discovery: 65158, listener: 30303 }, protocols: { eth: { config: { chainId: 20210312, eip150Block: 0, eip150Hash: "0x0000000000000000000000000000000000000000000000000000000000000000", eip155Block: 0, eip158Block: 0, homesteadBlock: 0 }, difficulty: 17419421, genesis: "0x5e1fc79cb4ffa4739177b5408045cd5d51c6cf766133f23f7cd72ee1f8d790e0", head: "0xf32af07450d30f5472346288c244f6b50148e0351d3386426fb10d09cac2dc8f", network: 20210312 } } }
然后执行
admin.addPeer("enode://fb161d7fd7cdce3fc0ddefb9a54c84ccd128aa8f6e0adfab157557f778e0305256f330e5ed8d423a354bcab8fff4cc04635a6c1bad45f796cc68e11aeb1997de@119.123.132.69:30303?discport=65158")
括号内的内容即为上面查询到的enode信息。