Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comparison between Daml and Solidity #7764

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
128 changes: 128 additions & 0 deletions content/articles/comparison-between-daml-and-solidity/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
Since [Web3.O](https://www.section.io/engineering-education/overview-of-web-3-0/) was introduced, blockchain and smart contracts have become a solution for securing transactions. Smart contracts is a computer program created using Daml, Solidity, and other decentralized applications (DApps) programming languages.
Daml is a smart contracts language that is open source. It takes that massive, complex system and gives you the best tangible representation of your business process. On the other hand, Solidity is a high-level language for writing smart contracts.

An in-depth overview of Daml and Solidity will be provided in this article. You will fully understand how they work and the role they play. Also, you will learn how Daml is used for blockchain in business and be given examples of business use cases to help you comprehend.

### Table of contents
[Solidity overview](#solidity-overview)
[Daml overview](#daml-overview)
[Why would businesses use Daml instead of Ethereum](#why-would-businesses-use-daml-instead-of-ethereum)
[Daml vs Solidity: similarities and differences](#daml-vs-solidity-similarities-and-differences)
[Aspects to consider when comparing Daml and Solidity](#aspects-to-consider-when-comparing-daml-and-solidity)
[Business usecase example](#business-usecase-example)

### Solidity overview
Solidity is the main programming language for writing smart contracts on Ethereum network. It is object-oriented and high-level as it is heavily influenced by Python, C++, and JavaScript programming languages. Solidity is built on top of the Ethereum Virtual Machine (EVM). Because Solidity is used within the EVM network, It can create DApps.

Solidity is statically typed and supports inheritance and libraries, and it's a fully developed programming language. It implements the business logic in a blockchain system and generates a chain of transaction records.

The latest version of [Solidity v0.8.15](https://docs.soliditylang.org/en/v0.8.15/#) code is written and compiled by Remix IDE. [Remix IDE](https://remix.ethereum.org/) is a browser-based IDE where you can write Ethereum smart contract source code, compile, deploy live to a blockchain, and test. All on your browser.

To begin creating smart contracts, navigate to the Remix IDE, then click the paper icon to add a new project, as shown below:

![Remix IDE](/engineering-education/comparison-between-daml-and-solidity/remix-ide.png)

We saved the project as `Calculator.sol`. We use capital letters for smart contract file names and `.sol` file extension for the solidity programming language. When writing the code, the first thing to do is to declare the solidity programming language version at the top of the file. For example, `pragma solidity ^0.8.15;`.

Solidity code is unique, and `pragma` make the smart contract's language easily identifiable. When writing code, we have to tell the IDE what version of the language we want to use so that the compiler gets to understand the smart contract.

Solidity code example:
```Solidity
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.15;

contract Calculator{
//code goes here
uint count;

constructor() public{
count = 0;
}

function getCount() public view return(uint){
return count

}
function incrementCount() public{
count = count + 1;

}
}
```

### Daml overview
Digital Asset Modelling Language (Daml) is a smart contract language from [Digital Asset (DA)](https://www.digitalasset.com/developers). It is a programming language for building and deploying distributed applications in the field of blockchain.

Daml was recently released and it's among the latest developments in the fast-changing blockchain technology. Daml is a lightweight, efficient, and safe platform for rapid application development.

The open source smart contract language enables developers to create [multi-party applications](https://www.digitalasset.com/products) for blockchain technology. Daml gets its inspiration from [Haskell](https://www.haskell.org/https://www.haskell.org/), which facilitates the creation of smart contracts for business workflow.

Building with Daml allows users to focus on creating value for their businesses while utilizing a variety of deployment options, enabling quick innovation across enterprises. Daml helps developers focus on developing programming solutions for business workflows.

Deploying Daml applications can run on both centralized databases and enterprise blockchain networks. The apps integrate seamlessly with any system.

#### Working with Daml
Daml works on two levels, the programming language, and the runtime environment. Language is the primary part of technology. It enables developers to do the work in terms of writing the project. The runtime, on the other hand, executes the work and transactions.

You can install the Daml software development kit (SDK) on Windows, macOS, and Linux. To get the installation details, go through [this guide](https://docs.daml.com/getting-started/installation.html).

To create a Daml project, you must have a VS code editor and Java Development Kit (JDK).

### Why would businesses use Daml instead of Ethereum
Daml and Ethereum are digital ledger technologies that benefit businesses in different ways. Daml automates the development functions allowing developers to focus on the app and business logic rather than the blockchain technology complexity. That's why businesses prefer Daml most to Ethereum.

Ethereum, on the other hand, primarily focuses on executing code for decentralized applications. Ethereum is more of a cryptocurrency. Thus developers focus on the blockchain network to make payments, transaction services security, and more. Below are reasons why businesses prefer to use Daml over Ethereum:
- **Application flexibility** - You can deploy Daml applications to a central database or blockchain technology. Also, Daml operates on blockchains (VMware, Hyperledger Fabric, and Daml Hub). While optimizing the business workflows and processes, your application easily fits with the infrastructure of choice.
- **Maintains privacy** - Daml privacy is a built-in concept. Applications developed using Daml decide automatically which steps of processes should be shared with other parties. Privacy maintains the confidentiality of data transactions, business processes, and people.
- **Interoperability** - Daml implements multi-party applications, unlike Ethereum, which displays a single unified view of the network. Daml smart contracts can be composed across various networks. Therefore other smart contracts can work with Daml smart contracts on other networks to increase data coordination across ledgers.

### Daml vs Solidity: similarities and differences
Daml and Solidity are functional programming languages in blockchain technology that develop smart contracts. Some differences between Daml and Solidity include performance, smart contract concepts, and flexibility and implementation.

Daml is more user-friendly and with better performance. It is easy to use, making it perfect for those coding using it.

The contract concepts while working with Daml and Solidity are different. Daml operates with an [unspent transaction output (UTXO)](https://blog.digitalasset.com/developers/the-world-of-smart-contracts-using-daml-solidity) model. In a Daml workflow, when a contract is archived, a new one is created to replace it with new properties and holdings.

In contrast, Solidity uses an account-based mechanism. This means in a Solidity workflow on a contract. The operations on a contract are the properties and holdings of underlying accounts being changed while the contract remains alive.

Finally, Daml is flexible and can be implemented on various blockchain platforms, including Hyperledger Fabric, Daml hub, VMware, and others.

### Comparing Daml and Solidity
There are a variety of aspects to consider when comparing Daml with Solidity. Understanding these aspects will help you select the best option for your project. Take a look at some of these components.

#### Popularity
Solidity is more popular than Daml as it has been around for longer and is used by IT companies such as Microsoft and IBM. Since Solidity is built on top of EVM, it has gained more popularity because of Ethereum. The support for Solidity is higher than that of Daml. This is because Solidity has more resources, and there are existing solutions to problems.

#### Performance
Daml and Solidity perform differently. Deciding to use one over the other is due to the project you're building.

Daml allows you to focus on the project or application while it works on the logic. Daml has built-in functions. Therefore, you don't have to hardcode everything like you would have to do with Solidity. That is an advantage as Daml becomes easy to use.

Solidity, on the other hand, is made up of libraries that make a developer's work easy. The libraries help the developers implement the functionality they want. These libraries contain secure, ready-to-use contracts and reusable code that is approved by the community.

#### Flexibility
Daml code is considered to run seamlessly on different blockchains like Daml Hub and VMware. Solidity works well on the Ethereum network.

#### Ease of Use and Understanding
Daml is easy to learn and understand, even for beginners. Solidity, however, is a little bit more difficult to learn, and one may require assistance from someone with experience.

### Daml Business use case examples
Businesses mainly prefer Daml. In this section, you will understand how Daml is used in blockchain for business. Below are business use cases for Daml.

#### Capital markets using Daml
Financial institutions are troubled with inefficient processes which hinder innovation, raise capital requirements, and inhibit cash flow. Daml provides a platform for digital transformation where complex multi-party systems are simplified. Daml was developed to cover a range of capital markets use cases and provides a thorough Daml Finance Library to speed up application development.

#### Insurance using Daml
Daml supports a range of insurance workflows, from health to life insurance. Daml uses strict data rules outlined in the code to speed up data processing, cash flows, and identity validation while guaranteeing compliance with regulatory standards. Daml makes it simple for businesses to create new insurance and reinsure products. Additionally, it allows businesses to launch new solutions on old infrastructure while transitioning to new technologies later on.

#### Banks using Daml
Through its privacy framework for multi-party workflows. DAML speeds transaction processing and securely distributes data between banks for increased risk assessment accuracy and fraud prevention.

#### Supply chains Using
Supply chains are incredibly complicated because they involve multiple untrusted parties, complicated paperwork, and lengthy execution times. Daml standardizes and streamlines these operations while incorporating rights, responsibilities, and security to guarantee data integrity and transparency during every transaction.

### Conclusion
Daml and Solidity are smart contract languages. The technologies offer different advantages and disadvantages. They are both great choices with features and functions suitable for particular purposes. Although neither one is a replacement for the other, they are both potential alternatives.

To further understand Daml and Solidity, I urge you to do more research to help you compare both and get to know what you prefer.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.