Distributed Ledger Technology (DLT) in the enterprise space has seen a number of new players in recent years, providing greater variety for businesses to select an appropriate technology for their needs. Often, these choices are not made on the basis of the merits of the technology alone, but rather on existing business relationships and, sometimes, hype.
The most well-known DLT technologies available for enterprise solutions today include Hyperledger Besu (an Ethereum client, previously Pantheon), R3’s Corda, and Hyperledger Fabric. More recently, Digital Asset has released DAML which is not a distributed ledger, but rather a language which can be used on multiple ledgers. In each part of the Block8 Rates series, we will attempt to provide a direct comparison between two approaches to writing distributed applications.
In particular, we’ll be taking a look at writing smart contracts in R3’s Corda compared to Digital Asset’s DAML.
Other parts in this series:
With the evolving software technology landscape, a developer’s time is becoming ever more valuable, especially when it comes to investing in learning new skills. This part of our series looks at how easy DAML and Corda are to pick up and the quality of the available materials and documentation.
Corda has several structures which new users are introduced to - States, Contracts and Flows. Note that in the Corda documentation, there is a lack of complex workflow examples provided in Java. If you are familiar with Kotlin syntax, you may find it slightly easier to pick up as Corda itself has actually been completely developed in Kotlin.
We found that to model a moderately complex business workflow from zero knowledge of Corda to complete with exposed API endpoints, it took around two weeks.
DAML has only one key structure, “templates”, where each template has methods, which are called choices, and these choices define the allowable mutation code. Instances of templates are contracts, and methods can be executed on these contracts as defined in the template. Signatories and observers of a contract are also as defined in the template of the contract. The succinct nature of the language along with documentation in one specified language (as opposed to documentation split into Java/Kotlin) does indeed make it easier for developers to focus on modelling the business workflows.
To model the same moderately complex business workflow from zero knowledge of DAML to complete with API endpoints, it took around one week. It is worth noting that previous experience with functional programming languages such as Haskell is beneficial when writing more complex DAML contracts.
For the newer player in smart contract tech, DAML takes this one as the domain specific language design integrates all of the necessary features into one simple structure.
Corda has extensive documentation along with several YouTube tutorials. Some of the Youtube videos are outdated due to Corda updates and several of the documentation examples are only in Kotlin. If you plan to develop in Kotlin, documentation should be no problem, however, if you plan to use Java, you may have to do some extra digging with trial and error. The Slack channel is fairly active and you can generally get a response for your queries.
Corda allows for testing by setting up mock networks and executing flows within your IDE, then using asserts to ensure the transaction resulted in the output we expected. We can also spin up some nodes in separate terminals and emulate different users.
Once you have a conceptual model of a business workflow, you must then write the State, Contract and Flows to execute the workflow. It was fairly monotonous writing so many files compared to DAML.
There was also the issue of serialisation. One of our structures had a composition relationship, where we stored an ArrayList of an object in a larger structure. For example storing Brick objects as an ArrayList in a larger House object, where we can add and remove Bricks (note: this was not our actual implementation). This was not possible as it required us to write a custom serializer. Corda pervasively uses a custom form of type safe binary serialisation, which prevents us from modelling complex states. This can be bypassed by writing custom serializers which would require further learning, however, there was only one trivial example of custom serializers in the official Corda docs. To complete the analogy, we opted to disassociate the Bricks from the House and just store a reference to the House in the Brick objects.
The documentation for DAML was fairly succinct with regards to the actual writing of smart contracts and the DAML language. It became less so when trying to understand details about the DAML ledger. This is largely because there is no one Digital Asset Ledger. The DAML language is ledger-agnostic and runs on a wide range of infrastructures, from fully centralized to fully distributed, including the Corda ledger. That is why the key focus of our comparison is on the smart contracts rather than the ledger.
More recently, DAML has introduced an in-browser interactive learning environment to guide new users through several key concepts. This is a much more enjoyable experience than trawling through pages of documentation. Corda has also recently released a new training site, however, the user experience of the DAML learning environment is far superior.
In regards to modelling the same house and bricks representation, although we opted to store a simple reference in the bricks object, it is possible to model composition and more complex structures fairly easily. It is also worth noting that more complex DAML smart contracts, which are beyond just simple state changes, will require an understanding of Functional Programming concepts.
DAML’s better IDE integration and modelling simplicity proves it to be a winner in terms of ease of development and testing. Initially, our view was that Corda’s maturity and native JVM environment proved it to be stronger with documentation and resources. However, with DAML’s addition of the interactive learning environment, and their heavy focus on creating new developer resources, DAML takes the lead.
Block8 would be happy to further discuss our thinking on any of the topics covered above, including specific detail on solution architectures and demonstrations of currently working distributed ledger systems developed to address the challenges and opportunities outlined in the Issues Paper and our Response.
Our experts are also available to assist with research mapping the value chains for centralised and decentralised approaches, the identification of the highest-value areas for a consumer-centric data infrastructure, or working with the Government and other members of industry in the development of pilot programs.