🔹 1. What is a "Time-Dependence Attack"?

A Time-Dependence Attack (also known as timestamp manipulation attack) occurs when a smart contract relies on block.timestamp (the current block’s timestamp) to make critical decisions — and an attacker (or miner) exploits the fact that this timestamp can be slightly manipulated.

Even though block.timestamp seems like a neutral, objective value (like a clock), it is not fully trustless because miners have partial control over it.


🔹 2. Understanding block.timestamp

❗️But here's the problem:

Miners can slightly manipulate block.timestamp.

They cannot set it to any arbitrary time (e.g., year 3000), but they can adjust it within a small window — typically ±15 seconds or so — to influence outcomes.

Why? Because the blockchain protocol only requires that:

So miners can choose a valid timestamp within this range — and use that power to their advantage.


🔹 3. Example: A Vulnerable Smart Contract

Let’s look at the example from the transcript:

contract TimeDependence {
    function checkWinner(uint256 value) public view returns (bool) {
        if (block.timestamp % 10 == value) {
            return true; // You win!
        }
        return false;
    }
}

How it works: