I went over this blog, but I am still not clear how double spending is achieved by this attack. From what I read, the attackers submit wrong timestamps to a target node. During this period, the target wouldn't receive legitimate transactions confirmation because the target node is behind network's median time. However, I am not clear how double spending can be achieved from this.
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/entity you want to execute a double spend against
- You trick that node into thinking that the network time is far behind what it actually is (up to a difference of 70 minutes against the node's own system time)
- Optionally, you convince other miners that the network is 70 minutes ahead of the actual time.
This gives us the basic following setup:
The actual time,
T (the actual value of this is irrelevant)
The majority miners' network time,
The victim's network time,
In Bitcoin, when a node receives a new block, it runs through some validation checks. If any of these checks fails, the block is deemed invalid. One of these checks is to verify the timestamp in the block header.
The node checks to verify that this timestamp is within 70 minutes of the what the node believes the network time to be (the network time is the median of the time the peers a node is connected to have reported).
To execute the attack, the bad actor has created a situation where the victim is 70 minutes behind the actual time, and the rest of the world is mining as if the actual time is 70 minutes ahead of the network time.
Thus, when a valid block is found, when the victim's node receives it, it will be dismissed as invalid, since from the victim's point of view it is around 140 minutes ahead of the network time (
T+70 - T-70).
The bad actor then uses his own mining power (it is assumed that the attacker has a sufficient share of mining power to produce a few blocks a week) to mine a block that is within the victim's acceptable time parameters. Note that the rest of the network will either already be on a longer chain, or will find a longer chain soon enough, since the attack does not control the majority hashpower.
By broadcasting this block to the victim, the attacker can convince them that some transaction in that block is confirmed. If required, the attacker can then mine a few more blocks (which may take several days) to trick the victim into believing that the block containing the transaction has been confirmed multiple times.
At the same time, the attacker will make another transaction spending the same inputs on the much longer chain being mined by the rest of the miners. This will also be confirmed, and receive far more confirmations than the chain being created by the attacker specifically for the victim's node.
Finally, once the attacker has convinced the victim of the transaction and reaped whatever benefits, the attacker will let the victim's node connect to more honest peers. This will result in the node recalculating the network time, arriving at a more realistic value.
Once this happens, the victim's node will be able to accept the original, longer, honest chain, which will have more blocks (and more work) since it was being mined by the majority hashpower. This chain contains the double spend of the transaction the victim was tricked into believing was confirmed.
The minor chain on which the victim was convinced of the transaction will then disappear, being replaced by the longer chain, and leaving only the double spend on the blockchain.