2

I have implemented PoA on private blockchain with following genesis.json.

{
  "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"
}

I have started geth with following command.

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

Now the thing that bothers me is that, it keeps on mining blocks (3659 at the time of writing) even if i have not submitted any transaction. Is this the expected behavior from PoA implementation or not. Kindly guide.

2 Answers 2

2

Had to change value of period from 1 to 0 and it works as required.

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

for every periode(s) the blockchain mines a new block so if u set periode to zero then your blockchain won't mine any block it will not work and save blocks to the blockchain so if you want to make the blockchain work slower set periode to 15s .

3
  • 1
    But after every transaction that is submitted, i can see these in the logs INFO [02-27|15:26:45.068] Commit new mining work INFO [02-27|15:26:45.071] Successfully sealed new block INFO [02-27|15:26:45.071] 🔗 block reached canonical chain INFO [02-27|15:26:45.072] 🔨 mined potential block INFO [02-27|15:26:45.071] Sealing paused, waiting for transactions. Doesn't it mean that it is mining blocks as expected ?
    – Saeedi
    Commented Feb 28, 2019 at 5:31
  • 1
    if u want to verify it then open get console using "geth attach localhost:8545" and run eth.blockNumber it will give u the number of the blocks mined in the blockchain Commented Feb 28, 2019 at 10:41
  • 1
    Yes it does return block number i.e. 36 in my case. I have also verified it by restarting and shutting down my node to check whether data or blockchain persists or not.
    – Saeedi
    Commented Feb 28, 2019 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.