Some values - e.g. block.timestamp - are provided by the miner. This means that they might not be consistent between different miners. How does the blockchain handle that?

My understanding is that every block is deterministic, so that two miners who mine the same block with the same transactions will always get the same result, that anyone can reproduce. But, if the outcome of a transaction depends on a miner provided value, how can it guarantee consistency? What happens when two miners provide different values?

Only one miner provides the value: the one who successfully mines the block.

That block then contains a timestamp, and everyone who verifies the block will use that same timestamp.

The thing is - miners don't mine the same block. Each can pick transactions to include in the block at his own discretion. The same applied to timestamp - they just use their's and don't need to sync.

But one of them* is first with finding the nonce, so he broadcasts a new block which becomes the new block

(*) Actually few of them can find the nonce, that's why we have uncle blocks etc. But this topic is broader than the question asked.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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