Daml Tokenisation Masterclass [2021]
Nothing is loaded from YouTube until you press play, and then without tracking cookies.
About this video
📚Check out Daml Learning Center: bit.ly/LearnDaml 📖Join our forum and get started: bit.ly/tryDaml
Transcript
2,791 wordsCaptions as YouTube publishes them, usually machine-generated, so names such as Daml and Canton can be misheard.
- 0:00
hi my name is max i'm the developer advocate at digital asset and today in this session we'll be talking about how to tokenize assets with daml digital asset was founded in 2014 and we are based in six locations around the globe on the right hand side you can see a few of the investors and partners that we are currently working with some of these are large institutions with recognizable names such as accenture ibm jpmorgan and we're working with five of the top 10 stock exchanges around the
- 0:31
world names that you might be familiar with such as hong kong exchange and australia stock exchange these are companies that are using daml in their tech stack for their smart contracts so that's to give you some context and the color of what types of companies that are currently using damil in their workflows maybe we'll be going through these six points which are what is damol
- 0:53
and what does it look like key tokenization features such as being able to split mint merge and transfer ownership the mental models that you would need when coding with damol and the interaction flow of the smart contracts and finally a code walkthrough on how to tokenize assets using damo damol is a smart contract language that starts from the building blocks of the rights and obligations with the parties that are concerned so in a case where for example a gym membership the party
- 1:25
would be me and the rights in this case would be my right to be able to use the gym whenever i want and my obligation would be to pay a monthly fee so any asset class can be accurately tokenized with a bundle of rights and obligations and this is effectively what daimle can do endamwa can also be used to create role contracts which define what each specific party may do in an ecosystem when talking about asset tokenization this is a process by which an issuer
- 1:55
creates a digital token on a distributed ledger or a blockchain which represents either a digital or physical asset now it doesn't have to be specifically on a blockchain or distributed ledger this can also be done on a centralized database so key features that we want to keep in mind when performing tokenization on assets or key features that are related to tokenizing an asset include being able to mint the token being able to split being able to merge and finally
- 2:24
transfer of ownership now when we're doing this with damil these are the mental models that we want to keep in mind on the right hand side which is what we call endowment propose and accept pattern and choices each contract will have choices built into them or written into them so let's start out by using our example of what we want to tokenize and in this example we want to tokenize a five pound bill or cash or in or in other words an iou
- 2:55
right so if we look at this bill right here we can see at number one if i just zoom in there you can see it says i promise to pay the bearer on demand the sum of five pounds and this is the obligation written on to this note number two if i zoom in here this is the signature or the signatory of of the obligation whoever put the name towards the obligation now in this case it would be the central bank this bill would be worthless if the bank wouldn't be able
- 3:27
to back up or owe up to this obligation right so and number three we have our security feature which allows us to know whether or not this bill is authentic or not and finally number four we have the unique id and all of these points can be accurately and intuitively modeled in demo so let me walk you through an example of a a process in which we encounter every day here we can see a flow where bob gets a hundred dollars from the bank and then
- 4:00
bob splits that hundred dollars into two fifty dollars and gives fifty dollars to alice now there are certain um there are certain actions that are happening here and in the next slide you can see that there is an ownership transfer a splitting and then an another ownership transfer and in the real world it's quite straightforward and logical to just think okay i can transfer this bill to
- 4:25
alice just by giving it to someone but in damil it's very important to understand that you are not allowed to obligate someone into a contract so in damil a party cannot obligate another party into the contract without that person's consent for example a gym cannot obligate you to put your name on this gym contract without you agreeing to it and a landlord or agent can't put your name on a lease without you agreeing to it so similarly a bank should not be able to
- 4:57
give you money without you agreeing it agreeing with it because it comes with some implications such as tax and if you don't agree to it this is something that then you would be obligated to do so in a digital ecosystem within a digital system we need to code out these workflows and this is what propose an accept pattern really means so in order to fix what we're seeing here you would see that the bank would actually need to ask bob
- 5:28
would you like a hundred dollars cash and in our case we can see this proposal as a smart contract and we would call this for example an iou proposal or just a proposal contract this contract would have the right to accept or reject by bob and if bob accepts it the banks would the bank would have the obligation to pay bob a hundred dollars and once bob has this hundred dollars he can't actually just give it to alice either there would need to be another propose and accept pattern where bob asks alice
- 6:02
alice would you like this hundred dollars or fifty dollars and then alice would then accept or reject so this is what we call the propose and accept pattern and it's used very widely in and it's used very widely in demo let's look another diagram this will give you a step-by-step flow of this chart that we see here so you can see that we start out with an iou contract and when i zoom in here we can see that it is the issuer is the banker and the owner is the banker
- 6:34
and there are two choices which is split and transfer now in the second step we would want to transfer this iou and once this transfer is exercised we are archiving the original contract this iou and a new transfer proposal contract is created and you can see here and you can see here the new owner is bob so that's who we've created with this new iou transfer contract now bob can choose to either accept or reject and once he accepts this iou transfer proposal contract is archived
- 7:14
and it generates a new iou contract with the new owner as being bob um and still a hundred dollars and you can see the same choices that we had in the beginning which is split and transfer now remember when we want to split this iou only bob can do this so bob can exercise his split choice which will then generate two contracts two iou contracts one each worth fifty dollars and these two contracts have identical uh rights and
- 7:46
obligations assigned to them now what bob can then do is to transfer one of these contracts to alice which then archives one of the iou contracts and a transfer proposal contract is created with alice being the new owner and again alice again has the right to either accept or reject and once alice accepts it the transfer proposal is archived and the new iou with the new ownership of alice um is created now that is how we transfer ownership within daml now that we have some of the key
- 8:25
ideas and we understand the workflow of how the smart contract and the parties are interacting i will show you some of the steps required to set this up on your computer what you want to do is go to bitly slash try dammle or bit.ly slash try dammle and that will bring you to the demo community forum where we've pinned a couple of very useful links and what you need to click on is the install demo connect and this will install the entire
- 8:55
download sdk so that you can code these contracts these smart contracts on your computer locally you have the demo sdk downloaded and you have your ide set up in my case i'm using vs code you can go ahead and go to google and just type in iou demo and that will give you the quick start tutorial on how we will be tokenizing an iou now i'm not going to be live coding all the smart contracts because the smart contracts and the templates already come in this example what's more important is to understand
- 9:28
what is written and why it's written in the way that it's shown over here so let's open up this repo and you'll see that in the demo directory we have an iou dot demo file and within this iou.daml file there are two templates the templates are your source of truth it is what the smart contracts will be based off of it will define the rights and obligations and the data model that these smart contracts will have
- 10:00
now these are two demo templates that are under 50 lines of code that deal with privacy and authority we are defining who can do what who can see what contracts and these are all defined very clearly in the daml smart contracts starting with the template iou you can see that we'll be creating an iou smart contract with these data points there is the issuer the owner the currency the amount and the observers the observers means who can see this contract so if a
- 10:34
bank is creating this smart contract and i've accepted it only me and the bank can see the smart contract alice and bob would not be able to see it we have this line here which ensures that this iou is greater than zero and then we have our signatory keyword the signatory means only the issuer and the owner are able to create the smart contract it requires two parties to create because it needs the their authority or their permission like i said earlier with the gym
- 11:05
membership you aren't able to create a smart contract on behalf of someone else or any type of contract so that's what the signatory keyword does if we scroll down here this is the controller keyword and the controller defines that the owner can split and can transfer now not the bank right so even though the bank may have issued the iou they don't have the power or the authority to
- 11:34
transfer your money to split your iou it's clearly defined who can do what and in this case it's the owner now if we take a look at the iou transfer template you can see that it is similar to what we said earlier in the propose accept pattern the iou transfer template allows the new owner to be able to accept or reject this transfer right and the original issuer or the original person who created this iou transfer they have the right to cancel
- 12:10
now that we've gone through the iou template and the iou transfer template um let me use the demo scripts to show you this in action the workflow that we'll be going through is exactly the same as earlier where bob will get a hundred dollars and we'll split that into two fifties and transfer one to alice i'm going to go over here and click on main which i have already written out
- 12:36
some scripts now what the demo script does is it allows you to test your smart contracts locally and you'll be able to see tables of the data changing so as i uncomment this first block right here what this does is that you can see here in the table that it corresponds to an iou now let's walk you through line by line what happens here so in this case i have already allocated three parties which is alice bob and the bank and in this line right here we are saying that the bank is going to create
- 13:14
an iou and the issuer is going to be itself and the owner as itself with the currency and the amount as shown and once it's created we have a table that shows iou and it says the active status the status is active and as you can see the columns line up to the data model that we have for the smart contract now what happens next we want the bank to transfer bob a hundred dollars so let me go ahead and uncomment this next section
- 13:49
now once i do that the iou transfer contract is created and you can see that the issuer is the bank and the owner is the bank however the new owner right here is bob and we don't see the original iou contract because that's been archived so what you can do is click on show archive and then we can see the previous archived iou contract with the line drawn through it and that was the one that we had created just before creating an iou transfer now it's similar to the diagram
- 14:23
that we had earlier where once an iou transfer contract is created the iou contract is archived so at this point in time we've done a propose and accept pattern there is a proposal out there waiting for bob to accept or reject so let's have bob accept the contract and i will uncomment the next section now bob has accepted it and you can see that in the iou transfer table the transfer proposal has been crossed out and there
- 14:58
is a new iou contract created and you can see the status is active with the issuer and the owner with the issuer as the bank and the owner as bob now we want to see when bob splits his contract right into two iou contracts worth fifty dollars so we can do that using the demo scripts here as well i'm going to uncomment the next section where i submit bob where i submit bob's action of
- 15:30
exercising his choice which is the iou split and once it's split let's look at the table here again there are two contracts worth fifty dollars it's just as the workflow and finally we are going to do a propose and accept pattern where bob proposes to alice 50 of the iou contract and in the next section we'll have bob transfer alice 50 so there needs to be a new iou transfer proposal created and this is what we have done with the script right here and finally with the iou transfer
- 16:10
pending all alice has to do is exercise her right to accept and once we accept it i'm going to uncomment the last part you can see that now both iou transfer contracts have been archived and there are two active ious here one with the owner of bob and the one and the other one with the owner of alice using damol we were able to tokenize cash or an iou contract and perform and code out the features of splitting and transferring ownership now in the example repo there it goes into
- 16:49
far more details such as how do we merge the contracts how can we um track in real time the amount of who owes what if you go to bit dot l y slash try dammle you will be able to see far more examples that deal with different industries such as shipping health care and you can see the type of workflows that we've created with daimle so i hope that you guys were able to learn a bit more about how we can
- 17:20
tokenize assets using daml and i encourage everyone to download the sdk and try that out today thank you