What is EUTXO model?

UTXO ---           ---> UTXO
        \         /
        ↓       | 
        Transaction ---> UTXO
        ↑       | 
        /         \
UTXO ---           ---> UTXO

Prerequsites

Unspent Transaction outputs (UTXO) Account model

Transaction Outputs

Includes an address (a lock) and a value.

The address owner has signature. signature used to unlock output. Can then be used as input.

Transactions spent outputs of previous transactions, producing new outputs.

UTXO can only be consumed once, and completely. Hence each output can be spent by exactly one input.

Transaction inputs

Includes pointer, cryptographic signature that unlock the output. Pointer points back to previous transaction output, key unlocks this previous output.

When output is unlocked by input, blockchain marks unlocked output as spent.

New outputs created can then be pointed to by new inputs, and the chain continues.

These new outputs are UTXOs.

Why we need to extend

Smart contracts require programmability.

Ethereum’s Account/Balance accounting model solves this with account-based ledger + contract accounts. Contract code more complex, contract authors need to understand nuances of semantics to avoid costly vulnerabilities.

What we need to extend

  1. Maintain contract state

  2. Enforce same contract code used throughout transaction sequence

How to extend

Add custom data (in addition to value). Instead of just public key hash as lock, we have script hash as lock. This is also known as “pay-to-script” output. A script is a program that decides whether a transaction which spends the output is authorized to do so. It is known as a validator script, because it validates whether spending is allowed.

Validator Scripts

Datum - Piece of data carrying state Redeemer - Attached to input that is spending. Provides input to script from the spender. Context - Transaction info. Assertions such as “Bob signed it”.

Example - Atomic Swap

Datum contains the keys of 2 parties in the swap, description of what they are swapping. Redeemer is unused. Context contains representation of the transaction.

The validator script:

  1. Checks if transaction makes payment with expected amount from second party to first party.
  2. If yes, spend this output, send it where they want / to their address.

Exclusive features

  • Fees required can be predicted precisely