1

We have a private network running on Hyperledger Besu. We are using ethash, and it had a fixed difficulty of 3625. That was producing blocks fairly quickly, averaging about 8-10 seconds, with some as high as a minute and a good number in fractions of a second.

Recently, we changed our genesis to remove the fixed difficulty and use the "built-in" difficulty parameter that would adjust over time. We set this initial difficulty to 0x1. We also reduced the gas limit per block from the maximum allowed by Truffle to the 30 million cap currently allowed by main net Ethereum.

The problem is since we made those changes, block production has become insanely slow. The new chain produced about 100 blocks in 3 hours. 100 blocks should be roughly 25 minutes at 15 seconds per block. This is not acceptable and not intended. We were trying to use the built-in algorithm to keep with the 15-second block time instead of using a fixed difficulty with widely varying results.

We've been trying to figure out why reducing the difficulty has dramatically increased block time. It should be the opposite. I've pasted our genesis file below. Does anyone know why all of a sudden block time has gone sky high?

{
  "config": {
    "homesteadBlock":0,
    "byzantiumBlock":0,
    "constantinopleBlock": 0,
    "constantinopleFixBlock":0,
    "muirGlacierBlock":0,
    "berlinBlock":0,
    "chainID": 17000,
    "ethash": {}
  },
  "difficulty": "0x1",
  "gasLimit": "0x1C9C380",
  "nonce": "0x0",
  "timestamp":"0x0"
}

The below are our config file settings:

#Network
bootnodes=["enode://76851911a1f9ad0809af51563a8fa39bab0d4c511fe01559cbc6e627810f514cbcea50a0be0a57b6d7d9f440145f09cc347d4c196129115c3a9b89a8cc302086@<ip redacted>:30303",
    "enode://c0727963bc2d0a9abe3237ddbb77f87e45d3b8116624d2e8c3e2c643556c69427ee356a1a6cca2095258fd2147f2b0df0c423e691fb819a8face2eba9523cb9f@<ip redacted>:30320"]

p2p-host="<ip redacted>"
p2p-port="30303"
host-allowlist=["*"]

rpc-http-enabled=true
rpc-http-host="<ip redacted>"
rpc-http-port="8545"
rpc-http-cors-origins=["*"]
rpc-ws-enabled=true
rpc-ws-host="<ip redacted>"
rpc-ws-port="8546"

#Other settings
min-gas-price=0
revert-reason-enabled=true
data-path="<path to data>\\data"
genesis-file="<path to genesis>\\privateNetworkGenesis.json"

#mining
miner-enabled=true
miner-coinbase="<account redacted>"
3
  • What were geth's command line parameters? Did you started a new blockchain instance or continued with the previous one? Can you increase the log verbosity to look at the block production progress?
    – Ismael
    Commented Oct 28, 2022 at 5:37
  • I updated my question to add our config file settings. The command line parameters for besu are just feeding it the config file. We started a new chain from zero. Over 3 days we saw the block time steadily, but very slowly, decrease on average. This morning the average block time went back up.
    – pdmoerman
    Commented Oct 31, 2022 at 14:10
  • In a PoW blockchain the difficulty automatically adjust to target an average block time of around 15 seconds. The difficulty changes are slow, and depends on the current difficulty. My guess is that miners have varying degrees of CPU available that changes the block time. A PoA blockchain seems to better solution for this case. If you really need a PoW I'd check if the miner has a setting to control how much CPU it will use and try to keep it as low as possible.
    – Ismael
    Commented Nov 3, 2022 at 2:29

0

Your Answer

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