Fundamentally, a blockchain is a shared ledger whose content everyone sees and agrees on, and transactions alter this ledger. This is a state machine: the current global ledger is the world state, and transactions transition one state to another.
One popular representation of the blockchain state machine is the account-based model. In an account-based blockchain (e.g., Ethereum), the world state consists of accounts with balances, and transactions alter features of accounts, such as their balance or state. For instance, a transaction that moves 1 ETH from Alice’s to Bob’s account transitions the state by reducing Alice’s balance and increasing Bob’s balance by 1 ETH.
Unlike Ethereum, Themelio’s state model belongs to the other major representation family: UTXO-, or coin-based, models. This is the oldest family of blockchain models, including first-generation blockchains like Bitcoin and Litecoin. In the coin-based model, the world state is a pool of “coins”. Each coin represents a given amount of cryptocurrency and includes constraints on what sort of transactions can spend the coin. These constraints are called covenants. They commonly encode ownership of coins: a covenant saying “this coin is owned by Alice” simply checks that any transaction spending it is cryptographically signed by Alice. “All the coins Alice owns” is another way of saying “all the coins Alice knows how to spend”.
Transactions in the coin-based model are slightly counter-intuitive: they consists of spending coins by deleting them from the world state and creating new coins in the state. Because spending a coin deletes it from the state, each coin can only be spent once. The sum of the amount spent by a transaction also must equal the sum of the amount it creates. As we will see below, coins are an elegant and highly performant abstraction. However, there’s no highly precise analogy to these coins in the physical world, so let’s illustrate how coin-based transactions work with a simple example.
Say Alice only owns (i.e., knows how to spend) a coin with 10 MEL in it, and she wants to send 1 MEL to Bob. She will create a transaction that
- Spends the 10 MEL coin, supplying whatever signatures etc. needed to satisfy its covenant
- Creates a coin worth 1 MEL, attaching a covenant that only Bob can satisfy
- Creates a coin worth 9 MEL, attaching a covenant that only Alice can satisfy
By doing so, Alice deletes a 10-MEL coins from the state, splitting it into a 1-MEL coin in Bob’s ownership and a 9-MEL coin in her own ownership. The latter change coin is required because coins can only be spent in their entirety.
The following table sums up the contrast between Themelio’s coin-based model and Ethereum’s (and many other blockchains’s) account-based model: