Skip to content
CCPEDIAby Unity Nodes
VideosLesson 3: Privacy

Lesson 3: Privacy

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

About this video

For a better learning experience, sign up and enroll in this free course at: daml.talentlms.com/plus/catalog/courses/151

Transcript

2,403 words

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

  1. 0:00

    the rest of the lessons in this course Center on the critical subject of the Privacy model for DL ledgers this lesson covers the fundamental rules and principles of the daml Privacy model it also offers Clarity on the concept of subtransaction privacy it delves into the widely recognized recordkeeping model the account balance model and how it can compromise privacy the lesson incorporates code demonstrations to

  2. 0:31

    enhance your grasp of privacy within transaction trees reinforcing your understanding of dl's privacy model this foundational knowledge will prepare you for the following lessons following this lesson you will explore the topic of divulgence a privacy breach that can occur as a result of implementing the account balance model you will learn to implement an alternative recordkeeping model known as utxo to address this issue lastly we will cover the

  3. 1:03

    implementation of atomic swaps Atomic swaps prevent scenarios where for example cash can be transferred without the related stock ownership or vice versa understanding Dam's privacy principles is key to managing data access within a ledger while the authority of parties determines who gets to do what privacy determines who gets to to see what the Privacy model of daml ledgers is based on a need to know basis

  4. 1:35

    to ensure that only the parties required to see the data are able to see it consider the following transaction as an example involving four parties the seller the buyer the depository and the bank in this transaction the seller is selling 100 shares of Acme Inc to the buyer at a price of $120 per share to settle this transaction two actions are necessary the transfer of ownership

  5. 2:06

    of the stocks from the seller to the buyer through the Securities depository and the transfer of $122,000 from the buyer to the seller via the bank so what exactly does need to know basis mean in the context of this transaction the seller and the buyer should have visibility only into the essential aspects of the transaction for the seller this means knowing that they have sold 100 shares of Acme ink for

  6. 2:36

    $122,000 the buyer likewise should be aware of their purchase of 100 shares of Acme ink for $112,000 neither of the parties need to know any other personal or unrelated information about the other for the purpose of settling the trade the bank's involvement should be limited to the financial transfer the bank should only have have access to information regarding the $122,000 transfer from the buyer to the seller

  7. 3:06

    any other details about the transaction should not be visible to the bank similarly the depositor's role is to oversee the transfer of ownership of the 100 shares of agme Incorporated the depository should only be privy to information related to this ownership transfer and nothing more dl's privacy model is based on two principles one parties see those actions that they have a stake in and a party is considered a stakeholder in an action

  8. 3:39

    under one of three conditions they are the required authorizer of the action they are a signatory of the contract on which the action is performed they are an observer on the contract and the action either creates or archives the contract in other other words observers have visibility into State changing actions such as the exercise of consuming choices through which contracts are created or

  9. 4:10

    archived non-state changing actions such as fetch or exercise of non-consuming choices remain invisible two every party that sees an action sees its transitive consequences this ensures that every party can independently verify the validity of every transaction they see as a reminder a transaction is a list of Ledger actions a subtransaction is a smaller unit of a transaction consisting of a

  10. 4:42

    subset of Ledger actions related to a specific aspect of the overall transaction the two basic principles for the daml Privacy model are enabled on a subtransaction level as parties in a transaction only learn about the subset of the transaction they are directly involved in but not about any other part of the transaction this applies to both the content of the transaction as well as other involved parties to see how the privacy rules are

  11. 5:13

    applied in practice a transaction workflow can be implemented by adopting the widely used recordkeeping framework known as the account balance model in this model all assets issued by a particular issuer are Consolidated with in a single account to compute a comprehensive balance when an asset owner decides to transfer a portion of their assets to another party the asset amount is temporarily held in escrow in the form of a transfer

  12. 5:44

    proposal upon the recipient's acceptance of the transfer proposal the accepted amount of assets is seamlessly added to the recipient's cumulative balance within the same asset account the workflow adopting the account balance model unfolds as follows US Bank issues $1,000 US Bank offers $400 to Alice which she accepts out of the remaining $600 US Bank offers $100 to Bob and Bob accepts Alice offers $30 to Bob and Bob

  13. 6:25

    accepts the offer US Bank ends up with the remaining $500 Alice ends up with the total account balance of $370 Bob ends up with a total account balance of $130 walking through the code you will learn to analyze which party gains visibility into which contracts and explore the potential risk associated with privacy breaches the asset template which represents the transferable asset itself

  14. 7:00

    has three Fields issuer owner and amount an asset contract is created by both issuer and owner and it must have an amount greater than 0.0 since all assets issued by a particular issuer must be Consolidated into a single total balance it has the key of issuer and owner this represents that an owner can have multiple asset contracts as long as each contract is unique within the scope of issuer and

  15. 7:33

    owner owner of the asset can exercise the asset transfer Choice which takes recipient and transfer amount as inputs the asset transfer Choice archives the asset contract to create a new one by subtracting the transfer amount from the original total balance the transfer amount is placed in escrow for creating an asset transfer proposal contract contract the asset transfer proposal contract represents the asset being proposed to the

  16. 8:06

    recipient aside from all the information that an asset carries such as issuer owner and amount it also has the recipient field which is set to be an observer the recipient can exercise either the asset transfer proposal accept or reject once the recipient accepts the asset the asset is first looked up to check if the recipient already owns any asset from the same issuer look up I key returns either none or a contract ID

  17. 8:38

    encapsulated in the sum Constructor depending on whether or not the asset with the key of issuer and recipient was found if it returns none meaning if the recipient doesn't already have the asset from the issuer create a new asset with the recipient as the owner if the lookup by key returns earns a sum value with a contract ID use the asset contract ID to fetch the existing asset owned by the recipient save the payload of the fetched asset to the

  18. 9:10

    variable asset using the left arrow and archive the contract ID of the fetched asset finally create a new asset by adding the offered amount to the existing amount to create a total balance it is crucial to note that the archival of the existing asset has to be done before creating a new asset because creating a new asset before archiving an existing one will cause a unique key error due to the asset key being issuer

  19. 9:43

    and owner requires the asset to be unique within the scope of issuer and owner if the recipient rejects The Proposal The Proposal is archived and a new proposal is created with the original owner of the asset as the recipient the owner can accept the proposal which will add the offered amount of the asset back to the total balance of the original owner's asset Let's test out the code create a record type test parties

  20. 10:14

    with Fields Alice Bob UB as in US Bank and EB as an EU Bank in the test script setup test parties allocate the four parties and return them as a record of type test parties in the test script test account balance the output of the function set up test parties is bound to the variable test parties with the left Arrow as a reminder the at sign is a type application for extracting the keys of

  21. 10:47

    the test party record such as Alice Bob and UB so they don't need to be referred as test parties. Alice or test parties. Bob first UB the US Bank creates a new asset contract with 1,000 USD as both issuer and owner UB then offers $400 out of the $1,000 to Alice by exercising asset transfer Alice accepts the $400 the remaining $600 owned by UB is queried with query contract key out of the remaining $600 UB offers $100 to

  22. 11:31

    Bob which Bob accepts finally Alice offers $30 to Bob and Bob also accepts the $30 from Alice at the end of the test script the party's Alice Bob UB and the Bob's final asset contract ID are returned what does this mean in terms of privacy as a reminder there are three points to remember when it comes to privacy first stakeholders of the action can view the action and stakeholders mean required authorizers signatories and observers while observers can only

  23. 12:12

    view State changing actions second party that sees an action sees its consequences third the above principles are enabled on a subtransaction level in the transaction view the only stakeholder of the number 00 is UB the signatory of the new asset contract therefore only UB has visibility into the asset contract at number one when UB exercises the asset transfer on the asset contract to offer $400 to Alice two new contracts are

  24. 12:52

    created The Ledger action number 11 a new asset contract created with the remaining $600 and number one two an asset transfer proposal contract with UB as the signatory and Alice as the Observer both contracts are visible to UB the signatory of both contracts but the asset transfer proposal contract is also visible to Alice since Alice is an observer of the contract and the creation of The Proposal contract is a

  25. 13:25

    state-changing action if there were transitive actions further down these consequences those actions would have been also visible to UB any state changing consequences would have been additionally visible to Alice at number 20 when Alice accepts The Proposal as the required authorizer a new asset contract is created with the accepted $400 at number 22 which becomes visible not only to UB but also to Alice since UB remains to be a signal Ator as the issuer and Alice becomes a signatory

  26. 14:02

    of the asset as the new owner notice at number 2 one the lookup I key returns not found if an active contract was found then this non-state changing action also would have been visible to Alice since Alice is the required authorizer of exercising the asset transfer proposal except choice at number 30 when UB offers one $100 to Bob out of the remaining $600 a new asset contract of $500 and an

  27. 14:36

    asset transfer proposal contract are created but only the proposal contract becomes visible to Bob the same way only a proposal becomes visible to Alice at the action number one two at number 40 Bob accepts the $100 which means the newly created asset contract act at number 42 becomes visible to both signatories UB the issuer and Bob the owner at number 5 when Alice offers $30

  28. 15:11

    to Bob a new asset contract is created at number 51 which is visible to the two stakeholders UB and Alice The Proposal created at number 52 becomes visible to all three of you be Alice and Bob since Bob becomes an observer of The Proposal as the receiving party and the creation of The Proposal contract is a state-changing action to The Observer Bob at number 60 when Bob accepts the

  29. 15:42

    proposal to take the $30 for Alice something interesting happens first there's no surprise in the action becoming visible to Bob since Bob is the required authorizer of the exercise action which means he is a stakeholder however there are additional stakeholders Alice and UB the signatories of The Proposal contract on which Bob is exercising the accept choice now there are three stakeholders in total Bob Alice and UB according to

  30. 16:16

    the second principle parties that see an action AKA stakeholders see its transitive consequences it means all three stakeholders gain visibility into all of the trans sensitive consequences including Bob's existing asset contract of $100 which is looked up at number 61 and then fetched at number 62 as a result the $100 which Bob accepted from UB earlier at number 42 becomes visible to Alice

  31. 16:48

    even though Alice is unrelated to the said asset this explains the statement at the action number 42 that says divulge to Alice which indicates that the contract created from the action number 42 has been divulged and became visible to Alice for the same reason the archival of the asset $100 at number 63 as well as the newly created asset contract at number 64 becomes visible to Alice Now

  32. 17:20

    Bob's total account balance of $130 becomes visible to Alice even though Alice is not a Stak older of this asset this lesson focused on the Privacy model for daml ledgers to address who gets to see what which is established based on a need to know basis a few points to remember when it comes to privacy include one stakeholders of the action can view the action and stakeholders mean required authorizers signatories and observers

  33. 17:54

    while observers can only view State changing actions two the party that sees an action also sees its consequences the principles are enabled on a subtransaction level the code demo of this lesson implemented a popular recordkeeping model called the account balance model to uncover the potential risk associated with privacy breaches called divulgence which is further discussed in the following

  34. 18:27

    lesson that