The timestamp or timestamp is a small data stored in each block as a unique serial and whose main function is to determine the exact moment in which the block has been mined and validated by the blockchain network.
LDecentralization is one of the fundamental aspects of technology blockchain And of course, that implies that anyone, from any part of the world, can be added to the network and can operate in it. This in turn causes, that there is no universal time code. This is because we can connect from any time zone. The timestamp is a timestamp, which is calculated according to different parameters.
The temporal parameter, or timestamp, is based on an instantaneous adjustment that uses a median of the timestamps returned by all nodes. of the network. This is due to the decentralized form of it, and seeks to keep the nodes of the network as well synchronized as possible.
We must also bear in mind that the timestamps of the blocks are not exact. This is because they do not necessarily have to be in order. However, they still offer a relative precision of between one and two hours, which gives a margin of validity. Basically, all the nodes are connected to the same time slot. For this, the reference is taken UTC-0 (London local time), where UTC It's in Spanish Coordinated Universal Time. From this, the network nodes coordinate the time in which they work. Now, after storing this data, the local node calculates the displacement time between the UTC strip and the local time.
This makes an adjustment between the time of the local node with the displacement of all the nodes that are connected to the network. This allows the network time to be adjusted constantly. This avoids manipulation and usually does with slight time variations with respect to the time slot. This is done in this way, because there may be many hourly rates and repetitions and other problems could occur. Therefore, a universal timestamp creation system was developed for all nodes. This system takes into account the jet lag that could exist between the nodes.
Implementing a timestamp makes the block it is impossible to be repeated in the future, since in addition to the time, the date of creation of the block is also stored, therefore, there is no possibility that it will be repeated hash that happened a week, two months ago, or a year ago.
What is blockchain timestamp used for?
One of the main uses of timestamp is to establish the parameters of the process of mining is.. This is because these timestamps allow nodes to correctly adjust the mining difficulty to be used for each block generation period. Timestamps help the network determine how long it takes to extract blocks for a certain period, and from there adjust the mining difficulty parameter.
This of course can open the door for miners to manipulate time in order to lessen the difficulty. Nevertheless, Satoshi Nakamoto he foresaw this and programmed the network so that nodes ignore blocks that are outside a certain time range based on their own internal clock time. As a result, if a miner tried to do this, he would lose all his mining work.
On the other hand, in whitepaper From Bitcoin, Nakamoto explains that another functionality of the timestamp is to create a mechanism to avoid double spending. In this regard, Nakamoto wrote the following:
For our purposes, the last transaction is what counts, so we won't mind other subsequent double-spending attempts.
The timestamp in Bitcoin and its security
En Bitcoin, each block contains a Unix type timestamp. This mark serves as a source of variation in the block's hash and to avoid its manipulation. The fact of using a Unix type timestamp represents a problem for Bitcoin. This is because Unix-type timestamps have the ability to display time periods until the year 2038. To solve this, Satoshi Nakamoto programmed the timestamp system to avoid this failure and delay it until the year 2106.
However despite the security of the timestamp these are not infallible. As we mentioned earlier, a miner could alter their team's schedule and mine blocks with a lower timestamp. This attack is known and receives the name Time Warp Attack o Time Warp Attack.
The Time Warp Attack
Un Time Warp Attack It happens when a miner reports incorrect timestamps on the blocks they mine, in order to cause less difficulty. Many cryptocurrencies like Bitcoin periodically adjust the difficulty according to the block generation rate. Thus, the generation of blocks is maintained at the amount established in the code, which is 10 minutes per block for Bitcoin.
Thus by reporting incorrect timestamps, a miner can trick the difficulty algorithm and decrease the difficulty. A situation that allows you to extract blocks faster and earn more money. This has negative effects for the economy of a cryptocurrency, as a time warping attack increases the inflation rate of a cryptocurrency, causing an increase in supply that can lead to a lower market price.
However, the probability of it being carried out in Bitcoin is very low due to the enormous difficulty that Bitcoin currently has. This decreases the probability of this type of attack being carried out. This situation has led to developers don't want to fix this problem.