Blockchain | geth1.12的一些问题
Blockchain | geth1.12的一些问题
最近重装了geth,是最新的geth version 1.12.2-stable-bed84606
但是这个版本似乎挖不了矿了,不再PoW了。
还是跟之前一样的创世区块:
{
"config":{
"chainId": 15,
"homesteadBlock": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0
},
"nonce": "0x0000000000000033",
"timestamp": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"gaslimit": "0x8000000",
"difficulty": "0x100",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x3333333333333333333333333333333333333333",
"alloc": {}
}
然后用geth初始化链子:
geth --datadir . init C:\Users\mz1\Desktop\testchain\genesis.json
然后导入一个账户:
geth --datadir . account import C:\Users\mz1\Desktop\testchain\privatekey1.txt
然后启动:
geth --datadir . --nodiscover --networkid 15 --http
然后无法挖矿。
具体的问题可以参考:https://ethereum.stackexchange.com/questions/150714/fatal-failed-to-register-the-ethereum-service-ethash-is-only-supported-as-a-hi
反正就是关闭了工作量证明:
有一种方式就是在创世区块中分配初始资产:
但是还是要启动clique模式好像。。。这部分没搞清楚,先降级到1.11.6了。
在这个版本中需要在创世区块中指定共识算法,poa或者pow。
poa我还是没太弄明白怎么配置,就先配置了pow。
创世区块如下:
{
"config":{
"chainId": 15,
"homesteadBlock": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0,
"ethash": {} // 显式指定共识算法
},
"nonce": "0x0000000000000033",
"timestamp": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"gaslimit": "0x8000000",
"difficulty": "0x1000",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x3333333333333333333333333333333333333333",
"alloc": {
"0xda8e0A6Becd46E3C1d25BEbcc0E8f6723Cf2F924":{ // 来点起始资金
"balance": "1000000000000000000000000000000000000000000000000000000000"
}
}
}
还有我启动链子的命令:
echo "启动链子"
geth --datadir . --networkid 15 --nodiscover --http --mine --miner.etherbase 0xda8e0A6Becd46E3C1d25BEbcc0E8f6723Cf2F924 --miner.threads 1
pause
本文来自博客园,作者:Mz1,转载请注明原文链接:https://www.cnblogs.com/Mz1-rc/p/17669635.html
如果有问题可以在下方评论或者email:mzi_mzi@163.com