I'm running a tool to audit my smart contract and I got as report the following:

uses timestamp for comparisons / Dangerous comparisons :

require(block.timestamp > nextPayment, "Payement not due yet");

I've done more research and I found that block.timestamp can be manipulated by miners which is why is better to use other methods for comparison than block.timestamp

Do you have any method safer than this one ?

Nb: block.timestamp defines the Now in solidity

1 Answer 1


The 15-second Rule states that if your contract's code does not rely on a time interval of less then 15 seconds, than it is probably safe to use block.timestamp .

If the scale of your time-dependent event can vary by 15 seconds and maintain integrity, it is safe to use a block.timestamp.

I understand that your smart contract is about recurring payments, so unless these payments' time interval is less than 15 seconds, your code is safe.

You can read more about Timestamp Dependence here.

All the best!

  • This is no way shape or form solves the slither error "uses timestamp for comparisons"
    – rook
    Commented Aug 10, 2022 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.