What is a Bitcoin Timestamp
04.02.2022 • Просмотров:

What is a Bitcoin Timestamp

By Decimal

If you delve into the description of BTC project on Coinmarketrate.com, then you will find out that its inventor, Satoshi Nakamoto, wrote in the whitepaper that the purpose of the timestamp is to eliminate the threat of double spending. This parameter is a fundamental part of the mining process in which miners are compensated for their work in finding a new block.

The reason for this is that a timestamp is used to determine how complex the block was and how long it took to mine it, known as block time.

To ensure accurate calculation of complexity, these timestamps are used instead of the actual time.

When a new Bitcoin block is created, 2 timestamps are used:

  1. In the header of the block that is added by the miner.
  2. The second one is for determining the block creation time.

Although theoretically both times should be the same, there is always a small risk that the miner made a mistake when entering the timestamp or that he just does it on purpose.

Fortunately, there are two ways to prevent this, which we will discuss later in this article. It is important that the first allows you not to delay the time of the block, and the second – not to run too far ahead into the future.

Ultimately, they both want to preserve the integrity of the cryptocurrency blockchain.

The Issue of Time in Bitcoin

The Issue of Time in Bitcoin

One might think that time on the Bitcoin network is not a very important issue, since blocks arise sequentially and are ordered one on top of the other. All due to the hashes that point to the previous one.

We know that Bitcoin blocks contain transactions, a Merkle tree, and other parameters such as the hash of the block itself.

By this we mean that this is enough for transactions and a consensus system. However, there is a mechanism for which one more value is needed — the complexity of mining.

If many miners join the network, the chances of finding a new block increase, which leads to a reduction in the block’s operation time. Or if there are fewer miners than before, the block time will be shorter. All this makes the work of the network unpredictable, which requires a solution that does not need a central authority to resolve this issue.

To do this, the mining difficulty is adjusted every 2 weeks, trying to increase or decrease it depending on whether the blocks should appear slower or faster.

The idea of Bitcoin is that their time should be 10 minutes, and to achieve this goal, the timestamp of blocks is used to calculate the average number of blocks that appeared during this two-week period.

Block Timestamp Security Rules

We know that there are 2 types of timestamps when creating a new block. And we also know that the reason for their presence is that the miner can lie. The miner has an incentive to lie about the block creation time, especially if he reports that the block was mined in the future.

Block Timestamp Security Rules

Block Timestamp Security Rules

A miner can say that it took 15 minutes to mine a Bitcoin block, instead of the usual 10 minutes.

If this continues for 2 weeks, which is the duration of the mining adjustment, then the calculation will conclude that the blocks take an average of 15 minutes, which, as we know, is not true.

Then, for the next period, the difficulty is adjusted downward, which increases the profit of miners, who can now mine blocks faster. This also leads to the fact that the time of the military-technical cooperation is moving further and further away from reality.

To solve this issue, or at least mitigate it, Bitcoin implies two mechanisms:

  1. The Median Past Time (MPT) rule: The timestamp must be ahead of the median of the last 11 blocks. The median of these 11 blocks means that a fork of up to 6 blocks can be generated, and time will still not lag behind. This rule also plays on the idea that someone with 10% of the network hashrate will have a 0.1% chance of canceling a transaction with 6 commits.
  2. Future block time rule: The timestamp cannot be more than 2 hours in the future based on the constant MAX_FUTURE_BLOCK_TIME, relative to the median of other nodes. Another defense mechanism is that the maximum allowable difference between the time provided by the nodes and the system clock is 90 minutes.

It should be noted that this rule is not an absolute consensus, but blocks with too long a period of time may become valid in the future after a certain period of time

Rule #1 ensures that the blockchain continues to move forward in time, and rule #2 ensures that the blockchain does not move too far ahead.

However, the rules are not infallible, since a miner, for example, can set a timestamp far ahead while it is within a two-week period. But even in this case, the consequences will not be too serious.

Since 2 hours is a small part of 2 weeks, the impact of attempts to manipulate the network will be somewhat limited.

If he did something like that, it would mean that a 10-minute block of time would last 9 minutes and 54 seconds for two weeks after adjusting the difficulty. Moreover, it will be a one-time change, since after the introduction of the two-hour time, it cannot be entered again without switching to the reverse time.

In addition, it is necessary to understand that this 2-hour period is important for miners to be sure that they have added sufficient time for the future. This is done so that the node, having received a new block, does not reject it due to the fact that its timestamp is earlier than the current time.

To date, these 2 rules have proven their effectiveness when it comes to preventing miners from manipulating timestamps in order to extract benefits.

Bitcoin Cash: Theoretical Block Time Problems

Created in August 2017, Bitcoin Cash is an alternative cryptocurrency that arose as a result of the fork of the BTC. Its main goal was to be able to increase the block size.

One of the biggest fears of Bitcoin Cash developers at the time of its creation was that not so many miners would join the project, and therefore the time between the opening of one block and another would be too long.

As a result, the so-called Emergency Difficult Adjustment (EDA) was introduced, which was supposed to alleviate this problem.

We will not discuss in detail here how this algorithm works, but it is important to say that this mechanism was very complex, and in the end turned out to be fundamentally imperfect.

In particular, the algorithm had to analyze whether a certain number of blocks did not appear during a certain period, in which case the complexity had to be reduced.

The problem was that this policy was too aggressive, because if it detected a very large difference between blocks, then the difficulty adjustment was too large. A unique opportunity for miners to manipulate.

They intentionally left large periods of time when the block was not mined, which led to very sharp changes in the difficulty of mining, followed by periods of low complexity when blocks were mined with high frequency. Thus, the network has become unstable.

As a result of the failure, more Bitcoin Cash blocks were mined than expected, and the miners’ profits increased during these periods. As a result, BTC Cash has surpassed BTC for over 5000 blocks, and this advantage is still being kept by it.

A few months later, in November 2017, a fix was released. EDA was removed and replaced with a new difficulty adjustment system, much simpler, which worked every 24 hours.

However, this is still different from how Bitcoin works, with its 2-week period. Bitcoin Cash has a more dynamic and fast system.

While this may mean more volatility in the short term when adjusting for difficulty, the coin also adapts faster to any changes in difficulty, while Bitcoin takes longer to adjust.

Unlike Bitcoin, where 2 hours wasn’t a big enough gap to have a huge impact on complexity, Bitcoin Cash is.

The time of 2 hours in 24 is much more than 2 hours in 2 weeks. This is equivalent to reducing the block time from 10 minutes to 9 minutes and 10 seconds.

Potentially, this can be significant and lead to a change in the profitability of mining if it is abused. Therefore, Bitcoin Cash is vulnerable, or at least more vulnerable than Bitcoin, to timestamp manipulation.

The good news is that although it is more vulnerable, it can also solve the problem much faster, which makes the consequences of this attack less devastating.