Skip to main content
15 votes
Accepted

January 19th, 2038: RIP Unix Timestamps

The 32-bit signed integer timestamp runs out in 2038. But Bitcoin uses a 32-bit unsigned integer for the timestamp. That runs out it the year 2106. We'll have to find a solution by then, not by 2038. ...
Ava Chow's user avatar
  • 71k
11 votes

Why don't the timestamps in the block chain always increase?

There is no requirement that blocks have a timestamp after the previous block. The only requirement is that the timestamp is greater than the median timestamp of the last 11 blocks. So this means that ...
Ava Chow's user avatar
  • 71k
10 votes
Accepted

What prevents similar time-warp attacks in Bitcoin as happened to Verge?

Nothing directly prevents it in Bitcoin, and indeed the attack has been demonstrated on testnet3 many times---it's the primary reason that testnet3 currently has almost three times as many blocks as ...
David A. Harding's user avatar
8 votes
Accepted

How strict are the Unix Epoch time validation rules?

How strict are the time validation rules? Very. If the next block is mined more than 2 hours after the current block, would this not stall the blockchain? No. It doesn't break the rule "Full ...
RedGrittyBrick's user avatar
8 votes
Accepted

Would a series of reorgs cause Bitcoin to break because of the 2-hour block time difference restriction?

No. There are two restrictions on the timestamp of blocks: A consensus rule that the timestamp of a block must be strictly larger than the median timestamp of its 11 predecessors (parent, grandparent,...
Pieter Wuille's user avatar
7 votes

How strict are the Unix Epoch time validation rules?

I think you have a misconception about what this clause means: Full nodes will not accept blocks with headers more than two hours in the future according to their clock. You appear to be ...
Douglas's user avatar
  • 171
7 votes
Accepted

Is timestamping needed for anything except difficulty adjustment

It seems to me that PoW overwrites whatever timestamps there may be, and in effect determines what "time" is for the blockchain. I think this is your confusion: arguably, timestamping is ...
Pieter Wuille's user avatar
6 votes
Accepted

Can Taproot be used to commit arbitrary data to chain without any additional footprint?

Yes, you can commit to data this way, but there is nothing special about Taproot here. The Pay-to-Contract construction used to tweak the root key in Taproot is generally usable, and has in fact been ...
Pieter Wuille's user avatar
5 votes
Accepted

How does timejacking enable double spending?

The blog you linked to talks about a fairly sophisticated attack, involving large scale network manipulation. The basic premise is: You are able to identify the node that belongs to the person/...
Raghav Sood's user avatar
  • 17.1k
5 votes

Where does the 2-hour limit on the timestamp come from?

I don't ever recall seeing an actual calculation for it, and I strongly suspect the reason is that it is "good enough". The original, primary use of block timestamps is in difficulty calculations. ...
Raghav Sood's user avatar
  • 17.1k
5 votes

Why does the median-past time average the last 11 block timestamps and not the last 12?

BIP 113's goal is not to aim for a specific offset. Its goal is guaranteeing monotonicity (treating every block's timestamp as strictly larger than the timestamp of each of its ancestors). It does ...
Pieter Wuille's user avatar
5 votes
Accepted

The role of timestamp

The timestamp is used primarily for establishing the difficulty. Without a timestamp, new nodes would not be able to determine the correct difficulty to be used for each 2016 block period as they ...
Ava Chow's user avatar
  • 71k
5 votes
Accepted

where do the timestamps on blocks come from?

A miner applies their own timestamp to a block. Nodes add the first block they receive to the top their chain. They will not replace the current tip of their chain with a newly received block just ...
inersha's user avatar
  • 3,175
5 votes

How do nodes come to consensus on whether a timestamp is valid?

They don't need to. If a block's timestamp is in the future, it won't be accepted - but it also won't be marked as invalid. Once enough time passes, the node will accept the block if it is offered or ...
Pieter Wuille's user avatar
5 votes

Can we look at how long it took to solve for the most recent block in the blockchain? (and how?)

Blocks have timestamps, but they are not very accurate. The protocol rules only (roughly) require them to not be more than 1 hour in the past and not more than 2 hours in the future. At least ...
Pieter Wuille's user avatar
5 votes

