# Questions after Native Token Policy creation

**URL:** <https://forum.cardano.org/t/questions-after-native-token-policy-creation/140318>\
**Category:** Native Tokens\
**Created:** [6 December 2024 21:29 UTC](https://forum.cardano.org/t/questions-after-native-token-policy-creation/140318 "2024-12-06T21:29:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajgoz](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@ajgoz](https://forum.cardano.org/u/ajgoz)\
**Post date:** [6 December 2024 21:29 UTC](https://forum.cardano.org/t/questions-after-native-token-policy-creation/140318/1 "2024-12-06T21:29:35Z")

</div>

I’m looking to play around with creating a native token.

When building out the token policy script, I’m looking to add a time-lock with the invalidAfter function but I’m unable to find a source in the official Cardano documentation with the **invalidAfter** keyword. I do see the “after” and “before” keywords however…

I’m looking to generate a policy similar to this one:

```auto
{
   all: [
      {
         pubKeyHash: "721d21508287404332f35f43054bhc223g9ab3z73ad8333c160039f0"
      },
      {
         invalidAfter: 49422890
      }
   ]
}

```

Would anyone be able to shed some light on this for me, or point me to the right direction?

Thanks all!

---

<div class="post-metadata">

**Author:** ![HeptaSean](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/heptasean/32/82306_2.png) [@HeptaSean](https://forum.cardano.org/u/HeptaSean)\
**Post date:** [6 December 2024 23:23 UTC](https://forum.cardano.org/t/questions-after-native-token-policy-creation/140318/2 "2024-12-06T23:23:23Z")

</div>

> [@ajgoz](#):
>
> I’m looking to generate a policy similar to this one:
> 
> ```json
> {
> all: [
> {
> pubKeyHash: "721d21508287404332f35f43054bhc223g9ab3z73ad8333c160039f0"
> },
> {
> invalidAfter: 49422890
> }
> ]
> }
> 
> ```

In the JSON syntax accepted by `cardano-cli` this would have to look like:

```json
{
  "type": "all",
  "scripts":
  [
    {
      "type": "sig",
      "keyHash": "721d21508287404332f35f43054bhc223g9ab3z73ad8333c160039f0"
    },
    {
      "type": "before",
      "slot": 49422890
    }
  ]
}

```

The documentation closest to the source I could find is:  
[https://github.com/input-output-hk/cardano-node-wiki/blob/main/docs/reference/simple-scripts.md](https://github.com/input-output-hk/cardano-node-wiki/blob/main/docs/reference/simple-scripts.md)  
(I think it used to be in the `cardano-node` repository itself, but they somehow cleaned up there.)

[https://developers.cardano.org/docs/native-tokens/minting-nfts#creating-the-policyid](https://developers.cardano.org/docs/native-tokens/minting-nfts#creating-the-policyid) also tries to explain it.

I don’t know why there would have to be an `invalidAfter` keyword. They just _chose_ to encode this as a `type` of `"before"` (note that it is inverse – if it shall be _invalid after_, it is required to be _before_) in their JSON syntax.

What is actually used on-chain is _not_ this JSON syntax, anyway, but a translation of that into CBOR that is done by `cardano-cli` when you give such a file to it. If interested, the specification of that _actual_ CBOR structure can be found at (this is for the current Conway era, there are equivalent places for the previous eras):

> <https://github.com/IntersectMBO/cardano-ledger/blob/master/eras/conway/impl/cddl-files/conway.cddl#L240-L245>

> <https://github.com/IntersectMBO/cardano-ledger/blob/master/eras/conway/impl/cddl-files/conway.cddl#L564-L566>

> <https://github.com/IntersectMBO/cardano-ledger/blob/master/eras/conway/impl/cddl-files/conway.cddl#L599-L605>

So, there are no keywords at all in the on-chain bytes, but integers `0` through `5` that encode this in an efficient way.

---

<div class="post-metadata">

**Author:** ![ajgoz](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@ajgoz](https://forum.cardano.org/u/ajgoz)\
**Post date:** [7 December 2024 18:36 UTC](https://forum.cardano.org/t/questions-after-native-token-policy-creation/140318/3 "2024-12-07T18:36:40Z")

</div>

Hey, this is a much greater response than I was expecting. Thanks a bunch!
