DAML is an open-source language used to write distributed applications quickly,concisely and correctly. It runs on leading blockchain platforms like Hyperledger Sawtooth , fabric and Corda.
It is used to build smart contracts for distributed ledgers and provide us with the ability to focus more on business workflow instead of the blockchain implementation.
In our previous blogs, Building Powerful Smart Contracts, Getting started with building Templates we have covered the basics of DAML which will help you understand the language and need of language and also a guide to get you started with it. In this blog we are going to take things to the next level and deploy DAML on dabl ledger.
DAML Ledgers
DAML provides support on different ledgers and gives us the option to choose any of them to deploy our daml.
The following table lists commercially supported DAML ledgers and environments that are available for production use today.
In this blog, we will use project : DABL by digital asset to deploy our application on a blockchain platform.
DABL is a cloud platform built to help you take your application from humble beginnings to mass adoption with as little development as possible. It makes the work of the developer easy by giving them the ability to build a simpler and scalable backend for their application with a serverless experience.
Almost any application heavier than a pure web app can benefit from using DABL as a backend. DABL can be used to build applications like crypto exchanges, loan management platforms, medical claims management, digital rights management, and many more.
Project:DABL
project:DABL is a cloud platform built to help you take your SaaS application from humble beginnings to mass adoption with as little development as possible. It was created by digital asset to deploy our application on a blockchain platform.
Some key features of DABL are :
- It is very easy to use, and scalable as well.
- It lets you manage multiple ledgers on their platform.
- Almost any application heavier than a pure web app can benefit from using project:DABL as a backend.
- All user authentication and authorization policies are automatically generated.
- Provides API endpoints to interact with the ledger.
Developers are using project:DABL to build applications like crypto exchanges, loan management platforms, medical claims management, digital rights management, and many more.
Deployment
To deploy the application on DABL the first step is to build the DAML application. To do so :
- Open the terminal in the DAML project directory.
- Run the command :
daml build
This will create the daml project DAR. This DAR is what we will upload on the DABL to deploy our application.
Moving on, once we are done with this step then we need to open DABL.
You can find DABL here.
To use DABL you need to create an account on it first. Once you are done with it you’ll be directed to your workspace.
The workspace is where you can manage your projects. You can upload multiple projects on DABL and manage them from here.
Now lets deploy our application to the DABL.
On the top right corner of the screen you may see the New Project button.
This will result in the following screen :
Here, you need to add your project name and the ledger name.
Once submitted, It usually takes 2-3 minutes to set up the environment for your project.
Once successful, you can check the ledger and access your project.
As you can see dabl gives you different functionalities like for building the full application. You can upload your daml project and the UI for the project and it will integrate them saving you a lot of hassle.
You can also automate your application. Here, we are just going to upload the DAML project using the DAR we created above.
To upload the DAML project use the following steps:
- Click the upload DAML upload .dar box and a pop will appear to open the file. Navigate to your DAML project directory.
DABL needs the DAR file. The DAR file can be found in the .daml folder.
This folder is hidden. So to make it visible you can you ctrl + H
- Open .daml/dist
- Inside dist is the daml project dar.
- Click on it and it dabl will start building your ledger.
That’s it! You are done. Ledger for your project is created.
Now you can see different options on the screen. Let’s check them out.
DAML Models – You can see your project model in the daml model. It will showcase the structure of the project and you can see the templates code and test scenarios here.
Live data – here you can add Parties and associated Contracts to the ledger.
Ledger settings – This is important to explore because this is where we get the ledger details to interact with our application. At the top is the ledger ID which is given to the ledger. Requests to the ledger are made using the ledger ID. Each party in the contract is given a Party ID and the signatory of the contract is given the Party JWT token.
You can use these settings to make a third party application to interact with your ledger. To do so dabl provides you with API Endpoints. Using these Endpoints you can create and fetch contracts and also exercise choices in the contract.
References :