Template_Restriction

Hi all,
In Daml is there any restriction we can made for template so that only the party can access those template. any example on this i can go through to get familiar?

1 Like

Do you want to restrict access to templates, or contracts of those templates? For example,

template Iou with
    sender: Party
    receiver: Party
    amount: Int
  where
    signatory sender, receiver

The template is just literally what I wrote above, in other words the Daml code that someone wrote to describe contracts; the contract would be specific, signed creates of this template on a ledger.

The privacy of contracts is at the heart of Daml. For example, only the specific sender and receiver can see any given Iou contract.

Since anyone who can access the server can download all the templates (i.e. all the Daml code written and stored there), so you can see exactly what you’re agreeing to if you sign a contract of one of those templates, template privacy isn’t really part of the model. However, consider this: if I don’t have the signature of the sender I want to put in my Iou contract, I cannot create that contract and make myself the receiver. Contracts cannot be created without the agreement of all signatory parties. If I never receive permission from the relevant sender, what harm can I do by being able to see the Iou template as a participating party on this server?

1 Like