<p>The usual way to handle time in Plutus is using Slot ranges. This means that the script does not query the time. Instead it checks that the validation happens in a given slot interval that corresponds to a time.
You can have a look at the <a href="https://docs.plutus-community.com/docs/lectures/Lecture3.html" rel="nofollow noreferrer">notes about slots</a> from the Plutus Pioneers Course.</p>
<p>With these slots, you can ensure that the validation takes place before, after or in a certain slot interval. And when you are sure that the validation takes place in a specific time interval, you also know the corresponding time. Each slot corresponds to one second as described <a href="https://docs.cardano.org/new-to-cardano/cardano-nodes#howdoesitwork?" rel="nofollow noreferrer">here</a>.</p>

CC BY-SA 4.0
2021-10-25T13:59:02.813Z
Perfect. Your response captures everything I questioning!
Isaac Padberg
CC BY-SA 4.0
2021-10-23T10:40:30.317Z
2021-10-23T10:40:30.317Z
Flippy
<p>How about parameterizing the validator with <code>Slot</code> or <code>POSIXTime</code> and passing the current time from the contract to the validator script using <code>Contract.currentTime</code> or <code>Contract.currentSlot</code>?</p>
<p>That way, the wallet has no influence on it.</p>

CC BY-SA 4.0
2021-10-25T14:00:54.020Z
I could do this, but the issue is that the contract I am creating has quite a lot of different deadlines floating around. So asking for all of these up front would be annoying for someone using it and could allow for more mistakes/vulnerabilities.
Isaac Padberg
CC BY-SA 4.0
2021-10-23T08:54:43.377Z
2021-10-23T08:54:43.377Z
Aoaddeola
<p>Is it possible for a validator to get the current time without it being passed in via the redeemer? My validator is heavily dependent on the time being correct so it would probably be a bad design choice to allow the wallet to pass in the time, as it can lie about the current time.</p>

<slottime><on-chain><validation><time><posixtime>
Is there a way for a validator to get the current time?
# Is there a way for a validator to get the current time?

(Asked by: username_0 on 2021-10-22)

Is it possible for a validator to get the current time without it being passed in via the redeemer? My validator is heavily dependent on the time being correct so it would probably be a bad design choice to allow the wallet to pass in the time, as it can lie about the current time.

**Tags:** slottime, on-chain, validation, time, posixtime

---

## 2 answers

### Answer by username_1 on 2021-10-23. Score: 2 | Accepted answer

The usual way to handle time in Plutus is using Slot ranges. This means that the script does not query the time. Instead it checks that the validation happens in a given slot interval that corresponds to a time.
You can have a look at the [notes about slots](https://docs.plutus-community.com/docs/lectures/Lecture3.html) from the Plutus Pioneers Course.

With these slots, you can ensure that the validation takes place before, after or in a certain slot interval. And when you are sure that the validation takes place in a specific time interval, you also know the corresponding time. Each slot corresponds to one second as described [here](https://docs.cardano.org/new-to-cardano/cardano-nodes#howdoesitwork?).

> **Comments:**
> **username_0**: Perfect. Your response captures everything I questioning!  

---

### Answer by username_2 on 2021-10-23. Score: 1

How about parameterizing the validator with `Slot` or `POSIXTime` and passing the current time from the contract to the validator script using `Contract.currentTime` or `Contract.currentSlot`?

That way, the wallet has no influence on it.

> **Comments:**
> **username_0**: I could do this, but the issue is that the contract I am creating has quite a lot of different deadlines floating around. So asking for all of these up front would be annoying for someone using it and could allow for more mistakes/vulnerabilities.  

---