Will a hard fork be required to change timestamp fields?

There is a fairly trivial solution, which is technically a hard fork, but doesn't require changing fields. The idea is that the timestamp is indeed treated as a 64-bit value, but only its lower 32 ...
Pieter Wuille's user avatar
5 votes
Accepted

Why is there no block time bias to <10min due to increasing hashrate?

you are right, there is a bias. You can easily see it in the time between halvings: 3 years, 10 months, 19 days for the first epoch 3 years, 7 months, 12 days for the second epoch 3 years, 10 months, ...
Enrico's user avatar
  • 66
5 votes
Accepted

How bitcoin miners choose timestamp in block header when mining?

My original understanding of mining is to pick a timestamp (the timestamp of when miners started mining) and then fix it. There's no reason for that to be the case, as mining is progress-free. It is ...
Claris's user avatar
  • 15.4k
5 votes
Accepted

Question about Bitcoin's Median Time Past

It is a bit weird, but it is simply not possible to have everyone's clocks be in sync, and so there must be leeway for a block to have a timestamp earlier than its predecessor. If my clock is a few ...
Ava Chow's user avatar
  • 71k
5 votes
Accepted

Can a signed raw transaction's locktime be changed?

A transaction's locktime is part of the data committed to by the transaction's signatures. If you change it, the signatures become invalid, and so the transaction becomes invalid. If the locktime ...
Vojtěch Strnad's user avatar
4 votes

Why don't the timestamps in the block chain always increase?

There is a fair amount of leeway in the block timestamp. The timestamp for block N must be greater than the median network time, which is calculated as the median of the past 11 blocks, and also less ...
Raghav Sood's user avatar
  • 17.1k
4 votes

How does a time warp attack work?

When there's a re-org of the chain of several blocks, isn't the total chainwork of both chains compared? Yes, that's true. In fact, that's how a reorg of any size is considered. However, that wasn't ...
Nick ODell's user avatar
  • 29.4k
4 votes

Can a blockchain from the future be synchronized today?

Extremely creative question. Most of UTF-8's answer is correct. I'd like to observe a few consequences: If someone brought a future blockchain to current reality and even 11 blocks were immediately ...
Jimmy Song's user avatar
  • 7,759
4 votes
Accepted

Why do testnet blocks have future timestamp?

Testnet is frequently attacked, abused, due to the complete lack of value and proof of work. A piece of code which is intended to allow a difficulty 1 block is none has been found in 20 minutes also ...
Claris's user avatar
  • 15.4k
4 votes
Accepted

How is PSZ Timestamp encoded in Bitcoin core code?

04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73 The above is actually Bitcoin Script, not ...
Raghav Sood's user avatar
  • 17.1k
4 votes

Does Cryptocurrency really need timestamps?

I think the question isn't so much whether this is possible, but whether this is desirable. The block rate limit has several functions: Keeping the stale block rate low, so that the effort a ...
Pieter Wuille's user avatar
4 votes
Accepted

what if the timelock is in the past?

If the nLockTime is less than or equal to the next block height, it can be included in the next block. To explicitly answer your questions: The CLTV op restricts the nLockTime field of the spending ...
Antoine Poinsot's user avatar
4 votes

Proof of Work vs. Proof of History

To put it simply: digital things are infinitely reproducible with very little cost, and so if we are attempting to create a digital money system, we need to make sure that users cannot simply copy &...
chytrik's user avatar
  • 18.3k
4 votes

What would happen to Bitcoin if GPS/Galileo timing ceased to be available?

Bitcoin needs approximately sundial time accuracy to operate. Computers have their own free running clocks which provide more than enough accuracy in the absence of other references, and NTP sources ...
Claris's user avatar
  • 15.4k
4 votes
Accepted

UNIX END TIME January 19, 2038 - Will it affect Timelock nLOCKTIME smart contracts past that date?

Timestamps in Bitcoin, including block timestamps and nLocktime values, are unsigned 32-bit. The last possible timestamp is Feb 7th 2106, at 06:28:15 UTC.
Pieter Wuille's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible