We are aware of fraudulent individuals impersonating Leather on a number of accounts. Please note that there is no official Leather Telegram group or Leather token.

We are aware of fraudulent individuals impersonating Leather on a number of accounts. Please note that there is no official Leather Telegram group or Leather token.

We are aware of fraudulent individuals impersonating Leather on a number of accounts. Please note that there is no official Leather Telegram group or Leather token.

How Does Bitcoin's UTXO Model Work?

How Does Bitcoin's UTXO Model Work?

How Does Bitcoin's UTXO Model Work?

Mark Hendrickson

Author

Annie Pei

Reviewer

Bitcoin Network

Sep 16, 2024

Unlike the account-based model used in traditional banking systems, which keeps track of balances in accounts, the UTXO model focuses on tracking individual units of cryptocurrency (UTXOs) as they are transferred between users. 


Unspent Transaction Outputs (UTXOs) are the remaining amounts of a cryptocurrency that are left over after a transaction. You can think of them like the change you receive after making a purchase.


UTXOs are a core component of the Bitcoin blockchain. They help track ownership, prevent double-spending, and ensure the integrity of the entire network.


But, there’s a dark side to Bitcoin UTXOs.


Having a large number of small UTXOs can indeed lead to higher transaction fees. This is because each UTXO used as input in a transaction adds to the data size of the transaction, and fees are often based on transaction size.


Bitcoin’s UTXOs keep breaking all-time highs, crossing 185 million as of June 2024. This UTXO count, which was around 105 million, surged over 76% in a year, making it one of the most significant increases in UTXO count over a single year since the launch of BTC in 2009.


In this article, we’ll explain what a Bitcoin UTXO is, its working model, and how Leather implements it.  

What is Bitcoin UTXO?

A Bitcoin Unspent Transaction Output (UTXO) is a small unit of BTC (a.k.a. Dust) that remains after a transaction. It represents a specific amount of BTC that has been authorized by a sender and is available to be spent by a recipient.


When Satoshi Nakamoto unveiled Bitcoin in 2009, BTC was the first digital currency to introduce the UTXO model. Following Bitcoin’s success, more protocols, such as Litecoin (LTC), Bitcoin Cash (BCH), and Dogecoin (DOGE), implemented this model.


Think of UTXOs as coins in your pocket.


Each coin has a specific value, and you can combine them to make a payment. Similarly, when you want to send BTC, your wallet software will select and combine multiple UTXOs to make up the desired amount. Any leftover BTC from this process is returned to you as a new UTXO (your change).


Just like you can't split a physical coin, you can't split a UTXO.


Let’s understand with a hypothetical transaction example.


If you have 3 UTXOs (0.5 BTC, 0.2 BTC, and 0.1 BTC) and want to send 0.6 BTC, your wallet will select the 0.5 BTC and 0.1 BTC UTXOs as inputs. The transaction will create two outputs: 0.6 BTC for the recipient and 0.2 BTC as change back to you (which becomes a new UTXO).


Often, the leftover “dust”, 0.2 BTC in our example, is ignored due to its insignificant nature (the amount is generally much smaller IRL).

Bitcoin’s UTXO Model: How It Works

Bitcoin uses the UTXO (Unspent Transaction Output) model to track ownership, transactions, and prevent double-spending.


When you receive Bitcoin, you're essentially getting a new UTXO added to your collection. If you want to spend BTC, you need to use one or more of your existing UTXOs.


But what if you want to spend a small amount, say 0.1 BTC, but the smallers UTXO in your wallet is only 0.2 BTC?


If you need to send a smaller amount than what a single UTXO holds, your wallet will automatically select and combine multiple UTXOs to make up the right amount. Any leftover amount is returned to you as a new, smaller UTXO.


Each UTXO has a history attached to it, showing where it came from and who owned it previously. This history is permanently recorded on the blockchain, Bitcoin's public ledger. This makes all transactions transparent and traceable,helping to prevent fraud and double-spending.


