The UTXO Model Explained In Cryptoeconomic Terms

Bitcoin uses the UTXO (Unspent Transaction Output) accounting model for processing transactions. In Bitcoin, a user’s balance is indicated by the unspent amount of BTC that is recorded on the blockchain. A user’s input to a transaction is the output from the last transaction. If the user has no previous transaction, then the input is the output from another user’s transaction. These are processed continuously and written to the blocks which are added to the main chain for immutability. Every transaction on the Bitcoin blockchain has an input and output to prove the transfer and ownership of a digital asset.

There is a misconception that digital wallets store the digital assets. That is actually not the case since the digital assets are always stored on the blockchain. They are just values that indicate the balance or quantity and the ownership by a private key. The digital wallet is really an application that provides users access to their digital assets on the blockchain via a private key. The wallet also contains the public address, which is used to identify the user to the blockchain. Once the wallet is opened, the users can see their digital assets from the blockchain. In Bitcoin, the BTC is always stored on the blockchain. The information is accessed by the user from their wallet with authorization from their private key. Without the private key, a user will not be able to access the information. The private key also creates a digital signature which authorizes a user to send their BTC to another user as a way to transfer the ownership of the digital asset.

When the digital asset is transferred, it is recorded as an output O from the sender. It is then the new input I to the user it was transferred to. It has to always be an input/output relationship for provability. The transactions can be referenced by cryptographic hashes that is called the TxHash (Transaction Hash). Users can view this information on a blockchain explorer like The best way to understand this is that inputs reference outputs when making transactions on the Bitcoin blockchain.

Key concepts to understand:

  • Each input to a new transaction was the output from a previous transaction, which can be referenced by a TxHash.
  • Each output was the result of a transaction from a spent amount.
  • The input from an output is considered an unspent amount.
  • All unspent amounts are considered the balance of the digital asset the user owns.
  • The spent amounts become the unspent amounts of other users who received the digital asset.
  • Only unspent outputs can be used as inputs to a transaction in a Bitcoin network.
  • The sum of all unspent outputs is the total balance available to the user.

Let’s take an example.

Bob wants to pay Alice 5 BTC. Bob has a balance of 100 BTC, while Alice has 30 BTC. According to the protocol, the sender is Bob and the recipient is Alice. Both users have a Bitcoin public address, which is a hexadecimal string. The public address is like the e-mail address, it allows users to identify other users for sending digital assets. Bob will send the 5 BTC to Alice via her public address.

Here is how the process works:

  1. Bob unlocks his unspent outputs using his digital wallet to send 5 BTC to Alice.
  2. Bob’s UTXO of 100 BTC is his input to the transaction. Once Bob indicates from his wallet that he only wants to send 5 BTC to Alice, the 5 BTC is deducted from the 100 BTC. (100 – 5)
  3. The 5 BTC are sent to Alice’s address and the remainder of 95 BTC are sent back to Bob.
  4. Alice’s balance is increased by 5 BTC (30 + 5) for a total of 35 BTC.

This is a simplified overview of how the process works. In reality, the transaction must undergo confirmations in order to be validated to the blockchain. This is another mechanism that uses the PoW (Proof-of-Work) consensus algorithm.

Bob’s output (95 BTC) from the transaction will become his input to his next transaction. Multiple transactions can occur on the network at the same time. Suppose that Carol wanted to pay Bob 20 BTC at around the same time that Bob was sending 5 BTC to Alice. This is possible since transactions can run in parallel, though they are still processed in sequence. While Bob’s transaction with Alice has a UTXO of 95 BTC, Bob’s transaction with Carol is a UTXO of 20 BTC.

Bob’s total balance is the sum of all his UTXO,

∑ ( utxo1 + utxo2 + … + utxon ) = utxo’

where n is the last term of the UTXO. In our example Bob’s total balance would be:

Total Balance = 95 BTC + 20 BTC = 115 BTC

Using blockchain analytics, all of Bob’s transactions can be viewed based on the TXHash. This contains information like the block number, number of confirmations and total fees.

On another note, the sum of the UTXO between Bob and Alice must not change. Before the transaction Bob had 100 BTC and Alice had 30 BTC.

100 BTC + 30 BTC = 130 BTC

At the end of their transaction, not including other UTXO, the sum must still be 130 BTC.

95 BTC + 35 BTC = 130 BTC

If the amount remained the same for Bob after he sent 5 BTC to Alice, then this is an example of a “double spend”.

100 BTC + 35 BTC = 135 BTC

The amount of 135 BTC is not correct since 5 BTC was spent from Bob’s UTXO. It should remain balanced at 130 BTC.

UTXO allows the Bitcoin blockchain to keep track of a user’s balance. Every BTC spent becomes a UTXO for another user. It also helps to prevent “double-spending” of a digital asset through a system of confirmations to verify the UTXO exists. The confirmations are possible because the UTXO is read by nodes on the Bitcoin network for validation. When there is a consensus among the nodes on the network that the UTXO is valid and has not been spent on another transaction, it is recorded on the blockchain. Once it is recorded, the data cannot be modified, changed or deleted unless there is a majority consensus to do so. This means no single entity can reverse or commit a double spend of the same transaction (Note: The exception is if they have the majority control (e.g. hash power), which requires at least 51% of the network). The transfer of ownership of BTC is thus concluded in the transaction.