1

(This is not related to CIP-33.)

I want a validator to ensure another validator is also run.

Naively I could construct one, get the hash, and hard code it into the other. Presumably two validators can't mutually reference each other. How do people get around this/ What is the canonical way to handle this?

Same question with minting policies and validators. The plutus API provide a forwardToValidator minting policy. I want a validator to then know its 'canonical' currency symbol, but as far as I can see ownCurrencySymbol is vacuous in the context of a validator.

This started by trying to establish how a state machine knows its state token is an NFT. As far as I can see, it doesn't. If an untrusted party initialized a machine, it would be down to a curious user to verify the statetoken is an NFT.

I'm surely not the first person to encounter this but trawling SE and discord didn't shed light on this.

1 Answer 1

1

If you want to ensure that a validator A run alongside another validator B, you need to check that the validator hash is present by the other in a transaction. This can be done by indexing if an output is spent with that hash as a credential (1).

On the problem of mutually referencing in plutus scripts, you need to later inject this data in the script via, for example, by referencing an input that contains the validator/minting hash of both the scripts. So scripts can mutually reference each other, but you cannot hard-code this in each script at the same time.

The forwardValidator that you provided is an example of a minting policy that checks whether a certain validator/minting script is present. As you stated, a validator is not a minting script and thus has no ownCurrencySymbol, this also has to be injected via another way, like a referencing script. If this minting policy is the result of a validator that you run alongside the validation of this script, you could create the minting policy first and hard-code its policy ID in the validator script. It all depends on what you are trying to achieve.

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.