4

I know that miners can adjust the timestamp of a block, but can they control the exact timestamp datetime (within the +-2h rule)?

For example:
A miner mines a block at 2013-08-08 08:01:34.
Can the miner change the block timestamp to 2013-08-08 08:08:08?

  • 1
    In theory this is certainly possible - but they have the decide what timestamp they want before starting to mine. Is your question about theory or practice? – Pieter Wuille Aug 7 '13 at 21:13
  • 1
    So the answer is yes --- For my question this is theory only. This doesn't really affect bitcoin but the coins that are using a moving average to calculate the difficulty. If the moving average is short enough and a miner have majority of hash power the miner could create a chain of blocks with 0s timestamp apart and mess up the difficulty. --- very unlikely though. – user6266 Aug 7 '13 at 22:08
  • 1
    And also this means that you can not use the block timestamp as a random time function. -- thank you Pieter for you answer. – user6266 Aug 7 '13 at 22:17
6

Bitcoin miners can construct the block header, including the timestamp, however they want, as long as it adheres to the consensus rules. The shift you describe is well inside the 2 hour timerange, so it can be done when setting out to mine the block. It cannot however be done once the block is mined as the timestamp is part of the header, which is hashed into the PoW, hence changing the timestamp would invalidate the proof of work.

Most miners however prefer to increase/decrease the timestamp in order to have a simple way to alter the header, thus more hashes to compute. This is sometimes called time-rolling and is performed on top of the nonce-rolling.

  • 1
    Your answer might be confusing, as the asker seems to propose to change the timestamp after a block is found. You might want to clarify that this is not possible (although, I think I have been clear on that in my answer). – Murch Jun 25 '15 at 8:31
  • 1
    Thanks for the correction, I must have missed the fact that he is asking for a posteriori modifications of a block. – cdecker Jun 25 '15 at 8:53
1

The timestamp is part of the input for the mining process.

So, the miner can set an arbitrary timestamp, but must decide before hashing what timestamp he wants a potential block to have.

He cannot change the timestamp after finding a block, because the timestamp is part of the block, and a different one wouldn't be valid. To change the timestamp, he would have to start over mining.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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