5 min read

How Bitcoin UTXO model works?

In 2008, a mysterious figure under the pseudonym Satoshi Nakamoto published a manifesto Bitcoin: A Peer-to-Peer Electronic Cash System - now the most frequently cited paper on cryptocurrencies. The idea of electronic money had existed for a long time, but the challenge of double spending, where someone could use the same digital currency more than once, remained unsolved. Satoshi Nakamoto solved this problem with a combination of Proof of Work (PoW) and the UTXO model.

But how does Bitcoin's UTXO actually work under the hood? That’s exactly what we’ll explore in today’s article.

Back to basics - Where do bitcoins in circulation come from?

Bitcoins are generated through a so-called "coinbase" transaction. The miner includes this as the first transaction in a given block. The coinbase transaction includes both the miner reward and the transaction fees collected from all transactions in the given block. This transaction has no inputs, only outputs. Let's take a look at an example transaction:

source: blockchair.com

If we examine the block containing this coinbase transaction, it included a total of 0.0743807₿ in fees and a miner reward of 6.25₿, adding up to 6.3243807₿. This amount was sent to the output address 18cBEMRxXHqzWWCxZNtU91F5sbUNKhL5PX in this coinbase transaction. This is how Bitcoins enter circulation as each coinbase transaction contains newly minted bitcoins along with fees from other transactions.

Now we got out first Unspent transaction output (UTXO) 18cBEMRxXHqzWWCxZNtU91F5sbUNKhL5PX with balance of 6.3243807₿ generated through mining. This means that the person who holds the private key for this address has full control over the Bitcoin, allowing them to spend it.

If we want to spend it, we have to use the entire UTXO as input for the transaction. We cannot send only a portion of it because the full value must be used as input. This process creates new outputs, which become new UTXOs, while the previous UTXO used as input is considered spent. Let's see example how 18cBEMRxXHqzWWCxZNtU91F5sbUNKhL5PX address was used in a transaction:

source: blockchair.com

This value was used as an input for another transaction along with a different address. The transaction created four outputs with different Bitcoin addresses. These outputs are new UTXOs. UTXOs that are used as inputs are considered spent and can no longer be used. There can be various combinations. A transaction might have one input and three outputs, or the other way around. The only limitation is the transaction size. The more inputs and outputs a transaction has, the larger its size will be, resulting in higher fees that need to be paid.

Vins, Vouts and UTXOs

To be precise inputs in our transaction are called VINs (Value Inputs) as they represent the sources of funds being spent in the transaction.

Each output is called VOUT (Value Output) as they define where the funds are going. Unspend VOUT is an UTXO, which can be used as an input (VIN) in a future transaction.

Every Bitcoin transaction follows this structure. Each value input (VIN) comes from a value output (VOUT) of a previous transaction, ensuring a continuous and verifiable chain of ownership linking in the end to the coinbase transactions. Simply put, Vins are the inputs of a transaction, and Vouts are the outputs. A UTXO is a Vout that has not yet been spent. So each UTXO has corresponding VOUT, but not always the other way round.

But what if I don't want to spent whole UTXO?

Imagine you already have some Bitcoin in your address. Since you must spend the entire UTXO at once, how can you transfer only a portion of your funds? This is where a change address becomes useful. Instead of spending only part of the UTXO (which is impossible), you use the entire amount. You send the required portion to the recipient and the remaining balance to an address that belongs to you, known as the change address. Take this transaction as an example:

source: blockchair.com

The address bc1p....ve44 was used as an input. A total of 0.0000033₿ was sent to bc1p....520a, while the remaining change was sent back to an address owned by the sender, bc1p....m8h6. You might wonder why the change was not sent back to the same address, bc1p....ve44, instead of a separate change address. The reason is privacy. Sending funds to a different address makes it more difficult to track transactions, improving anonymity.

If we compare the values of Vins and Vouts in this transaction, we notice a slight difference. The total Vins amount to 0.00190594₿, while the Vouts sum up to 0.00190388₿. This results in a difference of 0.00000206₿, meaning the Vins are greater than the Vouts. Why does this happen? The difference represents the transaction fee, which is collected by miners. This 0.00000206₿ will be included in the coinbase transaction as part of the miner's reward.

Dust, safety and UTXO management

A single user can hold multiple UTXOs. If they send several transactions with change addresses, they may end up accumulating dozens of UTXOs within their wallet. UTXOs that are too small to cover the transaction fee are referred to as "dust". Some Bitcoin wallets include a feature called UTXO management, which helps optimize how inputs are used in transactions. This feature allows users to consolidate small UTXOs into larger ones when network fees are low, reducing future transaction costs.

Another concept related to dust is a dusting attack, where attackers or analysts send tiny amounts of Bitcoin to multiple addresses to track transactions and link addresses to a single user. If the recipient unknowingly spends the dust by consolidating it with other UTXOs, the attacker can analyze the blockchain to identify wallet ownership, compromising privacy. These attacks are often used for deanonymization, phishing, or surveillance.

It is important to use trusted Bitcoin wallets and be cautious when manually constructing transactions. Mistakes in fees, addresses, or structure can lead to costly errors. Reliable wallets with security features help prevent these risks. One of the most well-known cases of a transaction mistake occurred when a user accidentally set $3 million worth of BTC as the transaction fee instead of sending it as the intended transfer. In the end mining pool refunded this fee.

UTXO vs. Account Model

Another important aspect to consider is adoption. The UTXO model is primarily used in Bitcoin and Bitcoin-based cryptocurrencies, meaning those that have been built on or inspired by Bitcoin’s transaction structure. These include Litecoin, Bitcoin Cash, Dogecoin, and Zcash. In contrast, many newer blockchains, such as Ethereum and Solana, use an account-based model instead of UTXOs. This model keeps track of user balances like a traditional bank ledger, making it more convenient for smart contracts and decentralized applications (dApps).

In traditional account-based models, transferring funds or a portion of them is straightforward since balances are updated directly without the need to track inputs and outputs. The bank account analogy is accurate, as funds are simply deducted from one account and credited to another. Account-based systems are easier for users to understand because they work similarly to how people manage money in everyday life.

TLDR;

  • Bitcoin transactions are based on the UTXO model, where unspent transaction outputs (UTXOs) serve as inputs for new transactions.
  • Vins (Value Inputs) represent the sources of funds being spent, while Vouts (Value Outputs) define the recipients.
  • Every Bitcoin transaction takes UTXOs as inputs, spends them, and creates new UTXOs as outputs.
  • A UTXO is an unspent Vout, meaning it can be used as an input in a future transaction.
  • Once a UTXO is used as a Vin, it becomes spent and cannot be reused.