Skip to content

Latest commit

 

History

History
127 lines (78 loc) · 4.05 KB

ARCHITECTURE.adoc

File metadata and controls

127 lines (78 loc) · 4.05 KB

Architecture of the Plutus project

This document is an overview of how the software in the Plutus project is structured. Most things are in direct subdirectories of the root, so we will work through those in conceptual order.

Plutus Core

Plutus Core is the language that actually goes on the blockchain. Consequently this is the absolute core of the codebase, and everything depends on it. It also includes the Plutus IR intermediary language.

Plutus Tx

Plutus Tx is how we refer to the subset of Haskell which we compile into Plutus Core. This is how users actually write Plutus contracts: they write Haskell programs, part of which is compiled into Plutus Core. The rest of the program can then use this compiled code when submitting transactions.

Ledger

To write actual Plutus contracts we need a model of the ledger that we’re running on. There are two reasons for this:

  • The on-chain code needs to work with the data: validators are given information about the current transaction being validated.

  • The off-chain code needs to produce transactions to submit.

  • We want to write tests that simulate the "full" behaviour of contracts, i.e. across time, in a multi-agent scenario.

Contract modelling

We want to help people write "contracts". When we say that, we mean both:

  1. A high-level application that exposes a limited API and is suitable for running inside something like a wallet smart contract backend.

  2. An implementation of a conceptual "contract" (e.g. a crowdfunding contract), including both the on-chain code and the eventual contract application.

These packages are geared towards providing the tools to do that, and building up examples to ensure that we have adequate functionality.

Marlowe

Although conceptually separate from Plutus, a fair amount of Marlowe-related code is in the Plutus repository. This is for two different reasons:

  1. We have an implementation of Marlowe on top of Plutus, which depends on the other code in the repository.

  2. The Marlowe Playground shares code and deployment infrastructure with the Plutus Playground.

Playgrounds

The Plutus/Marlowe Playgrounds are our web-based environment for developing and testing basic Plutus and Marlowe contracts. That means they’re the main way that anyone outside the team has interacted with out product!

Smart Contract Backend

The smart contract backend provides the runtime environment for compiled Plutus contracts. It manages the state of contract instances and brokers messages between them and the nodes, users, and wallets that they interact with.

Specification and design

We have done a fair amount of work in specifying and formalizing parts of our system. At the moment all of this work also lives in the Plutus repository, and we even have some basic testing of the Haskell implementation against the Agda formalization.

Build tooling