{"id":"CbEUFQUCH5Y","title":"DerivHack2019 2/3: Section A - Working with the CDM in DAML","description":"Next Video:\n   • DerivHack2019 2/3: Section B - CDM Message...  \n\nPrevious Video:\n   • DerivHack2019 1/3: Introduction to DAML  \n\n📖 Get started with Daml: https://bit.ly/tryDaml\n📚 Learn more about Daml Smart Contracts: https://bit.ly/learn_daml\n📮Check out our blogs: https://bit.ly/daml-blog-engineering\n📋 Become a Daml certified expert: https://bit.ly/daml-certification","channel_name":"Daml","published_at":"2019-10-02T00:00:00.000Z","thumbnail_url":"https://i.ytimg.com/vi/CbEUFQUCH5Y/hqdefault.jpg","transcript_text":"okay welcome everyone to this second seminar which is a part of three seminars we're doing in the run-up to the Barclays terryback 2019 the next session will be on the 9th of October next week at 2:30 London time and if you missed the previous session we have a recording on our blog that's logged I'm all calm I think you should be the first link they're all or at least most of the material that you're gonna see today can be seen in a github repo for which the link is there on the slides and also I've pasted it for you guys on the chat and we suggest that you either star or watch the repo because we'll be updating that over the next week or two whenever this changes to the CDM or if there's new material we need to add on there so that's one way to keep in touch with us and the the other ways through the slack Channel Tara vac 2019 on Donald Gribbin slack calm and so let's go over the agenda for today we're gonna pick up from where we were last week we spoke about thermal models but and we're gonna talk mainly about the CDM in this session but we're going to stop short of going into the cloud deployment on turbo which will be the topic for next week we're gonna split the 90 minutes into three sessions the first one will be working with the CDM in demo the second one will be CDM message ingress egress and automation and the last one will be creating reporting UI's and we've slightly modified the format from last week so that at the end of each of those small sessions we're gonna try and feel some of the questions on the zoom chat and just to emphasize that that's the zoom chat not the slack channel so please post your questions there in the Q&A so without further ado we will go on to our first presenter so as Adam this first section will be about how to work the CDM and demo so the first thing we typically will start with is to get all the all the CDM types and demo that you can for example get from the Rosetta portal or we also check that into the repo link that was just shared them at the beginning where we have all the material that you showed now is all in our at area effect 2019 repo and yeah you will also have the demo types included that will be used as part of iacovone but just in case to show you and you can also go to the Rosetta portal and then click on this download button here and that will give you a sip file and the zip file includes a demo folder and there you have like subfolders or is the CDM and that includes all the data types years or all this class the CDM classes you see here account actual price so everything that you have also specified in the Rosetta syntax and but compiled here into Tamil format and we also have the enums in here here you have the function specs that are recently introduced and in the CDM and also some meta classes data types and meta fields and a 7-day time field for so many times and now this alone doesn't help very much because that all data types and as we have seen in the last session and what we actually can't create on the lecture is contract and in order to create contracts you need to have a template definition and that's also very dive in to now so we created here a small hello CDM example so it's very simple it like you will see that's not really doing a lot of sensible things but I think it will show you and the most important features of how to work with with the CDM and Tamil and I'm sure you can translate that to a more sophisticated example so let's look at our ascent example here so in here what I created I created a transfer template now and it holds no such a CDM event so that's now basically the payload I'm offering a CDM event message and but we also need to add certain party information now because as you have seen last time and you always need to have certain party signing a contract so in this case what we do we add an owner and we had an observer he own assigning the tent transfer and contract and the observer can't see it so that's an important takeaway here because given that the CDM itself doesn't have a first-order concept of a party and we need to add that next to the actual message so what we download from the from the CM portal like is all the data types but you also need to include some party information and that's what we did here in the template so the template we combine the actual payload so in this case a CDM event with some party information and then those parties can either sign a contract or they can see it so maybe let's already look at a more precise example you know so I also recall from last time that we have this scenario runner then we are within this IDE we can we can on the fly code up some test tests and and like what I do here I wrote a small transfer function which takes a decimal as input and it builds up a fully populated CDM event and now as you see here that's quite a few of lines that you have to write here and the main reason is that them demo is a strongly typed language so for all the fields where you for example want to set an empty array directly to specifically set that and also for all the optional fields where you don't want to set any future to need to explicitly say that this field is none that's that's just like the complexity that you get a bit if you work with the CDM but yeah apart from that it should be pretty straightforward I mean like the CDM event that's just like all the fields that you have so like we say like okay we don't add and you account information the action field is set to new and then we just like start paid the event down here you see like we had the primitive event and we had some transformation everything for this specific example is now hard-coded except for the amount which goes into the function and down here on the cash transfer component you actually see that we set the amount here like in the second session as already mentioned people show like all egress and ingress works so they're actually like we will show how from starting from a JSON file how can we get more examples in because like some things like you might not always want to code up those examples here by yourself so you can also like load them from Jason but that's part of the second session and the only other thing like that I want to mention is that I added a small function called set globally so for those of you familiar with the CDM so CEM events have a global key which in old times was called Rosetta key and like there I wrote a small function in this main file here and that does nothing else than taking a CDM event as input returning a CDM event and what I do first here is say like okay I set all the meta information to none then I then take this event and then I I call a hash function on top of it that's this sha-256 function let me call that simply then generates hash them from this event and then we bind this globally globally to the meta to the meta fields so that's that's how you can set global keys within demo if required yeah so now we have a nice functional taking the mount as input and building the transfer event but as I mentioned initially that alone you can't put an electrode so let's look at it as a dozen are you know so what you first do is like we get two parties we get Alice and Bob and now we build such a transfer such as CDM transfer event pass in the amount of 100 and then we actually create our transfer contract now so that's really something that we can put on the ledger now and so that thing here so like an instance of this transfer he can put on the letter and that's exactly what we do here so we say that Alice submits a create command where she wants to where she creates this transfer where we bind the transfer like the CBM transferred to the event and then the older becomes Ellis and the observer becomes Bob so now let's look at the result here let's look at the table view so we see LLC's that Bob sees it you have an ID assigned to it we see the status is selective and then given again at the highly nested way of how CDMS work here like you have a lot of nesting levels again so yes sometimes that can be helpful sometimes not so much and so I personally often looked in here and there's highly nested structures I look at the transaction view because then at least you have like our more readable tracing syntax here and there you see like the real payload and there we see here now and the CDM event payload together with the owner whose pop and the observer sorry the owner who's Alice and the observer who's Bob and we also see that it's known to Alice and Bob Ellis because she signed it and Bob because he is an observer on it so that's basically how you can create a new CDM message messages within thermal and then also put them on the letter in this embassy now one eye here now let's look at the simple joy step yet so we had something like I mean the example is called hello.c gem so let's call her say hello choice good and which can be called by the owner and what does that Troyes do if the owner and calls it it's again returning such a transfer contract it takes in whom to greet text as input and then it creates the same the same transfer basically so that's what we say here it creates the same but it updates the event so that's what we can let that's what this create this with event means so own and absorber stays the same but we update the event and how do we update the event we call an update identifier functional on this event that that we have them on the contract and to whom to create goes in and there we like the update identify a function that's a functional which puts the identifier and value to hello like to whom to greet and it increments the version on by one but we will go through this functional step-by-step so as set the signal the function signature it is like that like a text goes in a CDMA event goes in and a CDM event goes out so now the first line is here we say like okay on this CDM event you want to update the event identifier if you actually look here at the event identifier that's actually a list of identifiers so what we do now is we loop over all the identifiers that we have in this list of event identifiers and update he assigned identifier value because at the end of the day we want to update something in here so we want to update the value and we want to increase the version so we loop over all those identifiers now and demo how it's written like this there's not a for loop but you map actually over all the elements so that's what this map function does so the map function applies a functional to all elements in a list and in this case we set the identifier now so let's look at the set identifier function the first line we simply say like okay if we look at this example an identifier has designed identifiers now let's make our life a bit simpler I mean you're signed identifiers actually again an array type but we simply say like okay we never deal with cases where there is more than one assigned identifier so we simply get the first element out so we called ahead function which gets the first assigned identifier if there would be none this code would fail but there would be more than one we simply wouldn't update the others but like we make our life ear more simple and simply said like we assumed that there will be now more than one we can obviously also make that more generic then we got this assigned identify route now in this in this let Nate apart we again call now a function called set aside identifier and that's what we did that we wrap it again in an array and then we can set aside identifier on this identifier which goes into the function so let's look at the set aside identify a function here again we make a lot of our life a bit easier if we look here at the version and we see that the version is sum of 1 so the versions actually an optional type so in theory you don't have to set an option but again we assume sorry we don't have to set an version but we simply assume that there will always be a version present so for this reason we simply called from some function but you simply get the the value if it's sum and it would throw an error if it's none but given that we made the assumption that it will always be there we can call it and then we simply like bump the version by one and then given there it's an optional type you have to again wrap it into some now for the identifier we do something like maybe we simply say now set the value now so let me say like for the identifier set the value to like this string code can be a concatenation so if you look at our example here an identifier is actually of type field with meter which has a value on the meter field but we simply update the value here so the meat that just stays at as it as it was before in our case it's none like for this specific example so we just keep it as and like and then here we simply return the new assigned identifier with a new version and the identifier so why did I show you that like giving like this is this highly nested structure in the CDM you often have to update fields in a bit more like like lower like like lower nesting level and for this you often have to work with lists you have to work with option modes and the CDM given that so many fields are M of type optional and they're also of type list so there I showed you know a few functions like the map function which applies to function to all elements in the list the head function which returns the first element from some function which simply returns the value of the type of sum like what I recommend maybe if you start working like in more anger here to go to our talks like to talks to demo come go to writing demo go to the standard library and there we have two modules then you can import and that's what I already did here at the front so that the boy like at the top my imported da tour list and I've imported da top channel and that exposes an entire set of function that you can lose memory that you can do so for example a d8 or optional you see here this from some function that I already showed you so it's again here it 'nor it extracts the element of a third of a sum or throws an error if it's argument is none there are some other useful functions like the cat optionals where like if you have an array of optionals it would throw out all the nun values and you would simply remain with them as an array of like real values I go list to optional we are starting with a list if the list is empty you would get an optional if you have like more than the elements like the first element would be wrapped to a sum or optional to list so a lot of came handy functions that you can use and I recommend like like at least like if you if you come to the to the problem that you need to like work with them like a certain optional type or a list type and like they're not of any functions like on this chicken for example sort so maybe like skim a bit what's available and they send but yeah what we do now is you want to like call our assay hello world I'm choice here so we go down to a scenario and now say okay Ellis exercises a choice now taking like this contract that we created before as input codes they say hello choice and it greets pop so let's look our example here I'm in the table view we see that the new contract god created it has ID 1.1 again in this table you given the highly nested structure not so nice to look at but let's look at the transact review and we still have the first one on it but it got consumed I'm all ready now and we can now look at the second baby see okay I say hello toys was exercised on the first the contract term that we have and like a new transfer got created and if you look here at the event identifier on the assign identifier we see that identifier value now is Hana Bob as you see that that's like maybe like maybe traverse through like the the tree and the dermal message updated the value to hello pop and increase the version so what nicely I'd say that's that's closing one the first part of there ought to work with the cerium and Mo so basically how to like get new messages in like using like our scenario runner and how to execute the Troy's a bit like all two bucket lists and optionals and the second part that I want to talk with you about is it's not really a difficult feature I would say about its slightly more advanced but it's extremely powerful and I think it's extremely valuable in the concept of the cerium and that's the concept of contract keys so what is a contract key if we look at our scenario result here we see that each contract here and we can also show it archived once they get a contract idea sign but how that contract ID looks like that's that's extremely platform-specific so depending on which platform you run it you might get a different format here so you so you can't directly use idea what you can do is you can for example write a choice which takes a contract that ideas input so I could for example say like okay by I make my say hello world here more complex and say like it takes another contract ID here as input like another transferee as input and so that would be a pointer now and pointing to another transfer and that works as well and but with contract ID with contract G's I can also assign a key a more readable keep to such a contract and the key then for example could be related or it can be related to the payload which is in here so I could say like on any of the fields that I have here I assign a key to this transfer so why is that important it has two main advantages the first advantage is that it that it that it guarantees uniqueness so among all the messages or it in this case among all the transfers that put in the litter here I can guarantee that there will never be two transfers on the ledger having the same key with a small caveat that I talked with you about in a second the second advantage next to uniqueness is that I can fetch then other contracts basically on the fly so like in this in this do block I could say that I want to fetch another transfer by only specifying the key of the other transfer and I will show you that in a second now but for those of you who are familiar with the CDM that actually might ring a bell so the CDM has this concept of global keys that we already saw so that actually nicely maps to a contract G and in Tamil world so basically because if once you assigned a global key for example to a CDM event you basically say that you never want to have two CDM events with the same global key on the letter so if I simply now assign to this transfer year a key with the global key of the event I could guarantee that there are never two transfers on the letter with the same payload was the same CDM event payload in the ledger the second relation with the CDM is the concept of lineage so your you might know that the CDM ax is the strong cops in the concept of a lineage where within the lineage block can also quickly look at that you can actually point to other payloads so for example you can say like I point to another cash flow reference I point to another contract so once I have like like a message on the ledger having a lineage and I want to do something with it I could fetch the contracts which are on in this lineage broke on the fly by simply saying like okay I want to fetch now the contract having this specific reference and now let's look Evan let it set slew today let's look at example to make it a bit more more specific so the first thing that I do is I add heat like I add the key information to my transfer so how does that look like I only have to add those two lines I need to write another function glad Ted clover key so that's very simple now so the get globe if he takes and ventas input and it gets the grower key out and now here comes the small Cheviot that I mentioned so given that there's typically no single party on the ledger who sees all the all the contracts you need to say among which parties are GES Union and that's exactly what we do here so we need to say who's maintaining the key so among which people among which parties the key is actually unique and then you can assign the the real key in our case that's the global key we could also say that multiple people actually maintain the key so it's unique among multiple people so then they're making an error and for example say now you know what the owner and the observer for some reason I'm maintaining the key I mean if we can also make it a bit or we can also extend our model and say like you know what I actually want to have like global uniqueness within my application so I simply add a party who sees everything and our for example name that operator so like to each transfer their add I say like there's always an operator party which also needs to sign my payload here and then I say like okay the operators actually the key maintainer so like operator make sure that there's like global uniqueness among all my transfers and then you have a single party on it meant making that true but that's really up to the demo mode let you write so there's there's really no right or wrong here so like or a specific example we say that transfers are owned by a sort by a certain party and this party also that maintains the key so like the distance fur is unique within this owner party um so good so far select now that showed uniqueness so let's look what that means now in less than an hour scenario so I mentioned before it wouldn't be possible to create the same transfer twice so that's actually try that now Ellis tries to create the same transfer an hour again and now we actually get an error in the scenario so didn't in our target checks where this works out or not and now we actually get the error that we expected because we have an unique key valve and the violation for that key so we can't do that because you can't now given that the Xbox keys then create the same contract once let's look at the lineage aspect that I mentioned so like I haven't really exposed lineage but I'm sure you can I'm trans translate that so what I did here now I created another template which is called show pea party so what does that do and we have a like another template which is signed by the six so like if a signatory and it has two additional fields the owner and the reference field and that has a non consumer choice called show party which returns an optional CDM party and here now comes the important part so this line fetches our transfer now why are the key so you see here now I've never really say like that like like neither here on this like on the payload I'm on the template nor on the choice mode close in I exposed like a contract ID field I only had owner and reference them on it but give them that this transfer here is exactly keyed by our party in I text I now can say fetch me this transfer why are the key what does that add transfer me let's basically say like I want to effect a transfer so I know you could have mentioned that I have another template here called I don't know like transfer to like or foo whatever having the same key so in somewhere need to actually say what we want to fetch and that's exactly doing this head sign so the fetch by key first says like okay what's the type of the contract that I want to fetch and that what's the key you of the contract that I want to fetch and then I then I get back the contract ID and I get back the payload but now you could imagine now if I have something like more complex in here where I said like I have five a mini appeared in here and I am neat that you write the m-dot lineage something like that now I could imagine that I actually go through like my lineage em fields that I have here so go to like lineage but cashflow reference like take the first element and then fetch a cash flow similarly it's like I fetched my transfer contract in here now one once I wrapped like a cash flow in a real country so so I'm construe that you can like connect the dots here or that would work like last but not least I wanted to show you like how you get like a party like a specific party for example out of an event so here we said like okay you want to find the payor party from the event so what would we do be like forget the first transfer again we make our life a bit easier year so we don't loop over all possible transfers but we simply say like a let's at the first transfer same with cash transfer make like end our life easy let's get the first grant cash transfer and then on the cash transfer we said like pay a receiver pay a party reference external reference let's get the value out of it simply assume it's always there and then we call another handy function which is the fine functional so from all possible CDM parties we get the party which has an external key which is the same than our external reference here and that's what that's what this party to doing them that's what this function does here either you find that chapati or you don't find such a party that's the reason bytes of time optional so another small detour to Auto bucket lists that's it from how to work the CDM and demo I hope that was helpful and I would open to a small Q&A now depending how many questions we have yeah I'll quickly comment on a previous question that we had which was why do we name the fields on the transfer contractors owner and an observer not buyer and seller it's simply here for for demonstrational purposes we use a very simple example of course you would in your real model use more names with more or semantic meaning like buy a settler or pay a receiver but here we really try to keep it simple also similar choice is really just a dumb choice as we don't want to show you know too much here of what will actually be required a deck at all another question still open can one party have more than one instance of a transfer in that case will it fetch all the contract IDs and so obviously I'm one party can have more than one transfer but not with the same key in this case so like as seen here in our test scenario and so like Ellis tried to create the same transfer twice that didn't work but Ellis could create another transfer with another cheese so like we could and we can also quickly tried it we could say like I'm create like now we say like transfer to transfer to equal to like friends meant to say like I meet update the meta failure so now that work because now we created another transfer having another global key so that's basically the uniqueness same properties that you get when you use contract keys but like obviously Alice then has to now not to code like two transfers actually like on the letter let's remove the choice here and then if you look here I'm like now we see Alice has two active transfers you yeah that's true I mean the other thing is the suggestion like yeah that's definitely a good one so we're we are actively like like a say mmm so the questions like that it would be nice to have autocompletes and I agree with this kind of highly nested structures and you're always like adding more like more features to the ID that simply want that you haven't had it yet but I agree that this would be very helpful for such data types you any other questions and the fetch function you should contract as a report by party key or contract key so it's so the test that there is not really a difference between party key and contract key so like a contract as a key so there's this there's not something like like a party key but but the contract simply has a key but a key always needs to like needs to have a party field so that you can actually say like who's maintaining the key and and then like a party can simply fetch him a contract wire the contract key but there's no there's nothing like a party key and like as a concept and demo I hope that makes sense okay I think we just I think we need to move on but do keep on putting your questions on the QA tab and we'll answer some more of them after another short session","transcript_synced_at":"2026-10-26T04:17:29.481Z","segments":[{"start_seconds":1,"text":"okay welcome everyone to this second seminar which is a part of three","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1s"},{"start_seconds":11,"text":"seminars we're doing in the run-up to the Barclays terryback 2019 the next","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=11s"},{"start_seconds":18,"text":"session will be on the 9th of October next week at 2:30 London time and if you missed the previous session we have a","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=18s"},{"start_seconds":27,"text":"recording on our blog that's logged I'm all calm I think you should be the first link they're all or at least most of the","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=27s"},{"start_seconds":36,"text":"material that you're gonna see today can be seen in a github repo for which the link is there on the slides and also","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=36s"},{"start_seconds":44,"text":"I've pasted it for you guys on the chat and we suggest that you either star or watch the repo because we'll be updating","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=44s"},{"start_seconds":53,"text":"that over the next week or two whenever this changes to the CDM or if there's new material we need to add on there so","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=53s"},{"start_seconds":62,"text":"that's one way to keep in touch with us and the the other ways through the slack Channel Tara vac 2019 on Donald Gribbin","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=62s"},{"start_seconds":70,"text":"slack calm and so let's go over the","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=70s"},{"start_seconds":78,"text":"agenda for today we're gonna pick up from where we were last week we spoke about thermal models but and","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=78s"},{"start_seconds":86,"text":"we're gonna talk mainly about the CDM in this session but we're going to stop short of going into the cloud deployment on turbo which will be the topic for","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=86s"},{"start_seconds":95,"text":"next week we're gonna split the 90 minutes into three sessions the first","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=95s"},{"start_seconds":102,"text":"one will be working with the CDM in demo the second one will be CDM message","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=102s"},{"start_seconds":109,"text":"ingress egress and automation and the last one will be creating reporting UI's","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=109s"},{"start_seconds":118,"text":"and we've slightly modified the format from last week so that at the end of each of those small sessions we're gonna","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=118s"},{"start_seconds":126,"text":"try and feel some of the questions on the zoom chat and just to emphasize that that's the zoom chat not the slack channel so please post your","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=126s"},{"start_seconds":134,"text":"questions there in the Q&A so without further ado we will go on to our first","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=134s"},{"start_seconds":141,"text":"presenter so as Adam this first section will be about how to work the CDM and","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=141s"},{"start_seconds":150,"text":"demo so the first thing we typically will start with is to get all the all","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=150s"},{"start_seconds":158,"text":"the CDM types and demo that you can for example get from the Rosetta portal or","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=158s"},{"start_seconds":165,"text":"we also check that into the repo link that was just shared them at the beginning where we have all the material that you showed now is all in our at","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=165s"},{"start_seconds":173,"text":"area effect 2019 repo and yeah you will also have the demo types included that will be used as part of iacovone but","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=173s"},{"start_seconds":181,"text":"just in case to show you and you can also go to the Rosetta portal and then click on this download button here and","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=181s"},{"start_seconds":187,"text":"that will give you a sip file and the zip file includes a demo folder and","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=187s"},{"start_seconds":194,"text":"there you have like subfolders or is the CDM and that includes all the data types years or all this class the CDM classes","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=194s"},{"start_seconds":203,"text":"you see here account actual price so everything that you have also specified in the Rosetta syntax and but compiled","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=203s"},{"start_seconds":210,"text":"here into Tamil format and we also have the enums in here here you have the function specs that are recently","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=210s"},{"start_seconds":218,"text":"introduced and in the CDM and also some meta classes data types and meta fields and a 7-day time field for so many times","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=218s"},{"start_seconds":227,"text":"and now this alone doesn't help very much because that all data types and as we have seen in the last session and","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=227s"},{"start_seconds":235,"text":"what we actually can't create on the lecture is contract and in order to create contracts you need to have a","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=235s"},{"start_seconds":242,"text":"template definition and that's also very dive in to now so we created here a small hello CDM example so it's very","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=242s"},{"start_seconds":250,"text":"simple it like you will see that's not really doing a lot of sensible things but I think it will show you and the most important features of how to work","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=250s"},{"start_seconds":258,"text":"with with the CDM and Tamil and I'm sure you can translate that to a more sophisticated example so let's look at","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=258s"},{"start_seconds":266,"text":"our ascent example here so in here what I created I created a transfer template now and it","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=266s"},{"start_seconds":273,"text":"holds no such a CDM event so that's now basically the payload I'm offering a CDM event message and but we also need to","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=273s"},{"start_seconds":280,"text":"add certain party information now because as you have seen last time and you always need to have certain party","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=280s"},{"start_seconds":287,"text":"signing a contract so in this case what we do we add an owner and we had an observer he own assigning the tent","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=287s"},{"start_seconds":295,"text":"transfer and contract and the observer can't see it so that's an important takeaway here because given that the CDM","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=295s"},{"start_seconds":304,"text":"itself doesn't have a first-order concept of a party and we need to add that next to the actual message so what","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=304s"},{"start_seconds":311,"text":"we download from the from the CM portal like is all the data types but you also need to include some party information and that's what we did here in the","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=311s"},{"start_seconds":320,"text":"template so the template we combine the actual payload so in this case a CDM event with some party information and","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=320s"},{"start_seconds":327,"text":"then those parties can either sign a contract or they can see it so maybe let's already look at a more precise","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=327s"},{"start_seconds":335,"text":"example you know so I also recall from last time that we have this scenario runner then we are within this IDE we","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=335s"},{"start_seconds":343,"text":"can we can on the fly code up some test tests and and like what I do here I wrote a small transfer function which","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=343s"},{"start_seconds":352,"text":"takes a decimal as input and it builds up a fully populated CDM event and now as you see here that's quite a few of","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=352s"},{"start_seconds":361,"text":"lines that you have to write here and the main reason is that them demo is a strongly typed language so for all the","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=361s"},{"start_seconds":368,"text":"fields where you for example want to set an empty array directly to specifically set that and also for all the optional","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=368s"},{"start_seconds":376,"text":"fields where you don't want to set any future to need to explicitly say that this field is none that's that's just like the complexity that you get a bit","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=376s"},{"start_seconds":384,"text":"if you work with the CDM but yeah apart from that it should be pretty straightforward I mean like the CDM event that's just like all the fields","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=384s"},{"start_seconds":393,"text":"that you have so like we say like okay we don't add and you account information the action field is set to new and then we just like start paid","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=393s"},{"start_seconds":400,"text":"the event down here you see like we had the primitive event and we had some transformation everything for this","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=400s"},{"start_seconds":408,"text":"specific example is now hard-coded except for the amount which goes into the function and down here on the cash","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=408s"},{"start_seconds":415,"text":"transfer component you actually see that we set the amount here like in the second session as already mentioned people show like all egress and ingress","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=415s"},{"start_seconds":424,"text":"works so they're actually like we will show how from starting from a JSON file how can we get more examples in because","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=424s"},{"start_seconds":432,"text":"like some things like you might not always want to code up those examples here by yourself so you can also like load them from Jason but that's part of","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=432s"},{"start_seconds":441,"text":"the second session and the only other thing like that I want to mention is that I added a small function called set","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=441s"},{"start_seconds":448,"text":"globally so for those of you familiar with the CDM so CEM events have a global key which in old times was called","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=448s"},{"start_seconds":455,"text":"Rosetta key and like there I wrote a small function in this main file here","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=455s"},{"start_seconds":462,"text":"and that does nothing else than taking a CDM event as input returning a CDM event and what I do first here is say like","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=462s"},{"start_seconds":471,"text":"okay I set all the meta information to none then I then take this event and then I I call a hash function on top of","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=471s"},{"start_seconds":480,"text":"it that's this sha-256 function let me call that simply then generates hash them from this event and then we bind","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=480s"},{"start_seconds":488,"text":"this globally globally to the meta to the meta fields so that's that's how you can set global keys within demo if","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=488s"},{"start_seconds":498,"text":"required yeah so now we have a nice functional taking the mount as input and building the transfer event but as I","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=498s"},{"start_seconds":506,"text":"mentioned initially that alone you can't put an electrode so let's look at it as a dozen are you know so what you first","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=506s"},{"start_seconds":514,"text":"do is like we get two parties we get Alice and Bob and now we build such a transfer such as CDM transfer event pass","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=514s"},{"start_seconds":522,"text":"in the amount of 100 and then we actually create our transfer contract now so that's really something that we","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=522s"},{"start_seconds":530,"text":"can put on the ledger now and so that thing here so like an instance of this transfer he can put on the letter and that's exactly","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=530s"},{"start_seconds":539,"text":"what we do here so we say that Alice submits a create command where she wants","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=539s"},{"start_seconds":545,"text":"to where she creates this transfer where we bind the transfer like the CBM transferred to the event and then the","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=545s"},{"start_seconds":552,"text":"older becomes Ellis and the observer becomes Bob so now let's look at the result here let's look at the table view","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=552s"},{"start_seconds":561,"text":"so we see LLC's that Bob sees it you have an ID assigned to it we see the status is selective and then given again","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=561s"},{"start_seconds":569,"text":"at the highly nested way of how CDMS work here like you have a lot of nesting levels again so yes sometimes that can","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=569s"},{"start_seconds":578,"text":"be helpful sometimes not so much and so I personally often looked in here and there's highly nested structures I look at the transaction view because then at","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=578s"},{"start_seconds":587,"text":"least you have like our more readable tracing syntax here and there you see like the real payload and there we see here now and the CDM event payload","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=587s"},{"start_seconds":596,"text":"together with the owner whose pop and the observer sorry the owner who's Alice and the observer who's Bob and we also","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=596s"},{"start_seconds":603,"text":"see that it's known to Alice and Bob Ellis because she signed it and Bob because he is an observer on it","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=603s"},{"start_seconds":611,"text":"so that's basically how you can create a new CDM message messages within thermal and then also put them on the letter in","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=611s"},{"start_seconds":618,"text":"this embassy now one eye here now let's look at the simple joy step yet so we","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=618s"},{"start_seconds":625,"text":"had something like I mean the example is called hello.c gem so let's call her say hello choice good and which can be","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=625s"},{"start_seconds":633,"text":"called by the owner and what does that Troyes do if the owner and calls it it's again returning such a transfer contract","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=633s"},{"start_seconds":641,"text":"it takes in whom to greet text as input and then it creates the same the same","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=641s"},{"start_seconds":648,"text":"transfer basically so that's what we say here it creates the same but it updates the event so that's what we can let","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=648s"},{"start_seconds":656,"text":"that's what this create this with event means so own and absorber stays the same but we update the event and how do we","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=656s"},{"start_seconds":663,"text":"update the event we call an update identifier functional on this event that that we have them on","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=663s"},{"start_seconds":670,"text":"the contract and to whom to create goes in and there we like the update identify a function that's a functional which","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=670s"},{"start_seconds":679,"text":"puts the identifier and value to hello like to whom to greet and it increments","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=679s"},{"start_seconds":686,"text":"the version on by one but we will go through this functional step-by-step so as set the signal the function signature","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=686s"},{"start_seconds":693,"text":"it is like that like a text goes in a CDMA event goes in and a CDM event goes","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=693s"},{"start_seconds":699,"text":"out so now the first line is here we say like okay on this CDM event you want to","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=699s"},{"start_seconds":707,"text":"update the event identifier if you actually look here at the event identifier that's actually a list of","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=707s"},{"start_seconds":715,"text":"identifiers so what we do now is we loop over all the identifiers that we have in","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=715s"},{"start_seconds":722,"text":"this list of event identifiers and update he assigned identifier value because at the end of the day we want to","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=722s"},{"start_seconds":730,"text":"update something in here so we want to update the value and we want to increase the version so we loop over all those","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=730s"},{"start_seconds":737,"text":"identifiers now and demo how it's written like this there's not a for loop but you map actually over all the","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=737s"},{"start_seconds":744,"text":"elements so that's what this map function does so the map function applies a functional to all elements in","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=744s"},{"start_seconds":752,"text":"a list and in this case we set the identifier now so let's look at the set identifier function the first line we","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=752s"},{"start_seconds":760,"text":"simply say like okay if we look at this example an identifier has designed identifiers now let's make our life a bit simpler I mean you're signed","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=760s"},{"start_seconds":768,"text":"identifiers actually again an array type but we simply say like okay we never deal with cases where there is more than","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=768s"},{"start_seconds":776,"text":"one assigned identifier so we simply get the first element out so we called ahead function which gets the first assigned","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=776s"},{"start_seconds":783,"text":"identifier if there would be none this code would fail but there would be more than one we simply wouldn't update the others but like we make our life ear","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=783s"},{"start_seconds":791,"text":"more simple and simply said like we assumed that there will be now more than one we can obviously also make that more generic then we got this assigned identify route","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=791s"},{"start_seconds":800,"text":"now in this in this let Nate apart we again call now a function called set aside identifier and that's what we did","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=800s"},{"start_seconds":808,"text":"that we wrap it again in an array and then we can set aside identifier on this identifier which goes into the function","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=808s"},{"start_seconds":816,"text":"so let's look at the set aside identify a function here again we make a lot of our life a bit easier if we look here at","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=816s"},{"start_seconds":825,"text":"the version and we see that the version is sum of 1 so the versions actually an optional type so in theory you don't","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=825s"},{"start_seconds":833,"text":"have to set an option but again we assume sorry we don't have to set an version but we simply assume that there","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=833s"},{"start_seconds":840,"text":"will always be a version present so for this reason we simply called from some function but you simply get the the","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=840s"},{"start_seconds":848,"text":"value if it's sum and it would throw an error if it's none but given that we made the assumption that it will always be there we can call it and then we","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=848s"},{"start_seconds":856,"text":"simply like bump the version by one and then given there it's an optional type you have to again wrap it into some now","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=856s"},{"start_seconds":863,"text":"for the identifier we do something like maybe we simply say now set the value now so let me say like for the","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=863s"},{"start_seconds":870,"text":"identifier set the value to like this string code can be a concatenation so if you look at our example here an","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=870s"},{"start_seconds":878,"text":"identifier is actually of type field with meter which has a value on the meter field but we simply update the value here so the meat that just stays","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=878s"},{"start_seconds":887,"text":"at as it as it was before in our case it's none like for this specific example so we just keep it as and like and then","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=887s"},{"start_seconds":896,"text":"here we simply return the new assigned identifier with a new version and the identifier so why did I show you that","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=896s"},{"start_seconds":904,"text":"like giving like this is this highly nested structure in the CDM you often have to update fields in a bit more like like lower like like lower nesting level","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=904s"},{"start_seconds":914,"text":"and for this you often have to work with lists you have to work with option modes and the CDM given that so many fields","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=914s"},{"start_seconds":920,"text":"are M of type optional and they're also of type list so there I showed you know a few functions like the map function which applies to function to all","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=920s"},{"start_seconds":929,"text":"elements in the list the head function which returns the first element from some function which simply returns the value of the type of","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=929s"},{"start_seconds":938,"text":"sum like what I recommend maybe if you start working like in more anger here to","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=938s"},{"start_seconds":945,"text":"go to our talks like to talks to demo come go to writing demo go to the","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=945s"},{"start_seconds":952,"text":"standard library and there we have two modules then you can import and that's what I already did here at the front so that the boy like at the top my imported","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=952s"},{"start_seconds":962,"text":"da tour list and I've imported da top channel and that exposes an entire set of function that you can lose memory","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=962s"},{"start_seconds":970,"text":"that you can do so for example a d8 or optional you see here this from some function that I already showed you so","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=970s"},{"start_seconds":977,"text":"it's again here it 'nor it extracts the element of a third of a sum or throws an error if it's argument is none there are","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=977s"},{"start_seconds":984,"text":"some other useful functions like the cat optionals where like if you have an array of optionals it would throw out all the nun values and you would simply","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=984s"},{"start_seconds":992,"text":"remain with them as an array of like real values I go list to optional we are starting with a list if the list is","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=992s"},{"start_seconds":1000,"text":"empty you would get an optional if you have like more than the elements like the first element would be wrapped to a sum or optional to list so a lot of came","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1000s"},{"start_seconds":1009,"text":"handy functions that you can use and I recommend like like at least like if you if you come to the to the problem that","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1009s"},{"start_seconds":1017,"text":"you need to like work with them like a certain optional type or a list type and like they're not of any functions like on this chicken for example sort so maybe","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1017s"},{"start_seconds":1026,"text":"like skim a bit what's available and they send but yeah what we do now is you want to like call our assay hello world","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1026s"},{"start_seconds":1035,"text":"I'm choice here so we go down to a scenario and now say okay","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1035s"},{"start_seconds":1042,"text":"Ellis exercises a choice now taking like this contract that we created before as input codes they say hello choice and it","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1042s"},{"start_seconds":1050,"text":"greets pop so let's look our example here I'm in the table view we see that the new contract god created it has ID","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1050s"},{"start_seconds":1058,"text":"1.1 again in this table you given the highly nested structure not so nice to look at but let's look at the","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1058s"},{"start_seconds":1065,"text":"transact review and we still have the first one on it but it got consumed I'm all ready now and we can now look at the","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1065s"},{"start_seconds":1072,"text":"second baby see okay I say hello toys was exercised on the first the contract term that we have and like a new","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1072s"},{"start_seconds":1080,"text":"transfer got created and if you look here at the event identifier on the assign identifier we see that identifier","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1080s"},{"start_seconds":1089,"text":"value now is Hana Bob as you see that that's like maybe like maybe traverse through like the the tree and the dermal","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1089s"},{"start_seconds":1096,"text":"message updated the value to hello pop and increase the version so what nicely I'd say that's that's","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1096s"},{"start_seconds":1105,"text":"closing one the first part of there ought to work with the cerium and Mo so basically how to like get new messages","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1105s"},{"start_seconds":1113,"text":"in like using like our scenario runner and how to execute the Troy's a bit like all two bucket lists and optionals and","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1113s"},{"start_seconds":1123,"text":"the second part that I want to talk with you about is it's not really a difficult feature I would say about its slightly","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1123s"},{"start_seconds":1130,"text":"more advanced but it's extremely powerful and I think it's extremely valuable in the concept of the cerium and that's the concept of contract keys","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1130s"},{"start_seconds":1140,"text":"so what is a contract key if we look at our scenario result here we see that each contract here and we can also show","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1140s"},{"start_seconds":1149,"text":"it archived once they get a contract idea sign but how that contract ID looks","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1149s"},{"start_seconds":1155,"text":"like that's that's extremely platform-specific so depending on which","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1155s"},{"start_seconds":1162,"text":"platform you run it you might get a different format here so you so you can't directly use idea what you can do","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1162s"},{"start_seconds":1169,"text":"is you can for example write a choice which takes a contract that ideas input so I could for example say like okay by","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1169s"},{"start_seconds":1177,"text":"I make my say hello world here more complex and say like it takes another","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1177s"},{"start_seconds":1184,"text":"contract ID here as input like another transferee as input and so that would be","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1184s"},{"start_seconds":1192,"text":"a pointer now and pointing to another transfer and that works as well and but with contract ID with contract G's I can","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1192s"},{"start_seconds":1200,"text":"also assign a key a more readable keep to such a contract and the key then for example could be related or it can be","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1200s"},{"start_seconds":1209,"text":"related to the payload which is in here so I could say like on any of the fields that I have here I assign a key to this","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1209s"},{"start_seconds":1217,"text":"transfer so why is that important it has two main advantages the first advantage","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1217s"},{"start_seconds":1224,"text":"is that it that it that it guarantees uniqueness so among all the messages or","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1224s"},{"start_seconds":1232,"text":"it in this case among all the transfers that put in the litter here I can guarantee that there will never be two transfers","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1232s"},{"start_seconds":1240,"text":"on the ledger having the same key with a small caveat that I talked with you about in a second the second advantage","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1240s"},{"start_seconds":1248,"text":"next to uniqueness is that I can fetch then other contracts basically on the","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1248s"},{"start_seconds":1255,"text":"fly so like in this in this do block I could say that I want to fetch another","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1255s"},{"start_seconds":1262,"text":"transfer by only specifying the key of the other transfer and I will show you that in a second now but for those of","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1262s"},{"start_seconds":1270,"text":"you who are familiar with the CDM that actually might ring a bell so the CDM has this concept of global keys that we already saw","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1270s"},{"start_seconds":1278,"text":"so that actually nicely maps to a contract G and in Tamil world so","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1278s"},{"start_seconds":1285,"text":"basically because if once you assigned a global key for example to a CDM event you basically say that you never want to","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1285s"},{"start_seconds":1293,"text":"have two CDM events with the same global key on the letter so if I simply now","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1293s"},{"start_seconds":1299,"text":"assign to this transfer year a key with the global key of the event I could guarantee that there are never two","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1299s"},{"start_seconds":1308,"text":"transfers on the letter with the same payload was the same CDM event payload in the ledger the second relation with","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1308s"},{"start_seconds":1315,"text":"the CDM is the concept of lineage so your you might know that the CDM ax is the strong cops in the concept of a","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1315s"},{"start_seconds":1323,"text":"lineage where within the lineage block can also quickly look at that you can actually point to other payloads so for","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1323s"},{"start_seconds":1332,"text":"example you can say like I point to another cash flow reference I point to another contract so once I have like","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1332s"},{"start_seconds":1340,"text":"like a message on the ledger having a lineage and I want to do something with it I could fetch the contracts which are","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1340s"},{"start_seconds":1349,"text":"on in this lineage broke on the fly by simply saying like okay I want to fetch now the contract having this specific","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1349s"},{"start_seconds":1358,"text":"reference and now let's look Evan let it set slew today let's look at example to make it a bit more more specific so the","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1358s"},{"start_seconds":1366,"text":"first thing that I do is I add heat like I add the key information to my transfer so how does","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1366s"},{"start_seconds":1376,"text":"that look like I only have to add those two lines I need to write another function glad Ted clover key so that's very simple now so the get globe if he","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1376s"},{"start_seconds":1385,"text":"takes and ventas input and it gets the grower key out and now here comes the small Cheviot that I mentioned so given","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1385s"},{"start_seconds":1393,"text":"that there's typically no single party on the ledger who sees all the all the contracts you need to say among which","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1393s"},{"start_seconds":1401,"text":"parties are GES Union and that's exactly what we do here so we need to say who's maintaining the key so among which","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1401s"},{"start_seconds":1409,"text":"people among which parties the key is actually unique and then you can assign the the real key in our case that's the","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1409s"},{"start_seconds":1418,"text":"global key we could also say that multiple people actually maintain the key so it's unique among multiple people so then they're making an error and for","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1418s"},{"start_seconds":1426,"text":"example say now you know what the owner and the observer for some reason I'm maintaining the key I mean if we can","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1426s"},{"start_seconds":1433,"text":"also make it a bit or we can also extend our model and say like you know what I actually want to have like global","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1433s"},{"start_seconds":1440,"text":"uniqueness within my application so I simply add a party who sees everything and our for example name that operator","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1440s"},{"start_seconds":1448,"text":"so like to each transfer their add I say like there's always an operator party which also needs to sign my payload here","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1448s"},{"start_seconds":1456,"text":"and then I say like okay the operators actually the key maintainer so like operator make sure that there's like","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1456s"},{"start_seconds":1463,"text":"global uniqueness among all my transfers and then you have a single party on it meant making that true but that's really up to the demo mode let you write so","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1463s"},{"start_seconds":1471,"text":"there's there's really no right or wrong here so like or a specific example we say that transfers are owned by a sort","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1471s"},{"start_seconds":1478,"text":"by a certain party and this party also that maintains the key so like the distance fur is unique within this owner","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1478s"},{"start_seconds":1486,"text":"party um so good so far select now that showed uniqueness so let's look what that means now in","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1486s"},{"start_seconds":1494,"text":"less than an hour scenario so I mentioned before it wouldn't be possible to create the same transfer twice so that's actually try that now Ellis tries","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1494s"},{"start_seconds":1503,"text":"to create the same transfer an hour again and now we actually get an error","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1503s"},{"start_seconds":1512,"text":"in the scenario so didn't in our target checks where this works out or not and now we actually get the error that we expected because we have an unique key","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1512s"},{"start_seconds":1520,"text":"valve and the violation for that key so we can't do that because you can't now given that the Xbox keys then create the","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1520s"},{"start_seconds":1527,"text":"same contract once let's look at the lineage aspect that I mentioned so like I haven't really exposed lineage but I'm","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1527s"},{"start_seconds":1535,"text":"sure you can I'm trans translate that so what I did here now I created another template which is called show pea party","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1535s"},{"start_seconds":1543,"text":"so what does that do and we have a like another template which is signed by the six so like if a signatory and it has","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1543s"},{"start_seconds":1550,"text":"two additional fields the owner and the reference field and that has a non consumer choice called show party which","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1550s"},{"start_seconds":1557,"text":"returns an optional CDM party and here now comes the important part so this line fetches our transfer now why are","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1557s"},{"start_seconds":1566,"text":"the key so you see here now I've never really say like that like like neither here on this like on the payload I'm on","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1566s"},{"start_seconds":1576,"text":"the template nor on the choice mode close in I exposed like a contract ID field I only had owner and reference","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1576s"},{"start_seconds":1584,"text":"them on it but give them that this transfer here is exactly keyed by our party in I text I now can say fetch me","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1584s"},{"start_seconds":1593,"text":"this transfer why are the key what does that add transfer me let's basically say like I want to effect a transfer so I","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1593s"},{"start_seconds":1602,"text":"know you could have mentioned that I have another template here called I don't know like transfer to like or foo whatever having the same key so in","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1602s"},{"start_seconds":1610,"text":"somewhere need to actually say what we want to fetch and that's exactly doing this head sign so the fetch by key first says like okay what's the type of the","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1610s"},{"start_seconds":1619,"text":"contract that I want to fetch and that what's the key you of the contract that I want to fetch and then I then I get back the contract","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1619s"},{"start_seconds":1626,"text":"ID and I get back the payload but now you could imagine now if I have something like more complex in here where I said like I have five a mini","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1626s"},{"start_seconds":1633,"text":"appeared in here and I am neat that you","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1633s"},{"start_seconds":1640,"text":"write the m-dot lineage something like that","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1640s"},{"start_seconds":1648,"text":"now I could imagine that I actually go through like my lineage em fields that I have here so go to like lineage but cashflow reference like take the first","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1648s"},{"start_seconds":1657,"text":"element and then fetch a cash flow similarly it's like I fetched my transfer contract in here now one once I","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1657s"},{"start_seconds":1664,"text":"wrapped like a cash flow in a real country so so I'm construe that you can like connect the dots here or that would work like last but not least I wanted to","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1664s"},{"start_seconds":1673,"text":"show you like how you get like a party like a specific party for example out of an event so here we said like okay you want to find the payor party from the","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1673s"},{"start_seconds":1681,"text":"event so what would we do be like forget the first transfer again we make our life a bit easier year so we don't loop over all possible transfers but we","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1681s"},{"start_seconds":1690,"text":"simply say like a let's at the first transfer same with cash transfer make like end our life easy let's get the first grant cash transfer and then on","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1690s"},{"start_seconds":1699,"text":"the cash transfer we said like pay a receiver pay a party reference external reference let's get the value out of it simply assume it's always there and then","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1699s"},{"start_seconds":1708,"text":"we call another handy function which is the fine functional so from all possible CDM parties we get the party which has","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1708s"},{"start_seconds":1716,"text":"an external key which is the same than our external reference here and that's what that's what this party to doing","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1716s"},{"start_seconds":1723,"text":"them that's what this function does here either you find that chapati or you don't find such a party that's the","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1723s"},{"start_seconds":1731,"text":"reason bytes of time optional so another small detour to Auto bucket lists","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1731s"},{"start_seconds":1737,"text":"that's it from how to work the CDM and demo I hope that was helpful and I would","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1737s"},{"start_seconds":1745,"text":"open to a small Q&A now depending how many questions we have yeah I'll quickly","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1745s"},{"start_seconds":1755,"text":"comment on a previous question that we had which was why do we name the fields","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1755s"},{"start_seconds":1761,"text":"on the transfer contractors owner and an observer not buyer and seller","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1761s"},{"start_seconds":1768,"text":"it's simply here for for demonstrational purposes we use a very simple example of course you would in your real model use","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1768s"},{"start_seconds":1775,"text":"more names with more or semantic meaning like buy a settler or pay a receiver but here we really try to keep it simple","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1775s"},{"start_seconds":1784,"text":"also similar choice is really just a dumb choice as we don't want to show you","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1784s"},{"start_seconds":1794,"text":"know too much here of what will actually","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1794s"},{"start_seconds":1797,"text":"be required a deck at all another","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1797s"},{"start_seconds":1809,"text":"question still open can one party have more than one instance of a transfer in that case will it fetch all the contract IDs and so obviously I'm one party can","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1809s"},{"start_seconds":1818,"text":"have more than one transfer but not with the same key in this case so like as seen here in our test scenario and so","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1818s"},{"start_seconds":1828,"text":"like Ellis tried to create the same transfer twice that didn't work but","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1828s"},{"start_seconds":1835,"text":"Ellis could create another transfer with another cheese so like we could and we can also quickly","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1835s"},{"start_seconds":1842,"text":"tried it we could say like I'm create","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1842s"},{"start_seconds":1847,"text":"like now we say like transfer to","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1847s"},{"start_seconds":1854,"text":"transfer to equal to like friends meant","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1854s"},{"start_seconds":1861,"text":"to say like I meet update the meta failure","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1861s"},{"start_seconds":1888,"text":"so now that work because now we created another transfer having another global key so that's basically the uniqueness","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1888s"},{"start_seconds":1895,"text":"same properties that you get when you use contract keys but like obviously Alice then has to now","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1895s"},{"start_seconds":1903,"text":"not to code like two transfers actually like on the letter let's remove the choice here and then if you look here","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1903s"},{"start_seconds":1911,"text":"I'm like now we see Alice has two active transfers you","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1911s"},{"start_seconds":1926,"text":"yeah that's true I mean the other thing is the suggestion like yeah that's definitely a good one so we're we are","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1926s"},{"start_seconds":1933,"text":"actively like like a say mmm so the questions like that it would be nice to have autocompletes and I agree with this","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1933s"},{"start_seconds":1941,"text":"kind of highly nested structures and you're always like adding more like more features to the ID that simply want that","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1941s"},{"start_seconds":1949,"text":"you haven't had it yet but I agree that this would be very helpful for such data types","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1949s"},{"start_seconds":1956,"text":"you any other questions","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1956s"},{"start_seconds":1970,"text":"and the fetch function you should contract as a report by party key or contract key so it's so the test that","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1970s"},{"start_seconds":1980,"text":"there is not really a difference between party key and contract key so like a contract as a key so there's this","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1980s"},{"start_seconds":1988,"text":"there's not something like like a party key but but the contract simply has a","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1988s"},{"start_seconds":1997,"text":"key but a key always needs to like needs to have a party field so that you can actually say like who's maintaining the key and and then like a party can simply","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=1997s"},{"start_seconds":2007,"text":"fetch him a contract wire the contract key but there's no there's nothing like a party key and like as a concept and","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=2007s"},{"start_seconds":2015,"text":"demo I hope that makes sense okay I think we just I think we need to","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=2015s"},{"start_seconds":2025,"text":"move on but do keep on putting your questions on the QA tab and we'll answer","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=2025s"},{"start_seconds":2032,"text":"some more of them after another short session","url":"https://www.youtube.com/watch?v=CbEUFQUCH5Y&t=2032s"}],"youtube_url":"https://youtube.com/watch?v=CbEUFQUCH5Y","url":"https://ccpedia.xyz/videos/CbEUFQUCH5Y"}