The UTxO (Unspent Transaction Output) model

To get started with Plutus and smart contracts on Cardano, it is important to understand the underlying accounting (ledger) model it uses. Before the Mary era, Cardano used Bitcoins' UTxO (Unspent Transaction Output) model.

In the UTxO model, transactions consist of a list of inputs and a list of outputs. Transaction inputs are existing and unspent transaction outputs that are being spent by the transaction. Each output is connected to an address and can only be spent once, i.e. it can only be an input to a transaction once. Every input in a spending transaction is spent in its entirety and following that, it is no longer an unspent transaction output and cannot be used as an input anymore. Transactions can have a different number of inputs (n) and outputs (m). For example, a transaction with one input (n = 1) could create one hundred outputs (m = 100).

Every UTxO has a value (value), which represents a cryptocurrency value, and a validating function attached to it. This function serves as its validator (ν), which enforces rules to decide whether a transaction that attempts to spend it has the right to do so. The transaction provides redeemers (ρ) that are passed to the validator functions of outputs. As each UTxO is connected to an address with a corresponding private and public key pair, the redeemers are signatures by which the transaction is signed using the private keys. If a transaction that attempts to spend an output is signed by that output's address private key, the validation will be successful. In other words, the validation function will evaluate to true: ν(value, ρ) = true. A transaction with multiple inputs from different addresses needs to be signed by each of the private keys of the addresses. If the transaction is not signed by the required signature(s), it will not pass validation and will fail.

The UTxO model is a great fit for a distributed ledger as it does not require any shared global state for its transactions. Transactions only need to know about their inputs, and multiple transactions dealing with separate inputs are independent and can be executed concurrently. However, the transaction functionalities of these simple validators are limited, hence Cardano has implemented an extension to the UTxO model that allows more expressive validators while preserving the core properties of the UTxO model, called the EUTxO (Extended UTxO) model.

Last updated