Skip to content
Home » A quick intro to the Unspent Transaction Output (UTXO)

A quick intro to the Unspent Transaction Output (UTXO)

Traditional accounting documents funds flow between accounts. UTXO focuses on the flow of funds from transaction to transaction.

Every transaction has inputs (the amount from where other people spend the money) and outputs (where this money goes in a new transaction). The body of a transaction can contain other data as well. The Unspent Transaction Output (UTXO) paradigm is essential to Cryptocurrency and many others. This post tries to serve as a quick intro to UTXO.

The consumer uses a digital signature to validate the inputs’ possession, which must correspond to the outputs. The consumed UTXOs are now called “spent.”

UTXO accounting style is a convenient mechanism for redistributing the cash flow from several contributors to the desired payees. A Transaction is the “bucket” where all this cash is temporarily stored/bundled. In the interim, the transaction results become new UTXOs – to be included later in a new transaction. When anyone sends some amount of a coin (bitcoin, Cardano ADA), one or more locked unspent (UTXO) outputs are activated to function as the same coin input.

If you have read the previous post in this blog, you’ll see that this mechanism shares many Smart Contracts characteristics. However, as we’re used to traditional accounting, UTXO is not an intuitive way of moving funds.

 

UTXO Structure

Underneath every transaction is a ledger to record them and their internal details. The Ledger record that contains the transaction information is called a UTXO: Unspent Transaction Outputs. This record is a map with keys and values. The Keys are the transaction IDs and one or more output indexes (a transaction can have many outputs), while the values are pairs of ADA amounts and wallet addresses.

Processing a transaction involves updating the UTXO on the ledger that makes the funds spent (recorded inside the transaction) available to be consumed by the owners of the addresses listed in the outputs.

 

 

 

Transaction validation

The validation of a transaction is not an easy task. The validation implies calculating the total amount of ADA in the outputs and inputs of the transaction. The treasury is the destination for the ADA spent besides adding them as UTXO entries. All the deposits and fees are paid inside the treasury. There are output entries with no matching inputs: These are the rewards the network pays to delegators, collected from rewards addresses. Every transaction also includes much more info: hashes, scripts, witnesses, and certificates.

Validation also implies more calculations to ensure no ADA is created from thin air. These calculations consider the ADA in the transaction and the other accounts in the ledger. This process is called Generalized Accounting Property (GAP).

UTXO also implements protection against double-spending: Network users can’t spend outputs more than once. This protection and the GAP disables bad or dishonest behavior among the network participants. It also ensures that the total amount of ADA does not change.

 

The UTXO Set

A global network database keeps track of all the spendable outputs. When a new transaction is being constructed, it uses the spendable Outputs exposed by the UTXO Set. The Outputs selected are removed from the UTXO set, resulting in its shrinkage. Conversely, when new unspent output is created, the UTXO Set grows accordingly.

 

 

 

Advantages

  1. Security and simplicity. A UTXO is “consumed” thoroughly after spending, so the system avoids double-spending.
  2. Every user can use a new address for every transaction that she makes. This characteristic provides users privacy, making it very difficult to associate a set of coins with a specific user.
  3. When a new transaction is committed, and the UTXO is spent inside it, the UTXO is destroyed, creating more UTXOs. The UTXO is updated accordingly. Nodes can verify transactions in parallel independently.

 

 

Disadvantages

  1. UTXO is not an intuitive model. We’re used to thinking about accounts when we’re dealing with money.
  2. Traditional mechanisms are easier to manage: Multiple account numbers make UI/UX difficult for wallet designers.
  3. When dealing with Smart Contracts, the UTXO model requires multiple signatures from multiple parties and simultaneously access outside blockchain data with Oracles. Some Smart Contract platforms use a hybrid model: UTXO keeps track of balances and Accounts for Smart Contracts.

 

 

Conclusion

Most working blockchains use the UTXO model (except Ethereum, which uses the traditional Account Model). The UTXO is not an easy concept, at least the first time you are confronted with it. But once you’re accustomed, it is a logical and handy choice for developing blockchains. In the UTXO way of thinking, your money (coins) is precisely the UTXO that can be unlocked with your private keys. Verification is the main objective behind the UTXO model, but this comes at a cost: It is computationally more complex, introduces usability challenges, and puts some difficulty to Smart Contracts.

Leave a Reply