Bitcoin's UTXO Model
Table of Contents
- Bitcoin does not have accounts with balances. Instead, individual coins are owned by Bitcoin users.
- An Unspent Transaction Output (UTXO) is a discrete piece of bitcoin. UTXOs are used as the inputs of every Bitcoin transaction.
- The UTXO model makes Bitcoin more auditable, transparent, and efficient than traditional financial systems, which rely on accounts, balances, and third parties.
What Is a UTXO?
An unspent transaction output (UTXO) is a discrete piece of bitcoin. UTXOs can be combined and split up to make payments in any denomination.
UTXOs can be likened to physical coins, in that they must be spent discretely. If you want to spend 5 cents, you cannot spend half of a dime. Instead, you must spend the entire dime and receive a nickel as change. Unlike physical coins however, UTXOs do not come in standardized denominations. A UTXO can hold any amount of bitcoin.
As its name suggests, a UTXO is an output of a Bitcoin transaction. An output exists as a UTXO until it is used as an input in a subsequent transaction, at which point it is no longer unspent.
The set of all existing UTXOs at a given point in time is called the UTXO set. Bitcoin nodes keep track of the UTXO set in order to determine exactly which coins exist and who can spend them. This system enables Bitcoin to solve the Double Spend Problem, which had plagued previous attempts at a digital currency.
How Are UTXOs Created?
UTXOs are created through the consumption of existing UTXOs. Every Bitcoin transaction is composed of inputs and outputs. Inputs consume an existing UTXO, while outputs create a new UTXO. So, if old UTXOs are destroyed to create new UTXOs, how are UTXOs created in the first place?
A coinbase transaction is a special type of transaction which creates new bitcoin as a reward for the miner of a block. Since new bitcoin is being created, the coinbase transaction has no inputs and one or more outputs. Like all normal outputs, the output of a coinbase transaction is a new UTXO.
Understanding Bitcoin’s UTXO Model
Bitcoin’s UTXO model is unique from most other digital currency systems. This is because Bitcoin was designed with different goals than the traditional financial system. From the outset, Bitcoin was meant to be fully transparent, fair, and auditable. The UTXO helps Bitcoin achieve these goals. So how does the UTXO model work?
Addresses and UTXOs
In the traditional financial system, a transaction takes money from one account and moves it into another. Since Bitcoin’s UTXO model does not have accounts, there is no “from” account or address. While addresses are used to receive UTXOs, addresses are never directly inscribed on the blockchain. Rather, Bitcoin addresses are encodings of scriptPubKeys, which are included in each transaction output.
When bitcoin is spent, an input only includes the signatures and public keys required to satisfy the scriptPubKey. There is no mention of which address the bitcoin came from on the blockchain. However, the previous address of a UTXO can be easily calculated. Every transaction input references an existing UTXO by the previous txid and the index of the transaction output within that previous transaction. The scriptPubKey of the referenced transaction output can be translated into a Bitcoin address.
Bitcoin’s Monetary Policy
The UTXO model allows all Bitcoin nodes to agree on exactly which bitcoin exist at any point in time. This allows anyone to audit Bitcoin’s total supply, in order to ensure that Bitcoin’s monetary policy is being respected.
Combining and Splitting UTXOs
A Bitcoin transaction can contain any number of inputs and outputs. This allows UTXOs to be combined and split to make payments of any amount.
For example, if Alice wants to pay Bob 1 BTC and she has 2 UTXOs worth 0.5 BTC and 0.7 BTC, she can use both UTXOs as inputs and send an output worth 1 BTC to Bob.
In order to claim the leftover value as change, Alice creates another output worth 0.199 BTC, which she sends to herself. She is not able to send 0.2 BTC to herself because she must pay a transaction fee.
The UTXO model allows Bitcoin nodes to efficiently verify every transaction on the blockchain. When a node receives a transaction, either in the mempool or as part of a block, it can verify whether the UTXOs being spent are valid and unspent. It is this ability which enables Bitcoin to solve the Double Spend Problem without relying on trusted third parties.
The UTXO Model vs. the Accounts Model
Most financial systems, including banks and other cryptocurrencies, do not use the UTXO model. Instead of controlling several specific coins, individuals have one or a few accounts, and each account has a balance. The account model allows financial institutions and merchants to debit and credit individual accounts in precise amounts and avoid issues of change or coin selection.
Reliability Issues With the Accounts Model
The benefits of the account model come at the cost of transparency and auditability. Auditing the total supply of U.S. dollars in all bank accounts is impossible.
Additionally, most account models are plagued with issues such as chargebacks and overdrawn accounts. Since a Bitcoin transaction must reference the exact UTXOs being spent, there is zero possibility of an invalid transaction being added to the blockchain.
Privacy Benefits of the UTXO Model
The UTXO model offers privacy benefits to users. Bitcoin users can handle each UTXO separately by storing each UTXO in a unique address. By using a unique address to receive each UTXO, users can hide the connection between their UTXOs from public knowledge. To an observer of the blockchain, it is difficult to ascertain which UTXOs belong to which users.
Bitcoin’s design makes it trivially easy to generate new addresses. Account model systems, especially within the traditional financial system, make new account generation cumbersome or even prohibited, forcing users to hold all or most of their funds in a single account.
Chain analysis companies attempt to undermine Bitcoin’s privacy and ascertain the ownership of UTXOs based on a variety of methods. However these methods rely on assumptions and circumstantial evidence rather than rigorous logic.