UTXO

What is UTXO?

As one of the earliest cryptocurrencies to emerge, Bitcoin adopted the UTXO model as its underlying storage data structure. Unspent Transaction Outputs (UTXOs) represent specific amounts of Bitcoin that you have received but have not yet spent. Think of each UTXO as a distinct bill in your wallet, each with its own unique value.

As implied by its name, a UTXO is an output from a Bitcoin transaction. It remains a UTXO until it is used as an input for a subsequent transaction. When you receive Bitcoin, what you are actually receiving is a UTXO. The balance displayed in your wallet is the sum of all UTXOs you have received.

The UTXO set encompasses all UTXOs present on the Bitcoin blockchain at any given time. Bitcoin nodes maintain this set to verify the existence and ownership of coins, thus helping to prevent double-spending, an issue that had undermined earlier efforts to create a decentralized digital currency.

How does UTXO work between transactions?

Transactions based on the UTXO model consist of two parts: inputs and outputs. When a user initiates a new transaction, their wallet selects sufficient UTXOs to cover the required amount. In every valid transaction, the sum of all input values must be greater than the sum of all output values. The difference between these sums represents the transaction fee:

inputsvalue=outputsvalue+fee\sum_{\text{inputs}} \text{value} = \sum_{\text{outputs}} \text{value} + \text{fee}

Similar to cash payments, a person can't pay someone $5 by tearing a $10 bill in half. Instead, they must use the $10 bill and receive the change. UTXOs function similarly; they must be spent in their entirety, and any Change is given back as a new UTXO.

Change=inputsvaluePricefee\text{Change} = \sum_{\text{inputs}}\text{value} -\text{Price} - \text{fee}

User Concerns: Transaction Fees

Transaction fees are a significant concern for BTC users during transactions. It's common to hear complaints within the community about small transactions necessitating additional fees, sometimes consuming up to 80% of the transaction amount. As mentioned earlier, the number of UTXOs involved in a transaction determines the transaction cost for the user.

Transaction size=input count×input size+output count×output size+10\text{Transaction size} = \text{input count} \times \text{input size} + \\ \text{output count} \times \text{output size} + 10

Where:

  • Transaction size: influenced by the number of input UTXOs being spent and the number of output UTXOs being created in that transaction.

  • Input & Output size: varies depending on the type of Bitcoin address used.

The total fee for a transaction is determined by multiplying the transaction size by the selected fee rate.

Total fee=Transaction size×Fee rate\text{Total fee} = \text{Transaction size} \times \text{Fee rate}

Where:

  • Fee rate: measured in Satoshis per virtual byte (Sat/vByte), which depends on the current fee market.

In a UTXO-based blockchain network, consolidating multiple UTXOs into a single UTXO is a common practice, in addition to making change. In the Bitcoin network, each UTXO is roughly the same size regardless of the amount of money it holds. Therefore, large transactions often require multiple UTXOs as inputs, which significantly increases the transaction's miner fees.

Last updated