{"id":"McU9WNSbgbg","title":"Lesson 4: Daml Workflow Design","description":"For a better learning experience, sign up and enroll in this free course at: https://daml.talentlms.com/plus/catalog/courses/152","channel_name":"Digital Asset Training","published_at":"2025-02-20T00:00:00.000Z","thumbnail_url":"https://i.ytimg.com/vi/McU9WNSbgbg/hqdefault.jpg","transcript_text":"welcome to daml workflow design starting with an understanding of how daml approaches the concepts of decisions actors Authority consequences and visibility we apply these Concepts to a case study to see how they can form the basis for DL workflow analysis we will now explore some rules and guidelines for Designing DL workflows revisiting the case study we can demonstrate how these rules R can be applied to obtain a final damel design to reprise we have been looking at distributed workflows where the cycle from people to decisions to consequences is no longer neatly confined to a single person team or organization but requires coordination verification and rules we have decomposed the problem of analyzing such workflows into understanding the events people decisions and consequences involved and how they are observed and authorized we have also considered how these building blocks form the basis of how we think about daml and the central role the daml choice plays in how daml represents business workflows in daml workflow analysis we have synthesized this understanding into a process to analyze a workflow and then applied it to a simple example in this case a swap market for digital trading cards and we showed how to use this process to analyze the central workflow in such a Marketplace we started by analysing the key decision except swap by considering what authorization was required to reach each decision we ultimately identified five decisions Each of which becomes a damel choice in our workflow but choices don't exist in isolation each choice belongs to a contract that captures the authorization visibility and other context associated with that choice this is the point where analysis transitions to design a workflow with different choices would be a different workflow but even with a workflow this simple there are multiple valid and effective combinations of templates and choice assignments that will work so now we will look at how to produce a simple daml design from our analysis there are a few guidelines that will help us produce a consistent design first the most important rule a choice always remains valid for a specific lifetime that lifetime is always represented by a contract choices are the heart of daml design but contracts are the body they inhabit every choice belongs to a contract and it is the contract that captures authorization visibility and other context which links it to the choice no choice is available forever and and the contract captures that the choice becomes available when the contract is created and ceases to be available when the contract is archived the remaining guidelines are more advisory first if two choices are mutually exclusive in other words if choosing one would render the other moot then they are probably consuming choices on the same contract this is a direct result of the first rule of damel design where we want the lifetime of two choices to align the obvious and easiest way to ensure this is to put them on the same contract another corollary of the first rule of daml design is that if two choices are on the same contract then they share a common cause so if our analysis identifies two choices they're both authorized by the same preceding act then they might end up on the same contract and probably should unless some other consideration make makes that infeasible we said before that contracts capture authorization and visibility it is no surprise then that contracts encode the existence of shared state so where there is a shared fact associated with a workflow this will be associated with one or more contracts and probably should be associated with precisely one contract the opposite is also true The Ledger synchronizes a shared consensus where state is local to a single party and therefore the consensus is a consensus of one it is not strictly necessary for it to be stored as a contract on The Ledger at all in daml the contract is also the unit of shared consensus either the whole contract is shared or none of it is consequently if two different facts are shared with different sets of parties they must be on different contracts each of those contracts will capture the specific visibility requirements for sharing each fact now we are going to apply the guidelines and see if we can derive a simple template SL Choice design every choice needs to belong to a contract and so far we have only identified one of these associations we will start our design by allocating a home for these four choices the choices accept swap cancel swap or reject swap are all mutually exclusive choosing one immediately renders the others invalid they also all share a common cause the decision by Alice to execute proposed swap following our guidelines suggests it is a reasonable initial design to assume these three choices will all exist on the same contract because the choice that created this contract is proposed swap for now we will introduce a swap proposal template this can then contain these choices all of which will be consuming choices creating a swap proposal contract represents entering a specific state in the workflow in traditional systems you represent state by storing data in a record or table somewhere there will be a swap contract stored in databases on the relevant participant nodes when it is created on The Ledger so it is tempting to think of creating a contract as storing a record in a table somewhere however daml is about multi-party workflows and workflows are fundamentally about Behavior therefore it is very helpful and sometimes critical to think of the swap contract not as a record stored in a database but as the set of choices decisions or behaviors now authorized by a ledger the swap proposal record is of almost zero importance here in the case of creating a swap proposal creating the contract means the offerer and proposer jointly authorizing one of accept swap cancel swap or reject swap whichever happens first taking this Behavior oriented approach will almost always produce better and more performant designs that take full advantage of the capabilities of The daml Ledger let's look at the analysis that arrived at the proposed swap choice we see that this workflow state was authorized by Alice responding to Bob so the proposer will be a signatory on this template because this decision authorizes Bob to accept the proposal he needs to be informed of this so the offerer will at least be an observer there is however not yet a compelling case for them to be a signatory so unless we uncover one later for now we will leave it like that the swap proposal contract is the result of the proposer exercising the proposed swap choice we now need to determine what contract that choice belongs to the choice was authorized by Bob exercising his offer card choice this invitation by Bob for proposals is a workflow state that begins when Bob makes his offer and ends either when Bob gives up withdrawing the offer or hopefully when he accepts one of the resulting swap proposals if we remember our first rule of damel design a choice remains valid for a specific Lifetime and that lifetime is always represented by a contract so the lifetime of the proposed swap Choice the limited by Bob's offer and the eventual swap is going to be represented by a contract and given this represents Bob offering a card it is reasonable to call it card offer because this contract represents authorizing proposers to exercise the proposed swap Choice Bob in his role as offerer will be the signatory a key difference between the proposed Swap and accept swap is that while we know Bob has authorized Alice to make the proposal via the marketplace he may also have simultaneously authorized Charlie DEA and Edison to make proposals of their own we know that the proposed swap contract ends with one of the mutually exclusive choices accept reject or cancel swap which means that each of them needs to be a consuming choice on the other hand Alice proposing a swap does not preclude Charlie or deila exercising the choice for themselves this is the sort of Distinction that immediately suggests that proposed swap should be a non-consuming choice there are two final details to consider first when we check our analysis of the offer decision there is the note that the market operator needs to be informed formed of the offer in fact given the offer was made via the marketplace the marketplace almost certainly has a need and indeed an obligation to ensure the offer and eventual swap are concluded Faithfully if we remember one of the rules of damel design where there is a shared fact associated with a workflow this probably should be associated with precisely one contract so we extend the visibility of the card offer to the market provider indeed to allow the marketplace to fulfill their obligation we require that it be a signatory to the card offer contract this will provide the market operator with full visibility of the creation use and eventual termination of the card offer this is how we make progress from the analysis to a simple design each requirement gets mapped across to the appropriate daml concept as we do this we create create templates and contracts as required to host choices and capture the various requirements of authorization visibility and their respective lifetimes before we continue we did say there is a second detail to consider here we have been thinking of proposed swap as a choice offered to Alice as she is the actor in our case study however in practice the offer was made to everyone on the marketplace when we look at the diagram we see that the line from the contract to the exercise crosses over swim lanes and this means we are asking Alice to exercise a choice on a contract that she doesn't know about yet this is a problem because even if she has been authorized to make a choice that authorization isn't useful until she has been told about it this question of visibility is one that often trips up new DL workflow designers in a multi-party system there is no Central server that knows everything going on watching everything and notifying users as things change so we have to answer the question for ourselves how did Alice see the card offer contract in order to exercise the choice daml provides three Alternatives the first is to use the contract observers we talked about in the second lesson this is an ideal solution where the number of parties that need to be informed is low and does not change often however contract observers are stored directly on the contract so if they become too numerous then that will cause a problem also because they are stored on the contract each time they are updated this represents a change to the signatory's consensus on who should observe the contract and that requires archiving the old version of the contract and creating a new version this contract turn can also be a problem in some cases later we will see an example of where contract observers are ideal but for this example we can expect the marketplace to have many participants and so adding all of them as explicit observers will be prohibitive the second is to use what is called a public party here the market operator sets up a dedicated party dedicated to publishing public information to Market participants that party is then made an observer on any contracts that need to be widely visible then every user in the market is granted read access to that party so if Alice is given Reed as permissions on the public market party then she will be able to see the card offer this approach Works in some limited circumstances but it does mean that Alice Bob and every other Market participant has to store their own copy of every card offer or other contract shared in this way on their local participant note this is not a problem if it is likely that Alice will need to use the vast majority of those contracts but in a case like this where we would expect Alice to be interested in one or two out of tens or hundreds of thousands of offers the overhead of transmitting synchronizing and storing all this unnecessary data is prohibitive consequently for this sort of broadcast authorization the third approach is almost always preferred this alternative is called explicit disclosure here the market operator attaches the card offer contract as a disclosed contract bundle to each listing in the marketplace application when Alice views that listing she can download the bundle and attach it to her proposed swap command the demo platform then validates and guarantees that the data Alice obtained from the marketplace is both accurate and timely for our broadcast case this neatly solves the problem with using explicit contract observers as the contract bundle is just data being served by a traditional web service or website this is something we know how to scale effectively and the daml platform protects us from any issues arising from stale data this also addresses the problem with the public party as the data is only stored on Alice's participant node critically the resulting synchronization cost is only paid when it is needed to validate the choices Alice exercises not for every choice made available to her we strongly recommend that you take advantage of this feature when satisfying this sort of large scale one to many broadcast requirements moving on to look at another Choice the card offer contract the card offer contract is the result of Bob deciding to offer a card in the market if we were doing a traditional entity relational or object oriented design we would immediately deduce the existence of a market entity this is because these are data oriented Technologies daml is a technology oriented around actions so it is possible even likely that we will not end up with a market template from a data oriented perspective a market is a thing or a place where Market participants can meet from an action-oriented perspective a market is instead the relation ships between the participants that authorize them to do things in a traditional business context a master Services agreement establishes a framework for future agreements in this case an ongoing relationship between a service provider which were calling the marketplace and a service consumer the market participant defines how and under what conditions each party can exploit the relationship to do something such as offer a card therefore while in a data oriented design we would be introducing the market entity instead in Dale where we use an action oriented design we introduce the concept of the market Services agreement in the case of retail applications such as this one are generally referred to as end user agreements in this example the end user agreement Bob and Alice agreed to when they installed the application by applying an action-oriented frame to the idea of an application and user agreement this contract represents the choices now available to the participant and the market from an authorized installed Market application so we will call this contract a market application installation it is an agreement between Bob and the marketplace so it is reasonable to make Bob and the market operator signatories on the contract in our case studying of the market application installation it it contains the single Choice offer card we use the language enabled by Bob's membership because we expect that Bob exercising this choice will not terminate his relationship to the market to represent this we make offer card a non-consuming choice in a real Marketplace there would be other non-consuming choices representing the other activities covered by the agreement and available through the application there will also probably be at least one consuming choice to Define how the agreement can be terminated but these are other workflows so we will ignore that here for now we will assume the service agreement is created via the standard daml initiate and accept pattern if you are not familiar with this pattern it is described in the online documentation regardless of how the contract comes to be this agreement is going to be the result of a different join the marketplace workflow that must have been completed prior to the offerer initiating the swap workflow a precondition that must be met before The workflow could start we therefore Mark the market participant agreement as a required dependency on the workflow and from the perspective of this workflow we can treat the offer card as an unilateral decision by Bob to initiate the workflow unilateral decisions are the ultimate starting point of workflows as we have worked our way we back to the unilateral decision by Bob to offer a card via the marketplace and therefore the start of this workflow we now work through to the end of the workflow we started by determining there should be a proposed swap template containing the accept swap reject Swap and cancel swap choices as with the analysis we will focus our efforts on the business value that is the accept swap choice in principle all the accept swap has to do is transfer ownership of the offer's card to the proposer and transfer ownership of the proposer card to the owner focusing on the accept swap Choice leaves us with the question what does it mean to own a card in our model with this question we come to a slight deviation from what we have been doing so far from our action-oriented perspective owning a card is not only abundant of authorized actions in this workflow we are interested in the right to transfer it is also an intrinsic bundle of data meaning the description of the card that is shared between the card issuer and the card's owner this shared consensus between the issuer and the owner means this is one place where the data Centric approach and the action Centric approach agree we are going to need a card template so we add a card template to our our design to reflect this is a consensus between the owner and the issuer we will make both of them signatories in this workflow we will have two cards we assume there is an issue card workflow in the larger application that has been completed between the issuers and the cards owners in a similar way to the market installed application the existence of these contracts will predate the swap workflow from the data oriented perspective owning a card is a data record associating the card details the issuer and the owner written to a registry database somewhere from the perspective of action-oriented daml ownership is a bundle of Rights for an owner to own a card means they have the right to decide to do things with the card they have a right to act granted by the issuer the action we are interested in here of course is the right to transfer ownership to reflect this authorized choice we add a transfer choice to the card contract that will change the owner the ultimate goal of our workflow will be therefore to exercise this choice on each of the two cards from the except swap choice this is our first example of a compound Choice a common situation that is corded to damls ability to compose workflows up until now every choice has been its own command issued by a user the offerer submitt exercise offer card as a command to The Ledger to exercise their offer card Choice the proposer then submitted their own exercise proposed swap command to The Ledger and the except swap is also its own command submission but except swap cannot archive and create Bob's card contract directly as this contract is signed by the issuer and accept swap is only authorized by Alice the signatory and Bob the controller so to affect the swap accept swap will need to use the delegated authorization in the transfer card choice in this case the accept swap choice will exercise the transfer choice on Bob's card and then the transfer choice on Alice's card because the card contracts were signed by their respective issuers the transfer choices are able to create the required new card contracts signed by the required issuers the key to identifying this is that for every signatory party on every contract created as a consequence of a choice check that the choice that created it has authorization from that party when checking that this requirement is satisfied remember these points the authorization to create a contract comes from one of two sources either from a controller of the choice or a signatory of the contract hosting the choice in the case of the trans ER from Bob to Alice the new card is signed by issuer a and Alice so we must find a way to obtain authorization from both of them the new card is Created from the transfer choice on the card contract so we automatically gain the authority of both of the card signatories this is how we will obtain the issuer's authorization for the new card which leaves Alice's authorization she is not a signatory on the original card day so she must be a controller of the transfer choice this then imposes the burden of obtaining authorization to exercise the transfer on the accept swap choice in this case Alice is a signatory on the swap proposal contract and so the accept swap can use her Authority as signatory on the swap proposal to act as controller of the transfer Choice which can then add her as a signatory to new card contract as as an aside the owner of a card probably doesn't want to expose a general public choice to transfer that card to whoever can see it with only the new owner as the controller of the transfer choice and the owner as the signatory of the card contract this is precisely what we have so far the solution to this is to require each and every use of the transfer choice to require explicit authorization from the card owner in other other words we will make the transfer Choice a joint decision by both the new and old owners daml supports this directly you can designate any number of parties as required joint controllers this is called a conjunctive choice so now there is one final thing we need to worry about and the design will be complete how did Bob learn of Alice's card the problem is that the submitter of a command must have visibility of every cont contract that is used by the command and up until now Bob has not been told about Alice's card if you recall we had this same problem with the card offer back when we were designing the proposed swap Choice the submitter of a command must already know about every contract that will be used as a result of the command there is no Central trusted server that knows everything and can quietly fill in the gaps behind the scenes last time we used explicit disclosure to solve the problem but in this instance we only need to share one contract between a couple of parties so adding Bob explicitly to the card is a perfectly reasonable solution in fact we will go one step further and adjust our requirements to require Alice to commit her card to the proposal for a period of time to provide a guarantee of settlement to achieve this we will use the Locking by archiving pattern described in the daml developer documentation to lock her card contract when Alice proposes the swap because we are using an established pattern we won't derive the Locking design here but we just walk through the process of applying the pattern we start by adding a lock choice to the card contract this will require the joint authorization of the owner of the card and the desired lock holders therefore this becomes a conjunctive choice and we have the proposed swap exercise lock as a compound Choice as the controller of the proposed swap Choice Alice provides the required owner authorization Bob is being provided the visibility of the card he requires and the guarantee it will be available to ensure this he becomes one of the lock holders and his authorization comes from his signature on the offer card contract it is reasonable for the market provider to maintain oversight of this prod process so they become the second of the lock holders and their authorization also comes from their signing of the offer card contract because the locked card is signed by Bob it is now visible to him and he can use it in except Swap this visibility was the only thing preventing us from completing our design so we returned to the accept swap Choice the first thing except swap is going to do is unlock the locked card the required controllers for this are Alice the card owner and the lock holders the owner Alice signed the swap proposal so we have that authorization the lock holders are the market and the offerer and we obtain authorization from the offerer as the controller of the accept swap choice we don't currently have any source of authorization from the market so we will need to find a way to obtain that the easiest way to do that is to add the market Market provider as a signatory on the swap proposal as we said the only problem we had with the previous accept swap design was the lack of visibility of Alice's card as a controller of the unlock Choice Bob will see the creation of Alice's unlocked card now that he can see both cards the two transfers will now work as we had intended with that we have run out of new decisions to consider the system has reached a new stable State and our design is complete we see the final design is still oriented around the core choices we identified in our analysis the offer card Choice enabled by Bob's membership in the market the proposed swap Choice made available to Alice as a consequence of Bob's offer the accept swap choice that will settle the swap available to Bob as a consequence of Alice's proposal we have also had to Res resolve subtleties around visibility and authorization which we achieved by using explicit disclosure to share the card offer and the Locking pattern to provide Bob visibility of Alice's card but even after this the final workflow remains true to our focus on the decisions that Define and drive the business value exactly where in this process you draw the line in transition from design to implementation will vary slightly depending on your specific project team the diagram above shows our final design updated with a few features that are important in a daml implementation intended for production in particular addressing issues around disaster recovery and operational resilience involved adding expiry timeouts to three of the contracts however despite these implementation concerns the resulting daml code retains exactly the same structure you see here in the design moreover the power of daml and expressing Dynamic workflows is evident and that this entire workflow requires less than 300 lines of daml","transcript_synced_at":"2026-10-26T03:58:32.974Z","segments":[{"start_seconds":0,"text":"welcome to daml workflow design starting with an understanding of how daml approaches the concepts of","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=0s"},{"start_seconds":9,"text":"decisions actors Authority consequences and visibility we apply these Concepts to a case study to see how they can form","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=9s"},{"start_seconds":17,"text":"the basis for DL workflow analysis we will now explore some rules and guidelines for Designing DL","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=17s"},{"start_seconds":25,"text":"workflows revisiting the case study we can demonstrate how these rules R can be applied to obtain a final damel design","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=25s"},{"start_seconds":34,"text":"to reprise we have been looking at distributed workflows where the cycle from people to decisions to consequences","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=34s"},{"start_seconds":41,"text":"is no longer neatly confined to a single person team or organization but requires coordination verification and","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=41s"},{"start_seconds":50,"text":"rules we have decomposed the problem of analyzing such workflows into understanding the events people","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=50s"},{"start_seconds":58,"text":"decisions and consequences involved and how they are observed and authorized we have also considered how","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=58s"},{"start_seconds":65,"text":"these building blocks form the basis of how we think about daml and the central role the daml choice plays in how daml","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=65s"},{"start_seconds":73,"text":"represents business workflows in daml workflow analysis we have synthesized this understanding into","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=73s"},{"start_seconds":81,"text":"a process to analyze a workflow and then applied it to a simple example in this case a swap market for digital trading","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=81s"},{"start_seconds":89,"text":"cards and we showed how to use this process to analyze the central workflow in such a Marketplace we started by analysing the","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=89s"},{"start_seconds":98,"text":"key decision except swap by considering what authorization was required to reach each decision we ultimately identified","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=98s"},{"start_seconds":107,"text":"five decisions Each of which becomes a damel choice in our workflow but choices don't exist in","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=107s"},{"start_seconds":114,"text":"isolation each choice belongs to a contract that captures the authorization visibility and other context associated","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=114s"},{"start_seconds":122,"text":"with that choice this is the point where analysis transitions to design a workflow with different choices would be","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=122s"},{"start_seconds":130,"text":"a different workflow but even with a workflow this simple there are multiple valid and effective combinations of","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=130s"},{"start_seconds":137,"text":"templates and choice assignments that will work so now we will look at how to produce a simple daml design from our","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=137s"},{"start_seconds":145,"text":"analysis there are a few guidelines that will help us produce a consistent design first the most important rule a choice","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=145s"},{"start_seconds":154,"text":"always remains valid for a specific lifetime that lifetime is always represented by a contract choices are","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=154s"},{"start_seconds":162,"text":"the heart of daml design but contracts are the body they inhabit every choice belongs to a contract and it is the","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=162s"},{"start_seconds":170,"text":"contract that captures authorization visibility and other context which links it to the choice no choice is available","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=170s"},{"start_seconds":178,"text":"forever and and the contract captures that the choice becomes available when the contract is created and ceases to be","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=178s"},{"start_seconds":186,"text":"available when the contract is archived the remaining guidelines are more advisory first if two choices are","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=186s"},{"start_seconds":195,"text":"mutually exclusive in other words if choosing one would render the other moot then they are probably consuming choices","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=195s"},{"start_seconds":203,"text":"on the same contract this is a direct result of the first rule of damel design where we want","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=203s"},{"start_seconds":210,"text":"the lifetime of two choices to align the obvious and easiest way to ensure this is to put them on the same","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=210s"},{"start_seconds":217,"text":"contract another corollary of the first rule of daml design is that if two choices are on the same contract then","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=217s"},{"start_seconds":225,"text":"they share a common cause so if our analysis identifies two choices they're both authorized by the same preceding","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=225s"},{"start_seconds":233,"text":"act then they might end up on the same contract and probably should unless some other consideration make makes that","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=233s"},{"start_seconds":240,"text":"infeasible we said before that contracts capture authorization and visibility it is no surprise then that contracts","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=240s"},{"start_seconds":249,"text":"encode the existence of shared state so where there is a shared fact associated with a workflow this will be associated","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=249s"},{"start_seconds":257,"text":"with one or more contracts and probably should be associated with precisely one contract the opposite is also true The","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=257s"},{"start_seconds":266,"text":"Ledger synchronizes a shared consensus where state is local to a single party and therefore the consensus is a","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=266s"},{"start_seconds":274,"text":"consensus of one it is not strictly necessary for it to be stored as a contract on The Ledger at all in daml","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=274s"},{"start_seconds":283,"text":"the contract is also the unit of shared consensus either the whole contract is shared or none of it is consequently if","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=283s"},{"start_seconds":292,"text":"two different facts are shared with different sets of parties they must be on different contracts each of those contracts will","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=292s"},{"start_seconds":300,"text":"capture the specific visibility requirements for sharing each fact now we are going to apply the guidelines and","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=300s"},{"start_seconds":307,"text":"see if we can derive a simple template SL Choice design every choice needs to belong to a contract and so far we have","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=307s"},{"start_seconds":316,"text":"only identified one of these associations we will start our design by allocating a home for these four","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=316s"},{"start_seconds":323,"text":"choices the choices accept swap cancel swap or reject swap are all mutually exclusive choosing one immediately","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=323s"},{"start_seconds":332,"text":"renders the others invalid they also all share a common cause the decision by Alice to execute proposed swap following","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=332s"},{"start_seconds":340,"text":"our guidelines suggests it is a reasonable initial design to assume these three choices will all exist on the same","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=340s"},{"start_seconds":348,"text":"contract because the choice that created this contract is proposed swap for now we will introduce a swap proposal","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=348s"},{"start_seconds":356,"text":"template this can then contain these choices all of which will be consuming choices creating a swap proposal","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=356s"},{"start_seconds":364,"text":"contract represents entering a specific state in the workflow in traditional systems you represent state by storing","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=364s"},{"start_seconds":372,"text":"data in a record or table somewhere there will be a swap contract stored in databases on the relevant","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=372s"},{"start_seconds":380,"text":"participant nodes when it is created on The Ledger so it is tempting to think of creating a contract as storing a record","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=380s"},{"start_seconds":387,"text":"in a table somewhere however daml is about multi-party workflows and workflows are fundamentally about Behavior therefore","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=387s"},{"start_seconds":396,"text":"it is very helpful and sometimes critical to think of the swap contract not as a record stored in a database but","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=396s"},{"start_seconds":404,"text":"as the set of choices decisions or behaviors now authorized by a ledger the swap proposal record is of almost zero","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=404s"},{"start_seconds":413,"text":"importance here in the case of creating a swap proposal creating the contract means the offerer and proposer jointly","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=413s"},{"start_seconds":421,"text":"authorizing one of accept swap cancel swap or reject swap whichever happens first taking this Behavior oriented","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=421s"},{"start_seconds":430,"text":"approach will almost always produce better and more performant designs that take full advantage of the capabilities","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=430s"},{"start_seconds":437,"text":"of The daml Ledger let's look at the analysis that arrived at the proposed swap choice we see that this workflow","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=437s"},{"start_seconds":445,"text":"state was authorized by Alice responding to Bob so the proposer will be a signatory on this template because this","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=445s"},{"start_seconds":454,"text":"decision authorizes Bob to accept the proposal he needs to be informed of this so the offerer will at least be an","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=454s"},{"start_seconds":462,"text":"observer there is however not yet a compelling case for them to be a signatory so unless we uncover one later","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=462s"},{"start_seconds":470,"text":"for now we will leave it like that the swap proposal contract is the result of the proposer exercising the proposed","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=470s"},{"start_seconds":478,"text":"swap choice we now need to determine what contract that choice belongs to the choice was","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=478s"},{"start_seconds":484,"text":"authorized by Bob exercising his offer card choice this invitation by Bob for proposals is a workflow state that","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=484s"},{"start_seconds":492,"text":"begins when Bob makes his offer and ends either when Bob gives up withdrawing the offer or hopefully when he accepts one","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=492s"},{"start_seconds":500,"text":"of the resulting swap proposals if we remember our first rule of damel design a choice remains valid","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=500s"},{"start_seconds":508,"text":"for a specific Lifetime and that lifetime is always represented by a contract so the lifetime of the proposed","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=508s"},{"start_seconds":516,"text":"swap Choice the limited by Bob's offer and the eventual swap is going to be represented by a","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=516s"},{"start_seconds":524,"text":"contract and given this represents Bob offering a card it is reasonable to call it card offer because this contract","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=524s"},{"start_seconds":532,"text":"represents authorizing proposers to exercise the proposed swap Choice Bob in his role as offerer will be the","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=532s"},{"start_seconds":541,"text":"signatory a key difference between the proposed Swap and accept swap is that while we know Bob has authorized Alice","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=541s"},{"start_seconds":550,"text":"to make the proposal via the marketplace he may also have simultaneously authorized Charlie DEA and Edison to","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=550s"},{"start_seconds":557,"text":"make proposals of their own we know that the proposed swap contract ends with one of the mutually exclusive choices accept","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=557s"},{"start_seconds":566,"text":"reject or cancel swap which means that each of them needs to be a consuming choice on the other hand Alice proposing","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=566s"},{"start_seconds":575,"text":"a swap does not preclude Charlie or deila exercising the choice for themselves this is the sort of","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=575s"},{"start_seconds":582,"text":"Distinction that immediately suggests that proposed swap should be a non-consuming choice there are two final details to","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=582s"},{"start_seconds":591,"text":"consider first when we check our analysis of the offer decision there is the note that the market operator needs","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=591s"},{"start_seconds":598,"text":"to be informed formed of the offer in fact given the offer was made via the marketplace the marketplace almost","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=598s"},{"start_seconds":605,"text":"certainly has a need and indeed an obligation to ensure the offer and eventual swap are concluded","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=605s"},{"start_seconds":613,"text":"Faithfully if we remember one of the rules of damel design where there is a shared fact associated with a workflow","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=613s"},{"start_seconds":621,"text":"this probably should be associated with precisely one contract so we extend the visibility of","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=621s"},{"start_seconds":628,"text":"the card offer to the market provider indeed to allow the marketplace to fulfill their obligation we require that","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=628s"},{"start_seconds":635,"text":"it be a signatory to the card offer contract this will provide the market operator with full visibility of the","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=635s"},{"start_seconds":643,"text":"creation use and eventual termination of the card offer this is how we make progress from the analysis to a simple","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=643s"},{"start_seconds":651,"text":"design each requirement gets mapped across to the appropriate daml concept as we do this we create create templates","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=651s"},{"start_seconds":659,"text":"and contracts as required to host choices and capture the various requirements of authorization visibility","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=659s"},{"start_seconds":667,"text":"and their respective lifetimes before we continue we did say there is a second detail to consider here we have been","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=667s"},{"start_seconds":675,"text":"thinking of proposed swap as a choice offered to Alice as she is the actor in our case study however in practice the","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=675s"},{"start_seconds":683,"text":"offer was made to everyone on the marketplace when we look at the diagram we see that the line from the contract","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=683s"},{"start_seconds":690,"text":"to the exercise crosses over swim lanes and this means we are asking Alice to exercise a choice on a contract that she","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=690s"},{"start_seconds":698,"text":"doesn't know about yet this is a problem because even if she has been authorized to make a choice that authorization","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=698s"},{"start_seconds":706,"text":"isn't useful until she has been told about it this question of visibility is one that often trips up new DL workflow","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=706s"},{"start_seconds":714,"text":"designers in a multi-party system there is no Central server that knows everything going on watching everything","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=714s"},{"start_seconds":721,"text":"and notifying users as things change so we have to answer the question for ourselves how did Alice see the card","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=721s"},{"start_seconds":729,"text":"offer contract in order to exercise the choice daml provides three Alternatives the first is to use the","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=729s"},{"start_seconds":738,"text":"contract observers we talked about in the second lesson this is an ideal solution where the number of parties","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=738s"},{"start_seconds":745,"text":"that need to be informed is low and does not change often however contract observers are stored","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=745s"},{"start_seconds":752,"text":"directly on the contract so if they become too numerous then that will cause a problem also because they are stored","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=752s"},{"start_seconds":759,"text":"on the contract each time they are updated this represents a change to the signatory's consensus on who should","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=759s"},{"start_seconds":766,"text":"observe the contract and that requires archiving the old version of the contract and creating a new version this","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=766s"},{"start_seconds":774,"text":"contract turn can also be a problem in some cases later we will see an example of where contract observers are ideal","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=774s"},{"start_seconds":783,"text":"but for this example we can expect the marketplace to have many participants and so adding all of them as explicit","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=783s"},{"start_seconds":790,"text":"observers will be prohibitive the second is to use what is called a public party here the market","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=790s"},{"start_seconds":798,"text":"operator sets up a dedicated party dedicated to publishing public information to Market participants that party is then made an","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=798s"},{"start_seconds":806,"text":"observer on any contracts that need to be widely visible then every user in the market is granted read access to that","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=806s"},{"start_seconds":815,"text":"party so if Alice is given Reed as permissions on the public market party then she will be able to see the card","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=815s"},{"start_seconds":822,"text":"offer this approach Works in some limited circumstances but it does mean that Alice Bob and every other Market","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=822s"},{"start_seconds":831,"text":"participant has to store their own copy of every card offer or other contract shared in this way on their local","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=831s"},{"start_seconds":838,"text":"participant note this is not a problem if it is likely that Alice will need to use the vast majority of those contracts","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=838s"},{"start_seconds":846,"text":"but in a case like this where we would expect Alice to be interested in one or two out of tens or hundreds of thousands","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=846s"},{"start_seconds":853,"text":"of offers the overhead of transmitting synchronizing and storing all this unnecessary data is prohibitive","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=853s"},{"start_seconds":861,"text":"consequently for this sort of broadcast authorization the third approach is almost always preferred this alternative is called","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=861s"},{"start_seconds":870,"text":"explicit disclosure here the market operator attaches the card offer contract as a disclosed contract bundle","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=870s"},{"start_seconds":877,"text":"to each listing in the marketplace application when Alice views that listing she can download the bundle and","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=877s"},{"start_seconds":885,"text":"attach it to her proposed swap command the demo platform then validates and guarantees that the data Alice obtained","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=885s"},{"start_seconds":893,"text":"from the marketplace is both accurate and timely for our broadcast case this neatly solves the problem with using","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=893s"},{"start_seconds":901,"text":"explicit contract observers as the contract bundle is just data being served by a traditional web service or","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=901s"},{"start_seconds":908,"text":"website this is something we know how to scale effectively and the daml platform protects us from any issues arising from","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=908s"},{"start_seconds":916,"text":"stale data this also addresses the problem with the public party as the data is only stored on Alice's","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=916s"},{"start_seconds":923,"text":"participant node critically the resulting synchronization cost is only paid when it is needed to validate the","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=923s"},{"start_seconds":930,"text":"choices Alice exercises not for every choice made available to her we strongly recommend that you take advantage of","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=930s"},{"start_seconds":938,"text":"this feature when satisfying this sort of large scale one to many broadcast requirements moving on to look at","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=938s"},{"start_seconds":946,"text":"another Choice the card offer contract the card offer contract is the result of Bob deciding to offer a card in the","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=946s"},{"start_seconds":954,"text":"market if we were doing a traditional entity relational or object oriented design we would immediately deduce the","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=954s"},{"start_seconds":961,"text":"existence of a market entity this is because these are data oriented Technologies daml is a technology","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=961s"},{"start_seconds":969,"text":"oriented around actions so it is possible even likely that we will not end up with a market template from a","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=969s"},{"start_seconds":977,"text":"data oriented perspective a market is a thing or a place where Market participants can meet from an","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=977s"},{"start_seconds":984,"text":"action-oriented perspective a market is instead the relation ships between the participants that authorize them to do","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=984s"},{"start_seconds":991,"text":"things in a traditional business context a master Services agreement establishes a framework for future agreements in","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=991s"},{"start_seconds":1000,"text":"this case an ongoing relationship between a service provider which were calling the marketplace and a service","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1000s"},{"start_seconds":1006,"text":"consumer the market participant defines how and under what conditions each party can exploit the relationship to do","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1006s"},{"start_seconds":1014,"text":"something such as offer a card therefore while in a data oriented design we would","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1014s"},{"start_seconds":1021,"text":"be introducing the market entity instead in Dale where we use an action oriented design we introduce the concept of the","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1021s"},{"start_seconds":1029,"text":"market Services agreement in the case of retail applications such as this one are generally referred to as end user","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1029s"},{"start_seconds":1038,"text":"agreements in this example the end user agreement Bob and Alice agreed to when they installed the application by","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1038s"},{"start_seconds":1046,"text":"applying an action-oriented frame to the idea of an application and user agreement this contract represents the","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1046s"},{"start_seconds":1053,"text":"choices now available to the participant and the market from an authorized installed Market application so we will","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1053s"},{"start_seconds":1061,"text":"call this contract a market application installation it is an agreement between Bob and the marketplace so it is","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1061s"},{"start_seconds":1068,"text":"reasonable to make Bob and the market operator signatories on the contract in our case studying of the market","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1068s"},{"start_seconds":1076,"text":"application installation it it contains the single Choice offer card we use the language enabled by Bob's membership","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1076s"},{"start_seconds":1085,"text":"because we expect that Bob exercising this choice will not terminate his relationship to the market to represent","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1085s"},{"start_seconds":1092,"text":"this we make offer card a non-consuming choice in a real Marketplace there would be other non-consuming choices","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1092s"},{"start_seconds":1100,"text":"representing the other activities covered by the agreement and available through the application there will also probably be at least one consuming","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1100s"},{"start_seconds":1108,"text":"choice to Define how the agreement can be terminated but these are other workflows so we will ignore that here","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1108s"},{"start_seconds":1116,"text":"for now we will assume the service agreement is created via the standard daml initiate and accept pattern if you","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1116s"},{"start_seconds":1123,"text":"are not familiar with this pattern it is described in the online documentation regardless of how the","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1123s"},{"start_seconds":1130,"text":"contract comes to be this agreement is going to be the result of a different join the marketplace workflow that must","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1130s"},{"start_seconds":1138,"text":"have been completed prior to the offerer initiating the swap workflow a precondition that must be met before The","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1138s"},{"start_seconds":1145,"text":"workflow could start we therefore Mark the market participant agreement as a required dependency on the workflow and","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1145s"},{"start_seconds":1153,"text":"from the perspective of this workflow we can treat the offer card as an unilateral decision by Bob to initiate","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1153s"},{"start_seconds":1161,"text":"the workflow unilateral decisions are the ultimate starting point of workflows as we have worked our way we","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1161s"},{"start_seconds":1168,"text":"back to the unilateral decision by Bob to offer a card via the marketplace and therefore the start of this workflow we","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1168s"},{"start_seconds":1176,"text":"now work through to the end of the workflow we started by determining there should be a proposed swap template","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1176s"},{"start_seconds":1183,"text":"containing the accept swap reject Swap and cancel swap choices as with the analysis we will focus our efforts on","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1183s"},{"start_seconds":1192,"text":"the business value that is the accept swap choice in principle all the accept","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1192s"},{"start_seconds":1199,"text":"swap has to do is transfer ownership of the offer's card to the proposer and transfer ownership of the proposer card","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1199s"},{"start_seconds":1207,"text":"to the owner focusing on the accept swap Choice leaves us with the question what does it mean to own a card in our model","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1207s"},{"start_seconds":1217,"text":"with this question we come to a slight deviation from what we have been doing so far from our action-oriented","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1217s"},{"start_seconds":1224,"text":"perspective owning a card is not only abundant of authorized actions in this workflow we are interested in the right","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1224s"},{"start_seconds":1232,"text":"to transfer it is also an intrinsic bundle of data meaning the description of the card that is shared between the","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1232s"},{"start_seconds":1240,"text":"card issuer and the card's owner this shared consensus between the issuer and the owner means this is one place where","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1240s"},{"start_seconds":1248,"text":"the data Centric approach and the action Centric approach agree we are going to need a card template so we add a card","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1248s"},{"start_seconds":1257,"text":"template to our our design to reflect this is a consensus between the owner and the issuer we will make both of them","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1257s"},{"start_seconds":1265,"text":"signatories in this workflow we will have two cards we assume there is an issue card workflow in the larger","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1265s"},{"start_seconds":1272,"text":"application that has been completed between the issuers and the cards owners in a similar way to the market installed","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1272s"},{"start_seconds":1279,"text":"application the existence of these contracts will predate the swap workflow from the data oriented perspective","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1279s"},{"start_seconds":1287,"text":"owning a card is a data record associating the card details the issuer and the owner written to a registry","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1287s"},{"start_seconds":1295,"text":"database somewhere from the perspective of action-oriented daml ownership is a bundle of Rights for an owner to own a","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1295s"},{"start_seconds":1304,"text":"card means they have the right to decide to do things with the card they have a right to act granted by the issuer the","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1304s"},{"start_seconds":1311,"text":"action we are interested in here of course is the right to transfer ownership to reflect this authorized","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1311s"},{"start_seconds":1318,"text":"choice we add a transfer choice to the card contract that will change the owner the ultimate goal of our workflow will","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1318s"},{"start_seconds":1326,"text":"be therefore to exercise this choice on each of the two cards from the except swap choice this is our first example of a","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1326s"},{"start_seconds":1335,"text":"compound Choice a common situation that is corded to damls ability to compose workflows up until now every choice has","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1335s"},{"start_seconds":1343,"text":"been its own command issued by a user the offerer submitt exercise offer card as a command to The Ledger to exercise","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1343s"},{"start_seconds":1352,"text":"their offer card Choice the proposer then submitted their own exercise proposed swap command to The Ledger and","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1352s"},{"start_seconds":1359,"text":"the except swap is also its own command submission but except swap cannot archive and create Bob's card contract","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1359s"},{"start_seconds":1369,"text":"directly as this contract is signed by the issuer and accept swap is only authorized by Alice the signatory and","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1369s"},{"start_seconds":1377,"text":"Bob the controller so to affect the swap accept swap will need to use the delegated authorization","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1377s"},{"start_seconds":1384,"text":"in the transfer card choice in this case the accept swap choice will exercise the transfer choice on Bob's card and then","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1384s"},{"start_seconds":1392,"text":"the transfer choice on Alice's card because the card contracts were signed by their respective issuers the transfer","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1392s"},{"start_seconds":1400,"text":"choices are able to create the required new card contracts signed by the required issuers the key to identifying this is","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1400s"},{"start_seconds":1409,"text":"that for every signatory party on every contract created as a consequence of a choice check that the choice that","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1409s"},{"start_seconds":1417,"text":"created it has authorization from that party when checking that this requirement is satisfied remember these","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1417s"},{"start_seconds":1424,"text":"points the authorization to create a contract comes from one of two sources either from a controller of the choice","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1424s"},{"start_seconds":1432,"text":"or a signatory of the contract hosting the choice in the case of the trans ER from Bob to Alice the new card is signed","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1432s"},{"start_seconds":1440,"text":"by issuer a and Alice so we must find a way to obtain authorization from both of them the new card is Created from the","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1440s"},{"start_seconds":1450,"text":"transfer choice on the card contract so we automatically gain the authority of both of the card signatories this is how we will obtain","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1450s"},{"start_seconds":1459,"text":"the issuer's authorization for the new card which leaves Alice's authorization she is not a signatory on","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1459s"},{"start_seconds":1467,"text":"the original card day so she must be a controller of the transfer choice this then imposes the burden of obtaining","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1467s"},{"start_seconds":1474,"text":"authorization to exercise the transfer on the accept swap choice in this case Alice is a signatory on the swap","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1474s"},{"start_seconds":1482,"text":"proposal contract and so the accept swap can use her Authority as signatory on the swap proposal to act as controller","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1482s"},{"start_seconds":1491,"text":"of the transfer Choice which can then add her as a signatory to new card contract as as an aside the owner of a","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1491s"},{"start_seconds":1499,"text":"card probably doesn't want to expose a general public choice to transfer that card to whoever can see it with only the","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1499s"},{"start_seconds":1507,"text":"new owner as the controller of the transfer choice and the owner as the signatory of the card contract this is","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1507s"},{"start_seconds":1515,"text":"precisely what we have so far the solution to this is to require each and every use of the transfer choice to","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1515s"},{"start_seconds":1523,"text":"require explicit authorization from the card owner in other other words we will make the transfer Choice a joint","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1523s"},{"start_seconds":1530,"text":"decision by both the new and old owners daml supports this directly you can designate any number of parties as","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1530s"},{"start_seconds":1538,"text":"required joint controllers this is called a conjunctive choice so now there is one final thing we need to worry","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1538s"},{"start_seconds":1546,"text":"about and the design will be complete how did Bob learn of Alice's card the problem is that the submitter of a","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1546s"},{"start_seconds":1554,"text":"command must have visibility of every cont contract that is used by the command and up until now Bob has not","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1554s"},{"start_seconds":1562,"text":"been told about Alice's card if you recall we had this same problem with the card offer back when we were designing","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1562s"},{"start_seconds":1569,"text":"the proposed swap Choice the submitter of a command must already know about every contract that will be used as a","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1569s"},{"start_seconds":1577,"text":"result of the command there is no Central trusted server that knows everything and can quietly fill in the","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1577s"},{"start_seconds":1584,"text":"gaps behind the scenes last time we used explicit disclosure to solve the problem but in this instance we only need to","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1584s"},{"start_seconds":1592,"text":"share one contract between a couple of parties so adding Bob explicitly to the card is a perfectly reasonable solution","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1592s"},{"start_seconds":1601,"text":"in fact we will go one step further and adjust our requirements to require Alice to commit her card to the proposal for a","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1601s"},{"start_seconds":1608,"text":"period of time to provide a guarantee of settlement to achieve this we will use the Locking by archiving pattern","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1608s"},{"start_seconds":1617,"text":"described in the daml developer documentation to lock her card contract when Alice proposes the swap because we","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1617s"},{"start_seconds":1624,"text":"are using an established pattern we won't derive the Locking design here but we just walk through the process of","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1624s"},{"start_seconds":1631,"text":"applying the pattern we start by adding a lock choice to the card contract this will require the joint authorization of","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1631s"},{"start_seconds":1639,"text":"the owner of the card and the desired lock holders therefore this becomes a conjunctive choice and we have the","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1639s"},{"start_seconds":1647,"text":"proposed swap exercise lock as a compound Choice as the controller of the proposed swap Choice Alice provides the","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1647s"},{"start_seconds":1656,"text":"required owner authorization Bob is being provided the visibility of the card he requires and the guarantee it will be available to","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1656s"},{"start_seconds":1665,"text":"ensure this he becomes one of the lock holders and his authorization comes from his signature on the offer card contract","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1665s"},{"start_seconds":1673,"text":"it is reasonable for the market provider to maintain oversight of this prod process so they become the second of the","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1673s"},{"start_seconds":1680,"text":"lock holders and their authorization also comes from their signing of the offer card contract because the locked card is","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1680s"},{"start_seconds":1688,"text":"signed by Bob it is now visible to him and he can use it in except Swap this visibility was the only thing preventing","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1688s"},{"start_seconds":1696,"text":"us from completing our design so we returned to the accept swap Choice the first thing except swap is going to do","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1696s"},{"start_seconds":1705,"text":"is unlock the locked card the required controllers for this are Alice the card owner and the lock holders the owner","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1705s"},{"start_seconds":1713,"text":"Alice signed the swap proposal so we have that authorization the lock holders are the market and the offerer and we obtain","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1713s"},{"start_seconds":1722,"text":"authorization from the offerer as the controller of the accept swap choice we don't currently have any source of","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1722s"},{"start_seconds":1729,"text":"authorization from the market so we will need to find a way to obtain that the easiest way to do that is to add the","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1729s"},{"start_seconds":1737,"text":"market Market provider as a signatory on the swap proposal as we said the only problem we","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1737s"},{"start_seconds":1743,"text":"had with the previous accept swap design was the lack of visibility of Alice's card as a controller of the unlock","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1743s"},{"start_seconds":1751,"text":"Choice Bob will see the creation of Alice's unlocked card now that he can see both cards the two transfers will","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1751s"},{"start_seconds":1759,"text":"now work as we had intended with that we have run out of new decisions to consider the system has","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1759s"},{"start_seconds":1766,"text":"reached a new stable State and our design is complete we see the final design is still oriented around the core choices","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1766s"},{"start_seconds":1775,"text":"we identified in our analysis the offer card Choice enabled by Bob's membership in the market the proposed swap Choice","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1775s"},{"start_seconds":1784,"text":"made available to Alice as a consequence of Bob's offer the accept swap choice that will settle the swap available to","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1784s"},{"start_seconds":1792,"text":"Bob as a consequence of Alice's proposal we have also had to Res resolve subtleties around visibility and","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1792s"},{"start_seconds":1800,"text":"authorization which we achieved by using explicit disclosure to share the card offer and the Locking pattern to provide","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1800s"},{"start_seconds":1807,"text":"Bob visibility of Alice's card but even after this the final workflow remains true to our focus on the decisions that","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1807s"},{"start_seconds":1816,"text":"Define and drive the business value exactly where in this process you draw the line in transition from design","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1816s"},{"start_seconds":1823,"text":"to implementation will vary slightly depending on your specific project team the diagram above shows our final design","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1823s"},{"start_seconds":1832,"text":"updated with a few features that are important in a daml implementation intended for production in particular","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1832s"},{"start_seconds":1839,"text":"addressing issues around disaster recovery and operational resilience involved adding expiry timeouts to three of the","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1839s"},{"start_seconds":1848,"text":"contracts however despite these implementation concerns the resulting daml code retains exactly the same","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1848s"},{"start_seconds":1855,"text":"structure you see here in the design moreover the power of daml and expressing Dynamic workflows is evident","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1855s"},{"start_seconds":1863,"text":"and that this entire workflow requires less than 300 lines of","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1863s"},{"start_seconds":1886,"text":"daml","url":"https://www.youtube.com/watch?v=McU9WNSbgbg&t=1886s"}],"youtube_url":"https://youtube.com/watch?v=McU9WNSbgbg","url":"https://ccpedia.xyz/videos/McU9WNSbgbg"}