Skip to main content

Plutus application development

This section provides a high-level overview of what a decentralized application (DApp) is, how it works on Cardano, and a list of resources for building a DApp using Plutus.

What is a DApp?

A DApp is a decentralized application that interacts with the blockchain. The difference between a DApp and a common application is that a DApp’s backend code runs on a decentralized peer-to-peer network whereas the application’s backend code is commonly run on a centralized server.

DApp categories can include DeFi products (eg, lending protocols, exchanges, etc), NFT marketplaces, gaming applications, healthcare products, and wallets (often used to connect with all of these) among others.

Plutus DApp development

DApps are built on open-source tooling. For a DApp to function, it needs to have an underlying smart contract that automatically executes the deal for users. All the operational records are then tracked on the blockchain ledger. In general, a DApp usually consists of a user-friendly front end, a (commonly cloud-based) backend with an operating smart contract, and is also connected to a blockchain ledger to track records on-chain. DApp benefits include trustless communication, resistance to censorship, privacy, and minimal downtime.

A smart contract (which consists of different scripts) is the driving force behind a DApp's functionality. Plutus scripts are written in Haskell (using the Plutus library and tools) and are then compiled to Plutus Core to be executed on the Cardano blockchain. The diagram below outlines the process of DApp development from code to on-chain deployment:

plutus-architecture

You can also learn about Plutus contracts off-chain and on-chain components here.

  1. First, developers write the source code for the DApp.
  2. Written in Haskell, this code goes through the compiler pipeline process. The code is first turned into Plutus IR (intermediate representation) to make it more efficient and then optimized in terms of performance. Typed Plutus Core is the next stage in the compiler pipeline, which helps to make additional checks and code debugging. Finally, the code is turned into Untyped Plutus Core – a lambda calculus variable. Untyped Plutus Core, or the compiled application, is executed on-chain.
  3. After the optimization process is complete, scripts are placed onto the chain. Developers can use the Plutus tools library or other open-source tooling developed for these purposes. It is also essential to have the off-chain component (an application), which will correctly form transactions to interact with the on-chain code.
  4. Finally, on-chain scripts are processed by the Plutus ledger API and are then executed and run by the Plutus Core evaluator.

Developer resources

To build a DApp using Plutus, developers will need to use a set of tooling and libraries:

  • Plutus Core (the programming language used for scripts on Cardano)
  • Tooling and compilers for compiling various intermediate languages into Plutus Core
  • Plutus Tx, the compiler that compiles the Haskell source code into Plutus Core to form the on-chain part of a contract application.

Plutus Tools SDK

The Plutus Tools SDK repository is a collection of off-chain infrastructure resources built for developers interested in building on Cardano. The repository supports the underlying resources that developers need to build DApps using Plutus.

Different tools are essential for developers to deploy a DApp. The code can be written not only using the Plutus Core language but also other Plutus variations. For more details, see the Plutus tools overview and the open-source tooling:

You can find different Plutus application use cases here:

User documentation

The complete Plutus tools user guide provides a range of development guidelines. Here are some selected links to tutorials and how-to guides:

Tutorials

How-to guides

Formal specifications

Community-driven open-source tooling and tutorials

Are you a developer building on Cardano with Plutus? Have you produced tutorials, tips or guidelines on how to build a Plutus DApp? We welcome your contributions! Please don’t hesitate to open a pull request and add a link to your tooling or development tutorials.

Tutorials