2

In my understanding, if my script is parameterized, I would need to know the parameters to generate the script and then store it at an address to be later referred. But usually set of possible values for parameters could be very large, so am I right in assuming that design decision of making script parameterized would make me lose the benefit of referencing it?

1 Answer 1

2

You are correct, if you have a parametrized script which you did not 'inject' yet with the parameters, you cannot leverage the referencing of the script.

Note that script referencing is also costly, the initial transaction that attaches the script to an output is expensive. You pay for the size you put on the active part of the chain. If your script is used often, you can save these costs by having lower transaction costs when referencing the script. This break even point has to be considered! If you only use it once, you won't get the cost of it out of the usage.

That said, you could also inject this parametrized data via another way! That is, do not parametrize your script, but retrieve the data from a reference input. Important here, do not forget to mark this input with an NFT to make it secure (remember that anybody can send anything anywhere). The location of the NFT + data in datum is your choice. You could make it so that you can update it, or so that you can have multiple instances of it. So, you can reference an unparametrized script this way :)

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.