# What's doing the 3 years lock if it's not a type script?

**URL:** <https://talk.neptune.cash/t/whats-doing-the-3-years-lock-if-its-not-a-type-script/158>\
**Category:** Blockchain Architecture\
**Created:** [November 7, 2025, 1:45am UTC](https://talk.neptune.cash/t/whats-doing-the-3-years-lock-if-its-not-a-type-script/158 "2025-11-07T01:45:29Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![skaunov](https://talk.neptune.cash/user_avatar/talk.neptune.cash/skaunov/32/90_2.png) [@skaunov](https://talk.neptune.cash/u/skaunov)\
**Post date:** [November 7, 2025, 1:45am UTC](https://talk.neptune.cash/t/whats-doing-the-3-years-lock-if-its-not-a-type-script/158/1 "2025-11-07T01:45:29Z")

</div>

I’m trying to understand what implements that time vesting of the subsidies (the coin type script kinda says it has no height locking)?

P.s. Chances are somebody already answered this but I missed it — could you paste the answer then! 🥺

---

<div class="post-metadata">

**Author:** ![skaunov](https://talk.neptune.cash/user_avatar/talk.neptune.cash/skaunov/32/90_2.png) [@skaunov](https://talk.neptune.cash/u/skaunov)\
**Post date:** [November 7, 2025, 1:57am UTC](https://talk.neptune.cash/t/whats-doing-the-3-years-lock-if-its-not-a-type-script/158/2 "2025-11-07T01:57:50Z")

</div>

Maybe the answer was at [https://docs.neptune.cash/consensus/time-lock.html](https://docs.neptune.cash/consensus/time-lock.html), but it returns ‘404’ to me.

---

<div class="post-metadata">

**Author:** ![aszepieniec](https://talk.neptune.cash/user_avatar/talk.neptune.cash/aszepieniec/32/5_2.png) [@aszepieniec](https://talk.neptune.cash/u/aszepieniec)\
**Post date:** [November 7, 2025, 4:02am UTC](https://talk.neptune.cash/t/whats-doing-the-3-years-lock-if-its-not-a-type-script/158/3 "2025-11-07T04:02:39Z")

</div>

Short answer: it is absolutely a type script that accomplishes the time lock but you are distracted by the block height and should be focusing on the transaction’s timestamp instead.

Not part of the answer: brilliant question! More of these please. 🥇

Long answer:

The time-lock is enforced by the presence of a `Coin` whose type script is `TimeLock`. Recall that a `Coin` consists of a _type script hash_ and a _state_. So what I really mean is that the time lock is enforced by `Coin`s whose matching _type script hash_ is the hash of `TimeLock`. For such coins, the _state_ is interpreted as a timestamp.

What this type script does is this:

- It non-deterministically guesses the transaction’s timestamp and authenticates this guess against the transaction kernel MAST hash by walking up a Merkle tree. (It does this by, once again, non-deterministically guessing sibling digests, until the root is reached; and it can verify the root against the input to the type script program, which is the kernel MAST hash.)
- It interprets the `Coin`’s _state_ as a timestamp.
- It crashes if the `Coin`’s timestamp is larger than the transaction’s timestamp. (The transaction is being initiated before the UTXO is released.)

There are more steps to the chain of enforcement, of course.

- When producing a `ProofCollection` you have to prove that all type scripts (including a `TimeLock` type script if it is present) halt gracefully.
- When raising a `ProofCollection` into a `SingleProof`, when merging two `SingleProof`s, or when updating a `SingleProof`, the timestamp of the given transaction can never be reduced; it can only be increased. The three branches of the `SingleProof` program enforce this.
- When producing a block from a transaction, the block’s timestamp must equal the timestamp of its transaction. This is verified on the host machine (for now) in `Block::validate`. Down the line, this check will be moved to TritonVM via some appendix program.
- Peers reject blocks whose timestamps are too far in the future. This is also verified on the host machine in `Block::validate`. (And in this case I don’t think it is possible to move the check to TritonVM.) The const that regulates the cutoff threshold is `FUTUREDATING_LIMIT` and is currently set to 5 minutes.

---

<div class="post-metadata">

**Author:** ![skaunov](https://talk.neptune.cash/user_avatar/talk.neptune.cash/skaunov/32/90_2.png) [@skaunov](https://talk.neptune.cash/u/skaunov)\
**Post date:** [November 7, 2025, 5:43pm UTC](https://talk.neptune.cash/t/whats-doing-the-3-years-lock-if-its-not-a-type-script/158/4 "2025-11-07T17:43:50Z")

</div>

:thankyou: I need to think on it some more… Is it correct to say that those vested coins are the second type of `Coin` on the chain now? Which when spent will produce the first type. I mean they have different type scripts, hence…

---

<div class="post-metadata">

**Author:** ![aszepieniec](https://talk.neptune.cash/user_avatar/talk.neptune.cash/aszepieniec/32/5_2.png) [@aszepieniec](https://talk.neptune.cash/u/aszepieniec)\
**Post date:** [November 8, 2025, 6:31am UTC](https://talk.neptune.cash/t/whats-doing-the-3-years-lock-if-its-not-a-type-script/158/5 "2025-11-08T06:31:05Z")

</div>

The word “coin” is ambiguous because it could refer to `Utxo` or `Coin`, which are different things.

Time-locked `Utxo`s are different from liquid `Utxo`s because of the `Coin`s they carry. Recall that a `Utxo` can carry any number of `Coin`s. Liquid `Utxo`s carry only one `Coin`; its type script is `NativeCurrency`. Time-locked `Utxo`s carry two coins. The first is a `NativeCurrency` `Coin`; the second is a `TimeLock` `Coin`.

---

<div class="post-metadata">

**Author:** ![skaunov](https://talk.neptune.cash/user_avatar/talk.neptune.cash/skaunov/32/90_2.png) [@skaunov](https://talk.neptune.cash/u/skaunov)\
**Post date:** [November 10, 2025, 11:18pm UTC](https://talk.neptune.cash/t/whats-doing-the-3-years-lock-if-its-not-a-type-script/158/6 "2025-11-10T23:18:57Z")

</div>

> [@aszepieniec](#):
>
> Time-locked `Utxo`s carry two coins. The first is a `NativeCurrency` `Coin`; the second is a `TimeLock` `Coin`.

And it’s not 50/50 as I could see. Just `TimeLock`prevents the UTXO from spending… Right?

\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_

:thankyou: Now I don’t understand why such design instead of putting the restrictions into the lock script?

I mean when there will be other tokens I envision a typical disaster when a program just requires a token been sent to it, but it will be coming with some non-spendable addendum so that the program will count the token received but all the other logic will be wrecked as it can’t be spent. Probably I just missing something, it’s just a thought I could take away. 🤯

---

<div class="post-metadata">

**Author:** ![aszepieniec](https://talk.neptune.cash/user_avatar/talk.neptune.cash/aszepieniec/32/5_2.png) [@aszepieniec](https://talk.neptune.cash/u/aszepieniec)\
**Post date:** [November 11, 2025, 3:02am UTC](https://talk.neptune.cash/t/whats-doing-the-3-years-lock-if-its-not-a-type-script/158/7 "2025-11-11T03:02:44Z")

</div>

> [@skaunov](#):
>
> And it’s not 50/50 as I could see. Just `TimeLock`prevents the UTXO from spending… Right?

Yes.

> [@skaunov](#):
>
> Now I don’t understand why such design instead of putting the restrictions into the lock script?

You could certainly achieve the same functionality by putting everything into lock scripts. The motivation to keep them separate is functional separation. Lock scripts control who can spend. Type scripts control how state evolves. These are different questions, even though they both reduce to verifying logic.

---

<div class="post-metadata">

**Author:** ![skaunov](https://talk.neptune.cash/user_avatar/talk.neptune.cash/skaunov/32/90_2.png) [@skaunov](https://talk.neptune.cash/u/skaunov)\
**Post date:** [November 15, 2025, 6:32am UTC](https://talk.neptune.cash/t/whats-doing-the-3-years-lock-if-its-not-a-type-script/158/8 "2025-11-15T06:32:12Z")

</div>

Makes sense.

I was thinking what would happen if someone put two native coins in an UTXO? I can imagine type script (or even something else) would prevent this while validating, but I also can imagine this slipping through. Also I can equally imagine they both still usable and not. On the second thought I remember in the docs might be a note that each type-script can appear only once in an UTXO (though maybe I’m confusing the things).

This composing inside an UTXO still feels strange (maybe it’s just me…) but I starting to draw the parallels to see it’s not _that_ different conceptually from everything else there. Like in any major blockchain it’s possible to invalidate a coin.

---

<div class="post-metadata">

**Author:** ![skaunov](https://talk.neptune.cash/user_avatar/talk.neptune.cash/skaunov/32/90_2.png) [@skaunov](https://talk.neptune.cash/u/skaunov)\
**Post date:** [November 27, 2025, 4:40pm UTC](https://talk.neptune.cash/t/whats-doing-the-3-years-lock-if-its-not-a-type-script/158/9 "2025-11-27T16:40:43Z")

</div>

I guess it’s impossible to squeeze two `neptune_cash::protocol::consensus::type_scripts::native_currency::NativeCurrency` into an UTXO – its `neptune_cash::protocol::consensus::type_scripts::TypeScript` itself guards against that, right?

---

<div class="post-metadata">

**Author:** ![skaunov](https://talk.neptune.cash/user_avatar/talk.neptune.cash/skaunov/32/90_2.png) [@skaunov](https://talk.neptune.cash/u/skaunov)\
**Post date:** [November 29, 2025, 8:22am UTC](https://talk.neptune.cash/t/whats-doing-the-3-years-lock-if-its-not-a-type-script/158/10 "2025-11-29T08:22:18Z")

</div>

@sword-smith told me to look into the Rust implementation/shadow when I reminded about this question of mine. But looking into `impl ConsensusProgramSpecification for NativeCurrency` I can’t locate the relevant part. Maybe it’s possible then?

Though I still not sure if that is limited by a type script, but feel from the previous discussion like that should be what restricts it. The hard thing for me to understand is by which means a TS checks UTXO when it’s just a part of one of those. 🤯 I mean I see that each Triton program seems to have access to the whole witness and input; so it would be cool to have something like a table or something showing everything that a tx must comply (beyond the consensus rules). Like is it possible to make a program which will allow a tx only with certain

I’d still appreciate a reply containing possible/impossible/unknown in it to the question in hand. I guess it’s a great puzzle but somehow I failed to get any fun out of it. =((

---

<div class="post-metadata">

**Author:** ![aszepieniec](https://talk.neptune.cash/user_avatar/talk.neptune.cash/aszepieniec/32/5_2.png) [@aszepieniec](https://talk.neptune.cash/u/aszepieniec)\
**Post date:** [December 1, 2025, 3:22am UTC](https://talk.neptune.cash/t/whats-doing-the-3-years-lock-if-its-not-a-type-script/158/11 "2025-12-01T03:22:18Z")

</div>

The way I read `AddAllAmountsAndCheckTimeLock` and `AddAllAmountsAndCheckTimeLock` is as follows. Control iterates over all `Coin`s in all `Utxo`s and sums the amount if the `Coin` is of `NativeCurrency` type. There is no early exit from loops that prevents a second `Coin` with `NativeCurrency` from being counted too.
