Go-Ethereum
如何讓私有鏈的乙太坊挖礦難度靜態化?
我已經在乙太坊中實現了私有鏈,但它的難度級別隨著時間的推移而增加,因此挖礦過程變慢了。是否可以將難度設為靜態或在測試網中禁用它。
修改
CalcDifficulty
in Geth 以返回一個靜態數字,然後重新建構 Geth。例子:func CalcDifficulty(config *ChainConfig, time, parentTime uint64, parentNumber, parentDiff *big.Int) *big.Int { return big.NewInt(0x4000) }
如果它是私有鏈,您可以
difficulty
在創世塊中定義。像這樣的東西
{ "nonce": "0x0000000000000042", "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", "difficulty": "0x4000", "alloc": {}, "coinbase": "0x0000000000000000000000000000000000000000", "timestamp": "0x00", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "extraData": "Custem Ethereum Genesis Block", "gasLimit": "0xffffffff" }