Skip to content
CCPEDIAby Unity Nodes
VideosLesson 2: Components of Canton

Lesson 2: Components of Canton

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

About this video

There are several components and concepts that come together to build Daml applications. The Canton ecosystem is built on the Canton Network lying at the level of the persistent layer. At this layer, the underlying infrastructure runs Daml Smart contracts stored in the Canton Ledger. The next layer above has participant nodes, where the DAR files are uploaded. Given this architecture, we now need to understand how users using Daml applications interact with the ledger. For that, we need to understand the relationship between parties and users. We also look at how Daml manages authorization and privacy.

00:06 Canton Network 01:37 Parties and Users 02:15 Authorization and Privacy 04:20 Review

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

Transcript

875 words

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

  1. 0:00

    There are several components and concepts that come together to build Daml applications. The Canton ecosystem is built on the Canton Network lying at the level of the persistent layer. At this layer, the underlying infrastructure runs Daml Smart contracts stored in the Canton Ledger. The next layer above has participant nodes, where the DAR files are uploaded.

  2. 0:22

    DAR files are Daml archive files that are created when the Daml templates are compiled. Since the templates and parties we define in Daml exist at these nodes, this is where parties are hosted, identified, and authenticated. The participant node exposes the Daml ledger api, so the client application can then access them as needed.

  3. 0:42

    Zooming in on the front end side, Daml provides a React framework supported by Daml React Libraries. While it's recommended that you use this framework, you can choose virtually any language for your front end and interact with the ledger through an HTTP JSON endpoint.

  4. 0:58

    Using the code generation tools provided by Daml, the code is converted into TypeScript, which then accesses the API server to use the underlying Daml. So as shown here, we find three types of building blocks spread across the application, front end and back end.

  5. 1:14

    The user code is what application developers write to build Daml applications. This is the Daml templates and the React application code. Then there is generated code from Daml. This is the DAR files and type script generated code, and then there are Daml components that are available as part of the Daml ecosystem, the libraries, the API server, and the participant.

  6. 1:37

    Given this architecture, we now need to understand how users using Daml applications interact with the ledger. For that, we need to understand the relationship between parties and users. When we create parties in our templates, we give them certain authority to create contracts with other parties and exercise choices on those contracts.

  7. 1:56

    These parties represent legal entities such as individuals and institutions. One way to think of a party is as a role that has certain authority to perform certain actions. The client application maps users to parties in two capacities.

  8. 2:11

    One is Act As, and the other is read as. The act as clause enables users to do what a party has been authorized to do. For example, create contracts and exercise choices. The Read as Clause enables them to have visibility into their contracts as observers.

  9. 2:29

    This is an important concept as it highlights how Daml manages authorization and privacy. Authorization is about who can do what enabled by the act as Clause and privacy is about who can see what enabled by the read as clause. If we look at the sample table here, we have two parties, party one and party two, and two users, user one and user two.

  10. 2:51

    And the table shows that user one can read as party one and party two. This means that user one is authorized to see as Party one and Party two. User one also has the ability to act as party one, which means it can create contracts and exercise choices as party one.

  11. 3:10

    Also, a user can act as and read as more than one party, and one party can be mapped to more than one user. Let's use the example of Alice and Bob, where Alice uses Bob's cap service. For now, we'll assume that Alice and Bob both have their accounts in the same.

  12. 3:26

    . Now the contracts among these parties, that is Alice, Bob, and the bank has to specify who can do what that is to save the authorization. Alice and Bob can operate their own account, but not anyone else's. The bank can perform certain limited operations on its customers' accounts in terms of who can see what that is. Privacy, the bank can see both their accounts.

  13. 3:49

    However, Alice should not be able to see what is in Bob's account and Bob should not see what is in Alice's. In another scenario, if Alice and Bob use different banks than bank A, which is Alice's Bank should not be able to see Bob's account and Bank B, which is Bob's bank, should not be able to see Alice's account.

  14. 4:08

    Daml helps us implement these controls in the contract so that multiple parties representing different legal entities can safely engage in transactions by maintaining their authorization and their privacy. So let's review what we've covered. Daml applications operate within an ecosystem that has many components.

  15. 4:27

    The Canton Network is the foundation where the infrastructure nodes provide a persistent layer for the Canton Ledger. Participant nodes expose the Daml ledger api, which is accessed by Daml applications. Daml applications have several components.

  16. 4:42

    The user interface could be built with any framework, but Daml provides React libraries. The Daml code is primarily for the backend and is compiled into DAR files. The participant nodes provide access to the Daml Ledger through the Ledger API served by an API server. The users of Daml applications are mapped to parties.

  17. 5:02

    Parties are able to act as and read as the act as clause allows them to perform actions such as create contracts and exercise choices. The read as clause allows users to view the.