Go-Ethereum

Geth 權威實施證明

  • February 27, 2019

我已經使用以下 genesis.json 在私有區塊鏈上實現了 PoA。

{
 "config": {
   "chainId": 1515,
   "homesteadBlock": 1,
   "eip150Block": 2,
   "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
   "eip155Block": 3,
   "eip158Block": 3,
   "byzantiumBlock": 4,
   "constantinopleBlock": 5,
   "clique": {
     "period": 1,
     "epoch": 30000
   }
 },
 "nonce": "0x0",
 "timestamp": "0x5c6bf995",
 "extraData": "0x00000000000000000000000000000000000000000000000000000000000000002f980dd10698ff013fadaeed36f64b552de09c4b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
 "gasLimit": "0x47b760",
 "difficulty": "0x1",
 "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
 "coinbase": "0x0000000000000000000000000000000000000000",
 "alloc": {
   "2f980dd10698ff013fadaeed36f64b552de09c4b": {
     "balance": "100000000000000000000000"
   }
 },
 "number": "0x0",
 "gasUsed": "0x0",
 "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}

我已經使用以下命令開始了 geth。

geth --datadir node1/ --syncmode 'full' --port 30311 --rpc --rpcaddr 'localhost' --rpcport 8501 --rpcapi 'personal,db,eth,net,web3,txpool,miner'  --networkid 1515 --gasprice '1' -unlock '0x2f980dd10698ff013fadaeed36f64b552de09c4b' --password node1/password.txt --mine

現在困擾我的是,即使我沒有送出任何交易,它也會繼續探勘區塊(在撰寫本文時為 3659)。這是否是 PoA 實現的預期行為。請指導。

必須將期間的值從 1 更改為 0,它可以按要求工作。

"clique": {
     "period": 0,
     "epoch": 30000
   }

對於每個週期,區塊鏈都會探勘一個新塊,因此如果您將周期設置為零,那麼您的區塊鏈將不會探勘任何塊,它將無法工作並將塊保存到區塊鏈中,因此如果您想讓區塊鏈工作更慢,請設置週期到 15 秒。

引用自:https://ethereum.stackexchange.com/questions/67306