<p>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.</p>

<p>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.</p>

CC BY-SA 3.0
2015-06-25T08:31:03.300Z
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
CC BY-SA 3.0
2015-06-25T08:53:30.750Z
Thanks for the correction, I must have missed the fact that he is asking for a posteriori modifications of a block.
cdecker
CC BY-SA 3.0
2015-06-25T08:21:51.787Z
2015-06-25T08:52:46.013Z
2015-06-25T08:52:46.013Z
cdecker
<p>The timestamp is part of the input for the mining process.</p>

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

<p><strong>He cannot change the timestamp after finding a block</strong>, 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.</p>

CC BY-SA 3.0
2015-06-25T08:20:07.703Z
2015-06-25T08:32:23.680Z
2015-06-25T08:32:23.680Z
Murch
<p>I know that miners can adjust the timestamp of a block, but can they control the exact timestamp datetime (within the +-2h rule)?</p>

<p>For example:<br>
<em>A miner mines a block at <code>2013-08-08 08:01:34</code>. <br>
Can the miner change the block timestamp to <code>2013-08-08 08:08:08</code>?</em></p>

CC BY-SA 3.0
2013-08-07T21:13:39.970Z
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
CC BY-SA 3.0
2013-08-07T22:08:49.993Z
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
CC BY-SA 3.0
2013-08-07T22:17:05.123Z
And also this means that you can not use the block timestamp as a random time function. -- thank you Pieter for you answer.
user6266
<block><timestamp>
Can a miner set the EXACT timestamp of a block?
user6266
# Can a miner set the EXACT timestamp of a block?

(Asked by: username_0 on 2013-08-07)

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`?*

**Tags:** block, timestamp

> **Comments:**
> **username_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?  
> **username_0**: 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.  
> **username_0**: And also this means that you can not use the block timestamp as a random time function. -- thank you username_1 for you answer.  

---

## 2 answers

### Answer by username_2 on 2015-06-25. Score: 7

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.

> **Comments:**
> **username_3**: 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).  
> **username_2**: Thanks for the correction, I must have missed the fact that he is asking for a posteriori modifications of a block.  

---

### Answer by username_3 on 2015-06-25. Score: 2

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.


---