Leather, as a Bitcoin wallet, helps you manage your UTXOs. It automatically selects the right UTXOs for your transactions, calculates any change you're owed, and ensures that your Bitcoin transactions are secure and valid.


If the UTXOs match the exact value of the required transactions, you will not receive any UTXOs in return.

UTXO Data Structure

We mentioned earlier that a large number of UTXOs add to the transaction fees as they increase data size. So, what does the data look like?


Each UTXO is a data structure containing:


  • Transaction ID: A unique hash identifying the transaction that created this UTXO.

  • Output Index: Indicates the specific output within the transaction (since a single transaction can have multiple outputs).

  • Value: The amount of Bitcoin associated with this UTXO (in satoshis, the smallest unit of Bitcoin).

  • Locking Script (ScriptPubKey): A small script specifying the conditions that must be met to spend this UTXO.This typically involves providing a valid digital signature proving ownership of the associated Bitcoin address.

How Does Stacks Implement Bitcoin’s UTXO Model?

Stacks operates using Bitcoin’s UTXO model to function as a blockchain with the finality and security of Bitcoin’s blockchain. It uses Clarity, a smart contract language specifically designed for predictability and security.


Clarity's smart contracts play a crucial role in Stacks' interaction with Bitcoin's UTXO model to manage assets and state. Clarity is also secure because its design eliminates the risks (like re-entrancy attacks, integer overflow/underflow, memory safety issues) associated with popularly used compiled smart contract languages like Solidity, Vyper, Rust, etc.


STX is Stacks’ native token, which can be used to pay transaction fees, register names, and participate in consensus. All STX transactions follow the UTXO model to execute Bitcoin-like transactions consisting of inputs, outputs, and scripts that define spending conditions.


Proof of transfer (PoX) is the consensus mechanism of Stacks, which uses Bitcoin’s Proof of Work (PoW) chain as its anchor chain. This method further reinforces the link between Stacks and Bitcoin's UTXO model.

How Does Leather Implement the Bitcoin UTXO Model via Stacks?

Leather is a wallet designed specifically for the Bitcoin Web3 ecosystem, which leverages the Bitcoin blockchain and its UTXO model. Here's how Leather implements the UTXO model:

Managing STX, BTC Tokens, and Clarity Contracts

Leather allows its users to send, receive, and store STX tokens using supported crypto wallet addresses. STX transactions follow the UTXO model, meaning they consist of inputs (previous UTXOs the user owns) and outputs (new UTXOs created for the recipient and any change returned to the sender).


Since Stacks is anchored to Bitcoin, Leather interacts with Bitcoin's UTXO set to enable BTC transactions alongside STX transactions. This integration allows users to seamlessly manage both cryptocurrencies within a single wallet interface.


Leather enables users to interact with Clarity smart contracts on the Stacks blockchain. These smart contracts can manage and transfer crypto assets represented as UTXOs on Stacks.


By adhering to the UTXO model, Leather ensures that assets held within Clarity smart contracts are secure and verifiable on the Stacks blockchain.

User Interface and Security 

Leather displays a history of STX and Bitcoin transactions, allowing users to track their UTXOs and the associated transaction details. Leather shows the user's available balance of STX and BTC, which is calculated based on the unspent UTXOs they own.


The wallet also securely manages users' private keys, which are essential for authorizing transactions and proving ownership of UTXOs. Leather also employs encryption to protect sensitive user data and transaction information.

Take Control of Your BTC: Optimize UTXOs with Leather

The Bitcoin UTXO model, a fundamental element of blockchain technology, has far-reaching implications beyond its role in preventing double-spending. The model's influence extends to newer blockchains like Stacks, which leverages Bitcoin's security and finality through its own implementation of the UTXO model.


Continuing with our “coins” analogy, Bitcoin UTXOs in your wallet are essentially “loose change” and can weigh you down if left unchecked. Leather offers an intuitive and secure way to manage your UTXOs, potentially reducing fees and streamlining your transactions.


By seamlessly integrating the UTXO model for both STX and BTC transactions, Leather simplifies the management of these assets.

Article Navigation

Article Navigation