Skip to content
CCPEDIAby Unity Nodes
Videoswhat are Contract Templates in Daml?

what are Contract Templates in Daml?

Nothing is loaded from YouTube until you press play, and then without tracking cookies.

About this video

๐Ÿ“– Get started with Daml: bit.ly/tryDaml ๐Ÿ“š Learn more about Daml Smart Contracts: bit.ly/learn_daml ๐Ÿ“ฎCheck out our blogs: bit.ly/daml-blog-engineering ๐Ÿ“‹ Become a Daml certified expert: bit.ly/daml-certification

Contract templates describe data that will be stored on the ledger. Templates determine who can read and write data; and by whom and how this data can be altered.

#DAML is an open-source smart contract language designed to build composable applications on an abstract ledger model.

DAML is a high level language that focuses on data privacy and authorization of distributed applications. These concepts are represented first class in the language.

By abstracting data privacy and authorization, DAML takes the burden off the programmer to think about concrete cryptographic primitives and lets her focus on workflow logic.

DAML is a statically typed functional language.

Applications specified in DAML can be deployed on a growing number of platforms including Amazon Aurora , VMWare Concord , R3 Corda , Hyperledger Fabric , Hyperledger Sawtooth , Project DABL and PostgreSQL .

We will show how to: template keyword signatory observer key maintainer

#distributedapplications #smartcontracts

Transcript

820 words

Captions as YouTube publishes them, usually machine-generated, so names such as Daml and Canton can be misheard.

  1. 0:00

    alright hi everybody welcome to the third video today I'm just going to briefly be going over contract templates contract templates are basically the driving force behind demo so almost everything you're doing in demo is you're defining a template that's later going to be instantiated into a smart contract so you can kind of think of it like you know you define your class in a objective oriented programming language

  2. 0:26

    and then you it's an she ate it later with all the data you need and then you can actually use it so that's kind of how templates relate to contracts in in demoing when used on Electress that support demo so templates are generally pretty simple to very start off with the template declaration and they're given a name and then we have these two key words here with and we're in the case of

  3. 0:51

    width it's basically saying these are the arguments we're going to instantiate our template with all them are strongly typed so I over here is going to be an integer party one is going to be a party and you can look at my video on types a bit more to understand what those are and yeah so that's basically what's the data that you're going to need to initialize the template then the template is also going to have a where clause where you'll be able to specify certain things signatory is basically

  4. 1:25

    the parties that can that actually need to sign off on a contract in order for it to be instantiate it so you're basically saying these are the parties that agree to this more contract this isn't a smart contract in the legal sense but this is just saying that the demo Ledger won't execute unless all these parties say we can execute on this so for example I wouldn't be able to as party to I wouldn't be able to put

  5. 1:50

    somebody else's party once in my contract without them agreeing and being the signatory and then a very similar related keyword is observer unlike a signatory the observers don't need to sign off on a contract they however are the ones that are able to see the contract so there we're just getting more control over who can and can access the general execution and data of this contract this is somewhat akin to having public and private and internal and other types of declarations

  6. 2:22

    and other languages but the difference is that here the execution environment works very hard depending on how the ledger supports it to enforce all of those things to make sure that things that are supposed to be public to certain individuals are public to them and things that are not public to two different parties are not public to them and that's generally how the contract

  7. 2:47

    works I'm gonna skip over key and maintainer here but these are basically just ways to identify the contract the key is kind of a unique key you can almost think of it like a primary key in sequel and I guess I won't skip over it the maintainer is essentially a cardi that's observing the contracts and making sure that all these keys stay unique you know so that this way you don't get conflicting keys and lastly your contracts will have choices and

  8. 3:20

    what choices are are essentially and actually have a small example here in Visual Studio code choices are basically saying this party can do such-and-such to this contract so whatever this contract is doing right now is isn't important but what is important here is that what we're seeing on the contracts is we have a choice we've done it a name beer received and a controller recipient so here we can see that only the recipient is a controller

  9. 3:52

    of this choice for example the giver which is the other party to this contract wouldn't be able to do anything with this particular call so there you're basically just saying who can do what when and encoding it very explicitly without having to do a lot of scaffolding around that this is where a lot of demos power comes in and where a lot of the ideas of smart contracts come in is that you may not be able to do everything under the Sun like you could in a general programming language but the things you are able to do have very

  10. 4:26

    strong guarantees find them and that's really what that most trying to accomplish but yeah in general that's an over a very brief overview of contract templates there's obviously quite a lot more here there's quite a lot of actual functionality you can do but when it comes down to the structure of the contract template that's what it is so thank you very much for watching this video and stay tuned for the next one