4
All miners at any time must have a consensus on the "difficulty target" to be able to achieve the correct nonce (as answer of proof-of-work).
Assume that the target has been updated (it means that 2016 blocks has been discovered) now, the question is "who" calculates this new target such that every miner achieves the same target that is needed to solve proof-of-work of the next block?
Is it true that it's not possible for an attacker to manipulate the target value to trick the other miners such that they achieve a wrong nonce for proof-of-work?
In other words, how can every miner know that the target value has been changed?
--> Is it by the block header of the last block in the Blockchain?
If so, is this approach accountable to achieve a unique target?
Assume 2016 blocks have been discovered and the target must be updated using the following equation:
time = (difficulty x 2^32) / hashing power of the network
Is it right? It's unclear to me how to determine the value for hashing power of the network.
P.S. Assume also an adversary solves the proof-of-work and then generates a new block but forges the block's times-stamp to trick the network at the time of updating target. Since the target will be updated using the blocks' time-stamp.
3I think you're a bit confused. Nobody needs to know the current hashing power of the network in order to calculate the target. It can be determined by from the average block time during the last 2016 blocks. The equation you list doesn't calculate the difficulty, but the estimated time for a block to be discovered. All that is needed to calculate a new target is the past 2016 blocks. – Jestin – 2016-10-17T21:29:57.997
Short answer: The hashing power of the network can be estimated by the timestamps in the block headers. Since everyone uses the same algorithm on the same block headers, everyone gets the same result. It is, of course, only an estimate of the network's hashing power. – David Schwartz – 2016-10-17T21:50:31.927
1
related: How is difficulty calculated?
– Murch – 2016-10-17T23:33:33.370