CatWifCrypto / desheshai-kadena-analysis

2 stars 0 forks source link

Difficulty Adjustment and Hashpower distribution #2

Open larskuhtz opened 2 months ago

larskuhtz commented 2 months ago

@CatWifCrypto thank you for this detailed analysis of the actual block times in Kadena's mainnet. I enjoyed reading it.

You are right with your observation that Chainweb's consensus algorithm takes into account that not all chains are mineable all the time. There are two mechanisms that take care of this:

  1. At any point in time the available hash power is distributed evenly across all mineable chains. This means, that while chains can be blocked, miners are never blocked. All available hash power is always in use for securing the network.
  2. Difficulty adjustment dynamically sets the hash target such that chains always grow at an average rate of 2 block heights per minute (30 seconds block time).

The model in code-orig.py ignores difficulty adjustment and the dynamic distribution of hash power across chains which leads to an inaccurate simulation.

I agree with your conclusion that if a simulation does not match the real world behavior of a system, then the simulation is wrong and not the system.

larskuhtz commented 2 months ago

Btw. the fraction of chains that is mineable at a given point in time increases as the total number of chains increases. Therefore chainweb becomes more efficient as it scales to more chains.