Daml or Solidity: what should you choose for smart contracts?
Choose the right technology for your smart contract to develop an efficient and high quality product
Smart contracts are the basis of decentralized applications. They allow the creation of software algorithms that function inside the blockchain and turn on automatically after certain conditions occur.
The success of a blockchain project is largely determined by the development tech stack. For example, the programming language directly affects development speed and project flexibility in general.
If you are new to smart contract development, the choice of programming language may be a challenging task. This post will discuss different blockchain technologies and the differences between two of the most popular - Daml vs. Solidity.
What technologies are used for smart contract development?
If you google tech stack for smart contract development, you will get dozens of results with the top 5, 10, 20, or more technologies. Such variety may be confusing, and, naturally, you would wonder which is the best programming language.
To select an appropriate technology, it is necessary to understand that smart contract programming language is often paired with a specific blockchain platform. For example, Rholang is used to create smart contracts on Rchain, and Plutus is designed for Cardano.
Additionally, if you need to create fundamental software interpreted by a virtual machine, you should hire blockchain developers well-versed in low-level languages. For example, specific technologies like Yul and Yul+ can help create rollups - common smart contracts on the Ethereum mainnet acting as the relay between the mainchain and Layer 2, where computations occur.
Smart contracts on Solidity: pros and cons
Solidity was the first technology created especially for smart contracts. It has well-organized documentation and many successfully launched projects. If you want to make a smart contract on the blockchain, Solidity usage may be the first to come to your mind. Although this language is already considered a classic of the genre, it has its pros and cons, which we will consider below.
It's Turing complete. Unlike Daml, Solidity can be used to write any potential program and compute anything that needs to be computed without dependence on a specific set of algorithms. The above does not mean that Solidity is better than Daml; however it indicates its greater versatility and applicability in various development spheres.
It provides an Application Binary Interface (ABI). ABI enables interaction of two programs, one of which is often at the machine code level. Since smart contracts written in Solidity need to be compiled in EVM executable bytecode, ABI enables this by translating names and arguments of high-level language into byte terms.
It supports inheritance. With the help of inheritance, a Solidity development team reuses properties and functions of existing classes, thus minimizing the number of lines of code and speeding up development. Additionally, developers use inheritance to reduce the number of logical errors, build complex class hierarchies, and modify code as project demands change.
It has an extensive community. Solidity was created in 2014. Over eight years, it has been applied in various use cases, from financial and legal apps to gaming and tokenization. Today, Solidity developers are in-demand in Europe, USA, Canada, Australia, and other countries with high technological potential. Sharing their experience in various software projects led to the creation of a strong development community and in-depth knowledge base.
It depends on the transactional operation. The blockchain specifics allow you to import data into the system only through transactional operations. This becomes a problem when dealing with data that changes frequently and requires real-time tracking. Take, for example, stock market prices or demand fluctuations for seasoned products. Solidity programming won’t be able to catch them on the fly. It will only be able to update the data when the transaction occurs.
It requires checking the return value. To execute external calls, Solidity developers use the call() and send() functions. However, the problem is that these functions return false values rather than revert if unable to complete the task. This means that developers should check the return value of every failed operation.
It has security flaws. One of the examples is the default visibility of Solidity functions. While not being a security gap by its nature, it frequently leads to frequent misuse of the Solidity functions when developers incorrectly specify visibility for certain user groups (external/internal users, derived contracts, etc.) making their programs more susceptible to external attacks. Another problem is mainly caused by the Ethereum Virtual Machine, however, it has a direct impact on the Solidity programs. The thing is, the EVM only supports a fixed size for integer data types. Therefore, you run the risk of overflow or underflow when storing values. For example, storing 256 in a unit8 will give you 0 as it only stores values from [0,255].
Smart contracts on Daml: pros and cons
Daml or Digital Asset Modeling Language is a functional programming language designed for multi-purpose business processes. It automates many development functions allowing programmers to focus on the app logic rather than the complexity of blockchain technology.
Daml is open source, which means developers can easily modify the language, and SDK is available at no charge. Daml does not depend on specific blockchain systems. This makes it a universal solution available to work with various ledger protocols.
It provides strong privacy. Damlallows you to clearly differentiate the privacy rights of the parties to a smart contract. It tracks which participants are authorized to see contract details and passes this information to the distributed ledger system. In turn, the ledger system sends only the data that the party is allowed to see to their physical node in a network.
It enables easy development flow. Daml is a functional programming language which uses high-level abstractions to hide details of routine operations, such as iteration. Projects on Daml are written with shorter code and fewer errors. They have wider opportunities to solve complex business tasks in a shorter time.
It empowers coding creativity. Being an open source language, Daml provides more space for non-standard solutions when creating smart contract projects. Developers can modify the language to fit their needs without violating the copyrights of the developers of the original technology.
It is portable across blockchain platforms. Daml is not designed for a particular blockchain system. Instead, it runs on multiple platforms: HyperLedger Sawtooth, HyperLedger Fabric, VMWare's, Besu, Corda, Daml Hub, etc.
It simplifies implementation of complex apps. If you compare Solidity vs. Daml, the latter will give you more powerful tools to create complex apps. In Daml, you only need to declare the high-level logic. The compiler and runtime will implement low-level constructs. Thus, you can speed up development, minimize errors, and reduce time-to-market.
It provides limited decentralization. Because Daml is designed for a private distribution environment, it has fewer network participants. This increases the risk of corruption, collusion, and override since the owners and operators can control the rules of consensus, immutability, or mining.
It's young. Daml was released in 2019. Even though the language is developing rapidly, for now, it does not have a large community and an extensive knowledge base. Such Daml limitations may be crucial for novice developers who want to start smart contract projects but have little, or no, previous expertise.
It does not have a big pool of specialists. It is a challenge to find a true expert of general-purpose language. It is a bigger challenge to hire developers of purpose-based technologies, like Daml. Recruiting can take months, if not years. Therefore, it is crucial to be sure that the game is worth the candle.
Daml vs. Solidity: what to choose?
When it comes to developing smart contracts, there are several languages from which to choose. Daml and Solidity are some of the most in-demand technologies which are often compared.
Daml is more user-friendly and has a more intuitive syntax, making it perfect for those who are new to coding. It's also backed by Microsoft and has many blockchain platforms behind it.
Solidity, on the other hand, is more popular and well-known, but can be a little more difficult to learn. It's been around for longer than Daml and is used by a lot of major companies, such as IBM and Microsoft.
In the end, it really comes down to what your team is most comfortable with and what they feel will work best for your project.
What requirements should smart contract developers meet?
If you want to develop a smart contract, you should not ask what is better - Solidity vs. Daml - but investigate what technology would best suit your project needs. Currently, Solidity is the most popular language for dApps on permissionless networks. In turn, Daml is a narrow-focused language aimed at the corporate sector with a limited number of participants in a private network.
The above, however, should not be taken as an axiom as both Solidity and Daml are flexible technologies easily adaptable to different projects. Only experienced developers can tell which tech stack is better in a given case. That is why it is vital to choose a reliable technology partner with proven expertise in blockchain apps.
For those new to the blockchain industry, it can be difficult to evaluate the professional level of blockchain specialists. So, if you want to start a smart contract project, pay attention to the following criteria:
full-stack developer with 5+ years of experience
expertise in web3.js and ethers.js development
deep knowledge of smart contract standards
interest in studying the algorithms of blockchain ecosystems
experience in a blockchain technology of your choice (Solidity, Daml, Vyper, WASM, etc.)
At Erbis, we have a mature development team with strong expertise in blockchain projects. If you are looking for smart contract experts, get in touch. We will be happy to help.