Minting Token With Time Base

Yes, this is the structure. The keyHash is always paired with the type sig; the slot is always paired with the type before. One can think of this script as being composed of two “sub-scripts”:

  1. {"slot" : 28860486, "type" : "before"} is a script that restricts minting to before a certain time. By itself, a “before” script doesn’t require a signing key. (This is why you don’t need two signing keys for the overall script.)
  2. {"keyHash": "d4b9b71fffec086c6a75893735183f28b000894f1f717293a7554a65", "type" : "sig"} is a script that requires the minting transaction to be signed by the key with that particular hash. So this does require there be a signing key.

{"scripts" : [ ... ], "type" : "all"} combines the scripts in the square brakets into a composite script that validates if all of the individual scripts validate. In this case it means that the minting must occur before the time and it must be properly signed. One can think of the all as meaning that each of the conditions have to hold true in order to mint.

If one were to use any in a script like this, then it would mean that the minting must occur before the time or it must be properly signed. That would mean that anyone could mint these tokens before the time and they wouldn’t necessarily need to sign the minting transaction; or the person with the signing key could mint anytime, even after the time had passed. One can think of the any as meaning that at least one of the conditions has to hold in order to mint.

1 Like

Wow… That is totally clear… Thanks a lot for explaining in such detail order. I hope your post here can be read by all Cardano Community to help us all minting a token. Anyhow, do you have twitter?
I would love to follow you.

1 Like

Okay, I try it and I got this error

transaction submit Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraMary (ApplyTxError [LedgerFailure (UtxowFailure (ScriptWitnessNotValidatingUTXOW (fromList [ScriptHash “xxxxxxxxxxxxxxxxxxxxxxx”])))])

Any Idea why?

Okay, I got the solution from here.