Are you looking for a DAML training or DAML course? If you do, then you have come to the right place. In this article, we will explore DAML in more detail. We will go through a lot of DAML resources that will help you gain mastery.
You can bookmark the article as a DAML training resource and quick-check it while you learn DAML.
We live in an era of distributed applications. With distributed ledger technology becoming more mainstream than ever, it is now time for developers like you to have the skill for the
Our focus will be to build up upon the concepts that we discussed in the DAML tutorial. If you have not read it yet, then we suggest you read it before getting started here.
Build your identity as a certified blockchain expert with 101 Blockchains’ Blockchain Certifications designed to provide enhanced career prospects.
DAML Training: Get Started With DAML
Please include attribution to 101blockchains.com with this graphic. <a href='https://101blockchains.com/blockchain-infographics/'> <img src='https://101blockchains.com/wp-content/uploads/2020/03/daml.png' alt='daml='0' /> </a>
Before we get started, let’s get a basic introduction to DAML. If you are completely new to blockchain, then you can also check out the Blockchain for Beginners guide!
So, what is DAML?
DAML is an open-source programming language that is aimed to provide the tools to create distributed applications. The programming language is concise and can be used quickly to build a dApp.
The key features of DAML include the following
- Data Model
- Fine-grained permissions
- Business logic
- Scenario-based testing
- Storage abstraction
- Authorization checks
- Accountability Tracking
- Atomic Composability
- No double spends
- Need-to-know privacy
- Deterministic execution
And more! Check out the complete list and detailed explanation of our DAML tutorial post.
Not sure how to build your career in enterprise blockchains? Enroll Now – How to Build Your Career in Enterprise Blockchains
Installing DAML
Installing DAML on your machine is very easy. You need to do an SDK installed on your machine. Before that, you need to install dependencies.
The dependencies include the Visual Studio Code and JDK 8 or greater.
To install the SDK, you need to download it from here if you are using Windows.
To install it on MAC or Linux, use the command below.
curl --sSL https://get.daml.com/ | sh
You also need to add ~/.daml/bin to the PATH variable.
Building a simple application using Node.js bindings for DAML
The DAML course that we are going to go through is to build a simple application using DAML and Node.js bindings.
By doing so, you will be able to learn how DAML works and how you can use it to build real-world applications. The application that we are building will be able to do a very simple task, i.e., receive and send ping messages. Amazing, right! Well, it is minimal in its functionality, but it will surely give you a good understanding of how DAML works.
The first thing you need to do is install DAML on your system. For that, you need to make sure that you are using the latest SDK.
Cloning the project
We are going to use the DAML tutorial that is provided by the Digital Asset to learn DAML. We are using Windows 10 for the tutorial to complete.
To proceed, open up the Powershell or command prompt to run the commands.
git clone https://github.com/digital-asset/ex-tutorial-nodejs cd ex-tutorial-nodejs git checkout v0.6.1
Compiling the code
To compile the code, you need to use the following command. Run the command from the root directory itself.
To do so, you need to run the following code.
daml build
Once done, it will show the following message. For now, you can ignore the warning.
Sandbox
With the build complete, it is now time for us to run the sandbox. The sandbox is useful for testing your application. Also, it would be best if you started a new shell so that the sandbox keeps running. To run the sandbox, use the command below.
daml sandbox dist/ex-tutorial-nodejs.dar
Making the Skeleton App run
It’s now time for us to get started with creating our application. To get started, we need first to run the skeleton app that comes within the running ledger and then uses it to our advantage. To do so, let’s get our dependencies up and running.
npm install
This will install the dependencies within the package
To start the application, you now need to run the following command.
npm start
Finally, you can verify the output by running the following command.
hello from <LEDGER_ID>
Understanding Skeleton
To make more sense of what we have on our hands, we need to go through the code itself. The skeleton app that we have in the package contains important code. Before we move forward, let’s take a look at the code of index.js file.
Let’s try to decipher what the first three lines of code are trying to achieve.
First three lines const ledger = require(‘@digital-asset/daml-ledger‘)
This line of code lets you create a ledger object and access the ledger through it. It works as a binding.
cost daml = ledger.daml;
Now, we create another daml object using the daml-ledger library. This is done so that DAML values can be used in the codes.
In the third line, we create another object that binds itself to unique identifiers.
Next three lines
The next three lines might seem a little more complex than the earlier ones. For now, you need to understand that they are used for reading command-line arguments. They also provide sensible defaults to our program.
The core code
The last section of the index.js does the heavy lifting.
Here, you will see the application utilizes the DamlLedgerClient.connect method to connect to the ledger. To connect properly, the method utilizes two arguments.
- The first argument is the connection options object
- Callback function
The callback functions take care of both the outcomes including success and failure.
Also, you can see that to connect, two parameters are must, host and port. If you do not specify these correctly, the connection will fail.
If you have worked with Node.js in the past, then you will know that the callback functions are common in how Node.js works. If you are completely new to Node.js, then do not worry as you do not need working-level expertise to learn from the tutorial itself.
If everything works as intended, the client object will start ledger communication.
Running it will simply give the output of “Hello, World!”
The next steps that you need to take in this training include the following.
- Package identifiers retrieve
- Pingpong module understanding
- Contract creation
- Reading transactions
- Exercise choice
- Reading an active contract.
All of these steps are well-covered in the official Digital Asset tutorial on their GitHub page. We recommend you to check the tutorial and go through each step to understand it in much more depth.
DAML 12 Use Cases
You can also train yourself by going through the 12+ examples of use cases that use DAML. These several use cases will surely help you self-train yourself in DAML and get yourself equipped with the knowledge to do your DAML training yourself.
GitHub repository: https://github.com/digital-asset/ex-mode
The DAML examples that are shared there include the following:
- Airline Seat Allocation
- Approval Chain
- Broadcast
- Group Chat
- Crowdfunding
- Chess
- Issuer Token
- Expense Pool
- MongoDB ODS
- Onboarding
- Governance
- Task Tracking
- Tic-Tac-Toe
- Voting
To get started, you need to download the repository and then compile the individual projects. Always go through the code to get a better understanding of how DAML is playing a role in making the app functional.
Java Binding Tutorial
If you are a Java guy and want to learn how to do Java binding with DAMl, then you check out the online tutorial presented by Digital Asset. The page has a proper walkthrough on how to set up the project. It will also walk you through the different intricacies of code itself.
Check out the GitHub repository here: https://github.com/digital-asset/ex-java-bindings
Other DAML Training tutorials worth checking out
There are also plenty of other DAML training tutorials that you can check out. To help you, let’s list them below.
Collateral Management DAML Example
In this example, you learn how to do collateral management and model it in DAML. You will get familiar with the concept of collateral management. Then, it will shift the focus on the model design of the process. Finally, the DAML implementation will be done keeping the key designs in mind. The sample workflow will also be provided so that you can see the test scenario at work.
GitHub repository: https://github.com/digital-asset/ex-collateral
Bond Trading Example
In this example, you are going to learn how to trade bonds against cash. The tutorial will teach you how to model the concept in DAML and then implement it in the Java Application Framework.
GitHub repository: https://github.com/digital-asset/ex-bond-trading
Want to know how a blockchain works? Enroll in Enterprise Blockchains Fundamentals – Free Course Now!
Repurchase agreement example
In this DAML training example, you are going to learn about the repo market. You will create a repo trading model and then implement it using DAML.
GitHub repository: https://github.com/digital-asset/ex-repo-market
Why is it necessary to get certified?
If you are serious about your future and want to make it big in the blockchain industry, then it is always a good idea to get certified. It will help you gain all the confidence that you need to work and showcase your skill to your prospective audience.
Conclusion
This leads us to the end of our DAML training article. Here we look at DAML training tutorials and resources. By following these, you are bound to improve your DAML theoretical and practical knowledge.
*Disclaimer: The article should not be taken as, and is not intended to provide any investment advice. Claims made in this article do not constitute investment advice and should not be taken as such. 101 Blockchains shall not be responsible for any loss sustained by any person who relies on this article. Do your own research!