An introduction to decentralized applications and smart contracts

An introduction to decentralized applications

(Written by @ElliotHill of the Cardano Foundation)


As we discovered in our previous article, distributed ledgers have evolved far beyond simple value layers, and they can now be used to build and deploy decentralized applications, or DApps, on the blockchain.

These applications are making blockchain technology exponentially more useful for enterprise and business users, who can leverage the blockchain-based nature of DApps to make transactions more secure and easily transfer value.

Here, we will explore what DApps are, define their relationship with smart contracts, and discover why bringing reliability and functional programming to smart contracts could be the key to unlocking the mass adoption of DApps by enterprises worldwide.

What are decentralized applications?

To put it simply, DApps are computer applications or programs that run on top of a distributed computing system—like Cardano. DApps are powered by smart contracts, which are deterministic programs used for settlement between one or more parties.

Smart contracts enable DApps to interface with the blockchain and execute transactions without the need for third parties. As IOHK’s Education Director Lars Brünjes states in his book ‘Plutus: Writing reliable smart contracts’, the power of a smart contract lies in its ability to serve as a trusted entity. Parties transacting with the smart contract can transfer funds directly to the program, without the risk of a single party becoming a bad actor or misusing the funds.

Sometimes, the terms ‘DApp’ and ‘smart contract’ are used interchangeably, and this is technically correct. However, it is normally implied that DApps have some form of interactive user interface (UI), or web 3.0 interface, making it easier for the average user or non-technical user to interact with the application. On the other hand, a smart contract could be written and deployed by developers without a dedicated UI or front-end interface.

To better understand this distinction, let us explore a process flow for a simple hypothetical DApp, which we will call ‘Cardano Critters’. A blockchain-collectibles game, Cardano Critters uses non-fungible tokens, or NFTs, to create unique and rare assets that serve a function in a virtual game world—as well as having some intrinsic value as a collectible asset.

Minting (the creation of the asset), trading, and issuing of Cardano Critter NFTs would be handled through a smart contract, which in this case would interface with the underlying Cardano blockchain.

In turn, the Cardano blockchain serves as a distributed database for information such as when the NFT was minted, its unique characteristics, and its ownership history. The owners of these assets can be identified by their public keys.

While any user could see and verify the authenticity of the underlying smart contract for themselves by viewing it on-chain, they would most likely use a Cardano wallet to interact with the DApp through a web 3.0 interface—often visually similar to current web 2.0 sites.

As a result, most average users will not need to understand the technical principles of writing a smart contract to use a DApp—which is essential for mass adoption. Nevertheless, DApps cannot exist without smart contracts.

Functional programming for reliable smart contracts

Our example above of a blockchain NFT DApp is a fairly simple and relatively risk-free scenario—in other words, there is not much at stake financially or in terms of user data, should the smart contract be exploited.

But with the rise of decentralized finance, billions of dollars worth of assets are being deposited into smart contracts every day. Similarly, blockchain-based applications are also being explored for a myriad of institutional and enterprise use cases. These institutional and enterprise users demand a level of assurance which, to date, other smart contracts platforms have not been able to provide.

While smart contracts have proven themselves to be highly useful, offering functionality beyond traditional digital contracts, they have been subject to regular vulnerabilities—often resulting in the loss of hundreds or even millions of dollars’ worth of digital assets. If smart contracts and DApps are ever going to be useful for institutions and enterprises, they cannot be vulnerable to such attacks.

Instead, financial and enterprise-ready smart contracts and their associated DApps need to be able to be written quickly, reliably, and using high-assurance code. Haskell, the core programming language of the Cardano blockchain, happens to be perfectly suited for this very purpose.

This is why multiple financial institutions, from Barclays to the Bank of America, use Haskell and other functional programming languages to build out their critical infrastructure, from trading algorithms to cross-border settlement processes, underpinning the current financial system as we know it.

It makes sense that DApps and smart contracts should also be held to these same standards and written in reliable functional programming languages such as Haskell—or specifically Haskell-based languages such as Plutus and Marlowe on Cardano, as we will explore below.

At present, the lack of assurances available for smart contract reliability is a key bottleneck for the serious (and widespread) adoption of blockchain technology by institutions, and several researchers have identified the proliferation of formal verification as a key step for smart contract adoption.

As a result, it is highly likely that the first blockchain to offer financial institutions and enterprises assurances on the reliability of smart contracts will cause an exodus of institutional DApps away from other blockchains.

To learn more about the need for reliable and functional smart contracts, watch this presentation by Senior IOHK research fellows, Professor Phillip Wadler and Professor Simon Thompson, and IOHK technical architect, Manuel Chakravarty, at the Cardano Virtual Summit 2020: Shelley Edition.

The Plutus Platform and Marlowe DSL—get involved today

On Cardano, smart contracts and DApps will be enabled through the Plutus Platform, and for financial contracts, the Marlowe domain specific language (DSL).

The Plutus Platform will empower smart contract authors to easily write and deploy smart contracts and build DApps. The Plutus Platform includes the Plutus Haskell software development kit (SDK), which will include libraries and development tooling for writing smart contract applications in Haskell. Smart contracts written on the Plutus Platform will contain the logic, that will eventually allow them to run on Plutus Core, deployable on the Cardano blockchain.

If you have considered creating a financial smart contract or DApp on Cardano, you can already explore the Marlowe Playground. The Marlowe DSL is designed to be usable by financial professionals, in contrast to other smart contract platforms designed exclusively for experienced programmers. Therefore, a financial professional could use Marlowe to create expressive smart contracts with relative ease, made even simpler through visual programming editor Blockly.

No matter your interest area, we invite you to sign-up for our Developer Portal waiting list, where you will have access to tailored content and articles while you anticipate the launch of the Developer Portal. You can find out more about the Developer Portal here.